Model Context Protocol (MCP)[1] 是 Anthropic 推出的开放协议,让 LLM 能够安全地访问外部工具和数据源。GreptimeDB MCP Server[2] v0.3(最新 v0.3.1)在安全性、可观测性工作流和日志 Pipeline 创建方面带来重要更新。
❝最新消息:随着 Linux 基金会成立 Agentic AI 基金会[3],Anthropic 已将 MCP 协议捐献给该基金会。一同捐献的还有 Block 的 Goose 和 OpenAI 的 AGENTS.md 等项目。
如果你是第一次了解 GreptimeDB MCP Server,可以先阅读我们的介绍文章[4],了解 MCP 如何连接 LLM 和可观测性数据库。
v0.3 新特性
数据脱敏
LLM 查询数据库时,敏感数据可能意外出现在响应中。比如你让 Claude 查询用户表,结果可能包含密码或 API 密钥字段。v0.3 引入自动数据脱敏,在数据到达 LLM 之前保护这些敏感信息。
内置脱敏模式覆盖三类字段:
认证凭证: password
、passwd
、pwd
、secret
、token
、api_key
、apikey
、access_key
、private_key
、credential
、auth
、authorization财务信息: credit_card
、creditcard
、card_number
、cardnumber
、cvv
、cvc
、pin
、bank_account
、account_number
、iban
、swift个人隐私: ssn
、social_security
、id_card
、idcard
、passport
匹配字段在所有输出格式中显示为 ******
。通过环境变量配置:
# 禁用脱敏(默认启用)
GREPTIMEDB_MASK_ENABLED=false
# 添加自定义模式(逗号分隔,扩展默认模式)
GREPTIMEDB_MASK_PATTERNS=phone,address,email

TQL 和 RANGE 查询工具
新增三个时序分析工具:
execute_tql | start、 end、 step和可选 lookback参数 |
query_range | |
explain_query | EXPLAIN ANALYZE获取实际指标 |
TQL 查询示例:
{
"query": "rate(http_requests_total[5m])",
"start": "2024-01-01T00:00:00Z",
"end": "2024-01-01T01:00:00Z",
"step": "1m"
}
更多 TQL 语法请参考 TQL 文档[6]。
Pipeline 管理:AI 驱动的日志解析
GreptimeDB 的日志 Pipeline[7] 将原始日志转换为结构化数据。v0.3 新增 MCP 工具直接管理 Pipeline:
create_pipeline | |
dryrun_pipeline | |
delete_pipeline | |
list_pipelines |
pipeline_creator
Prompt 模板帮助 LLM 从日志样本生成 Pipeline 配置,包含:
Pipeline 处理器: dissect
、regex
、date
、epoch
、gsub
、selectTransform 配置和数据类型 索引选择最佳实践: inverted
、fulltext
、skipping日志表设计建议
示例对话[8]:Claude 从 nginx 访问日志创建 Pipeline,用 dryrun_pipeline
测试,再用 create_pipeline
部署。

(AI 驱动的日志解析,自动生成 Pipeline 并测试)
Pipeline 配置详情请参考 Pipeline 配置参考[9]。
升级 Prompt 模板
全部七个 Prompt 模板现在包含 References 章节,链接到官方文档:
pipeline_creator | ||
log_pipeline | ||
metrics_analysis | ||
promql_analysis | ||
iot_monitoring | ||
trace_analysis | ||
table_operation |
此外,我们修复了 trace_analysis
和 table_operation
模板中的列名和查询语法问题。
其他改进
HTTPS 支持:通过 GREPTIMEDB_HTTP_PROTOCOL=https
或--http-protocol https
使用 TLS 连接安全网关修复: SHOW CREATE TABLE
现在被正确允许性能优化:HTTP 连接复用 aiohttp.ClientSession输出格式:所有查询工具支持 csv
、json
和markdown
输出
快速开始
通过 pip 安装:
pip install greptimedb-mcp-server
或使用 uv 运行:
uv run -m greptimedb_mcp_server.server
配置 MCP 客户端(Claude Desktop[20]、Cursor[21] 等):
{
"mcpServers": {
"greptimedb": {
"command": "greptimedb-mcp-server",
"args": [
"--host", "localhost",
"--port", "4002",
"--database", "public"
]
}
}
}
Pipeline 管理需要 HTTP 端口(默认 4000)可访问。
下一步
本次更新我们将 MCP 服务端升级为 FastMCP API,目前仍采用 stdio 传输模式。下一步计划支持 HTTP SSE 传输,使服务可以长期运行并以独立服务形式部署,详见 Issue #23[22]。
了解更多
GitHub 仓库[23] - 源码、问题反馈和贡献指南 PyPI 包[24] - 安装和版本历史 GreptimeDB 文档[25] - 完整数据库文档 Slack 社区[26] - 问题讨论
关于 Greptime
Greptime 格睿科技专注于打造新一代可观测性数据库,服务开发者与企业用户,覆盖从边缘设备到云端企业级部署的多样化需求。
GreptimeDB 开源版:开源、云原生,统一处理指标、日志和追踪数据,适合中小规模 IoT 与可观测性场景; GreptimeDB 企业版:面向关键业务,提供更高性能、高安全性、高可用性和智能化运维服务;
欢迎加入开源社区参与贡献与交流!推荐从带有 good first issue
标签的任务入手,一起共建可观测未来。添加微信小助手: greptime 参与技术交流!

