
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 分