
Greptimedb Mcp Server
io.github.GreptimeTeam由 GitHub 账号 GreptimeTeam 发布v0.6.0更新于 Oct 24, 2026
Query GreptimeDB metrics, logs and traces with SQL, TQL and RANGE. Manage pipelines and dashboards.
概览
本地 MCP 服务器,让 AI 助手用 SQL、TQL 和 RANGE 查询分析 GreptimeDB 的指标、日志与链路数据,并管理管道和仪表盘。
- 可以做什么
- 执行 SQL、TQL(兼容 PromQL)和 RANGE 时间窗口查询,支持 csv/json/markdown 输出与行数限制,并可查看执行计划和连接健康状态。按可观测性概念检索表、查看表画像,并查询实体与关系的语义图。通过 greptime:// 资源 URI 浏览表数据。列出、创建、试运行和删除数据摄取管道。列出、创建或更新、删除 Perses 仪表盘。使用内置提示模板完成管道创建、指标与 PromQL 分析、链路分析、模式设计和查询调优。
- 适用场景
- 适合已部署 GreptimeDB、希望助手在对话中探索其指标、日志和链路数据、编写并解释查询,或管理管道与仪表盘的场景。默认面向只读分析,写入需显式开启。
- 运行要求
- 以 Python 包形式在本地运行,通过 pip 安装 greptimedb-mcp-server。需要可访问的 GreptimeDB 实例及连接配置:GREPTIMEDB_HOST、GREPTIMEDB_PORT(MySQL 协议,默认 4002)、GREPTIMEDB_USER、GREPTIMEDB_PASSWORD、GREPTIMEDB_DATABASE,管理管道和仪表盘还需 GREPTIMEDB_HTTP_PORT。部分语义工具要求 GreptimeDB 1.3。需要能访问数据库的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Greptimedb Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
greptimedb-mcp-server
[PyPI - Version] [build workflow] [MCP Registry] [MIT License]
A Model Context Protocol (MCP) server for GreptimeDB — an open-source observability database that handles metrics, logs, and traces in one engine.
Enables AI assistants to query and analyze GreptimeDB using SQL, TQL (PromQL-compatible), and RANGE queries, with built-in security features like read-only enforcement and data masking.
Quick Start
For Claude Desktop, add this to your config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Features
Tools
search_table_semantics and the semantic metadata in describe_table read information_schema.table_semantics. A table appears there when it carries a greptime.semantic.* option or a built-in convention derives an entity declaration for it; other tables are absent. The server reads the view's column list once per process and selects only the columns it exposes. entity_declarations requires GreptimeDB 1.3; on earlier versions it is reported as a missing column rather than as an empty declaration set.
Tool results are bounded by GREPTIMEDB_MAX_RESULT_BYTES (default 1048576, or 1 MiB). A query result over the budget returns fewer rows and reports it in truncated and truncation_reason; a result with no rows to shed is cut with a notice at the end. The budget is a backstop against a result too large to be consumed, so lower it if your MCP client rejects results before it is reached.
Cross-database queries
The server connects to one database, but reads are not restricted to it:
The connected account needs read permission on the target database. Use SHOW DATABASES to list them.
query_semantic_graph reads greptime_private.semantic_entities and greptime_private.semantic_relationships, which require GreptimeDB 1.3. At startup the server checks that both views exist, carry the columns it reads, and are readable by the connected account; when they are not, the tool is not offered and the reason is logged. Its time window is required and half-open, [start_time, end_time) over observed_at, and rows are aggregated across the 60-second observation buckets in that window.
Pipeline Management
Dashboard Management
Resources & Prompts
- Resources: Browse tables via
greptime://<table>/dataURIs - Prompts: Built-in Jinja templates for common tasks —
pipeline_creator,log_pipeline,metrics_analysis,promql_analysis,trace_analysis,table_operation,schema_design_advisor,observability_correlation,ingestion_troubleshooting,query_performance_tuning
For LLM integration and prompt usage, see docs/llm-instructions.md.
These tools cover querying and managing data in an existing GreptimeDB. For deployment, server configuration, write protocols, pipeline syntax, schema design, and performance diagnosis, point the assistant at the GreptimeDB skills index at https://docs.greptime.com/SKILL.md.
Configuration
Environment Variables
CLI Arguments
HTTP Server Mode
For containerized or Kubernetes deployments:
DNS Rebinding Protection
By default, DNS rebinding protection is disabled for compatibility with proxies, gateways, and Kubernetes services. To enable it, use --allowed-hosts:
If you encounter 421 Invalid Host Header errors, either disable protection (default) or add your host to the allowed list.
Security
Read-Only Database User (Recommended)
Create a read-only user in GreptimeDB using static user provider:
Application-Level Security Gate
All queries go through a security gate that:
- Blocks: DROP, DELETE, TRUNCATE, UPDATE, INSERT, ALTER, CREATE, GRANT, REVOKE, EXEC, LOAD, COPY
- Blocks: Encoded bypass attempts (hex, UNHEX, CHAR)
- Allows: SELECT, SHOW, DESCRIBE, TQL, EXPLAIN, UNION
Write Mode (Disabled by Default)
The server is read-only by default. Write mode enables every operation that changes stored state:
- destructive SQL (DDL/DML such as
CREATE,DROP,ALTER,INSERT,UPDATE,DELETE) throughexecute_sql create_pipeline,delete_pipeline,create_dashboard,delete_dashboard
When enabled, the security gate is bypassed for execute_sql, and the server
logs a warning on startup. With write mode off, those four tools return an error
without contacting the server; list_pipelines, list_dashboards and
dryrun_pipeline are read-only and stay available.
⚠️ Danger: This lets an AI assistant run destructive statements against your database. Never enable it against production data. Combine with a read-only database user if you only need read access.
Data Masking
Sensitive columns are automatically masked (******) based on column name patterns:
- Authentication:
password,secret,token,api_key,credential - Financial:
credit_card,cvv,bank_account - Personal:
ssn,id_card,passport
Configure with --mask-patterns phone,email to add custom patterns.
Audit Logging
All tool invocations are logged:
Disable with --audit-enabled false.
Development
License
MIT License - see LICENSE.md.
Acknowledgement
Inspired by:
来源:README.md,提交 5347e7e
工具
0版本历史
1- v0.6.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分