⭐ Star us on GitHub:https://github.com/GreptimeTeam/greptimedb 📚 官网:https://greptime.cn/ 📖 文档:https://docs.greptime.cn/ 🌍 Twitter:https://twitter.com/Greptime 💬 Slack:https://greptime.com/slack 💼 LinkedIn:https://www.linkedin.com/company/greptime/
往期精彩文章:
批量写入性能提升 2.5 倍:GreptimeDB v1.0.0-beta.2 发布! 深入解析 GreptimeDB MCP:连接数据库与 LLM 的桥梁 让历史数据查询更快:GreptimeDB 索引文件独立缓存指南
Model Context Protocol (MCP): https://modelcontextprotocol.io/
[2]GreptimeDB MCP Server: https://github.com/GreptimeTeam/greptimedb-mcp-server
[3]Agentic AI 基金会: https://www.anthropic.com/news/donating-the-model-context-protocol-and-establishing-of-the-agentic-ai-foundation
[4]介绍文章: https://greptime.cn/blogs/2025-03-17-greptimedb-mcp-server
[5]RANGE/ALIGN 聚合查询: https://docs.greptime.cn/reference/sql/range/
[6]TQL 文档: https://docs.greptime.cn/reference/sql/tql/
[7]日志 Pipeline: https://docs.greptime.cn/user-guide/logs/manage-pipelines
[8]示例对话: https://claude.ai/share/4d2146b1-a308-4115-a5e2-c945b2d23b87
[9]Pipeline 配置参考: https://docs.greptime.cn/reference/pipeline/pipeline-config/
[10]Pipeline 配置: https://docs.greptime.cn/reference/pipeline/pipeline-config/
[11]数据索引: https://docs.greptime.cn/user-guide/manage-data/data-index
[12]全文搜索: https://docs.greptime.cn/user-guide/logs/fulltext-search/
[13]SQL 函数: https://docs.greptime.cn/reference/sql/functions/overview
[14]RANGE 查询: https://docs.greptime.cn/reference/sql/range/
[15]数据模型: https://docs.greptime.cn/user-guide/concepts/data-model
[16]TQL 参考: https://docs.greptime.cn/reference/sql/tql/
[17]表设计: https://docs.greptime.cn/user-guide/deployments-administration/performance-tuning/design-table/
[18]Traces 概述: https://docs.greptime.cn/user-guide/traces/overview
[19]INFORMATION_SCHEMA: https://docs.greptime.cn/reference/sql/information-schema/overview
[20]Claude Desktop: https://claude.ai/download
[21]Cursor: https://www.cursor.com/
[22]Issue #23: https://github.com/GreptimeTeam/greptimedb-mcp-server/issues/23
[23]GitHub 仓库: https://github.com/GreptimeTeam/greptimedb-mcp-server
[24]PyPI 包: https://pypi.org/project/greptimedb-mcp-server/
[25]GreptimeDB 文档: https://docs.greptime.cn/
[26]Slack 社区: https://www.greptime.com/slack




