SuperAPI AI Directory

greptimedb-mcp-server

Query GreptimeDB.

Open website

About this tool

Purpose

greptimedb-mcp-server is the Model Context Protocol (MCP) server for GreptimeDB. GreptimeDB is an open-source observability database that handles metrics, logs, and traces in a single engine. This server enables AI assistants to query and analyze data in GreptimeDB.

Main Capabilities

  • Query and analysis: Supports SQL, TQL (PromQL-compatible), and RANGE queries.
  • Table semantics: The semantic metadata in search_table_semantics and describe_table reads information_schema.table_semantics. When a table has the greptime.semantic.* option, or built-in conventions derive an entity declaration for it, the table appears in this view; other tables do not appear. The server reads the column list of this view once per process and selects only the columns it exposes. entity_declarations requires GreptimeDB 1.3; in earlier versions it is reported as a missing column rather than an empty declaration set.
  • Result size limit: Tool results are limited by GREPTIMEDB_MAX_RESULT_BYTES (default 1048576, i.e. 1 MiB). Query results that exceed the budget return fewer rows and report this in truncated and truncation_reason; if the result has no rows that can be trimmed, a hint is appended at the end to indicate truncation. This budget is a fallback measure to prevent results from becoming too large to consume; if the MCP client rejects results before reaching this value, this value can be lowered.
  • Cross-database queries: The server connects to a single database, but reads are not limited to that database. The connecting account needs read permission on the target database; SHOW DATABASES can be used to list databases. query_semantic_graph reads greptime_private.semantic_entities and greptime_private.semantic_relationships, and requires GreptimeDB 1.3. At startup, the server checks whether these two views exist, whether they contain the columns it reads, and whether the connecting account can read them; if not satisfied, it does not providethis tool and records the reason. Its time window is required and is the half-open interval [start_time, end_time), based on observed_at, and rows are aggregated by 60-second observation buckets within that window.
  • Pipeline management.
  • Dashboard management.
  • Resources and prompts: For resources, tables can be browsed via greptime://<table>/data URIs; for prompts, built-in Jinja templates are provided for common tasks, including 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 diagnostics, the assistant can be pointed to the GreptimeDB skill index https://docs.greptime.com/SKILL.md。

Usage

For Claude Desktop, add the following to the configuration (on macOS, ~/Library/Application Support/Claude/claude_desktop_config.json).

HTTP server mode is supported, suitable for containerized or Kubernetes deployments. By default, DNS rebinding protection is disabled for compatibility with proxies, gateways, and Kubernetes services; to enable it, use --allowed-hosts. If you encounter a 421 Invalid Host Header error, you can disable protection (the default) or add the host to the allowlist.

Using a read-only database user is recommended: create a read-only user in GreptimeDB using a static user provider.

Application-layer security gate: all queries pass through the security gate, whose behavior includes—blocking DROP, DELETE, TRUNCATE, UPDATE, INSERT, ALTER, CREATE, GRANT, REVOKE, EXEC, LOAD, COPY; blocking encoding bypass attempts (hex, UNHEX, CHAR); allowing SELECT, SHOW, DESCRIBE, TQL, EXPLAIN, UNION.

Write mode (disabled by default): the server is read-only by default. Write mode enables all operations that change storage state, including executing destructive SQL (DDL/DML, such as CREATE, DROP, ALTER, INSERT, UPDATE, DELETE) via execute_sql, as well as create_pipeline, delete_pipeline, create_dashboard, delete_dashboard. When enabled, the security gate of execute_sql is bypassed, and the server logs a warning at startup. When write mode is off, these four tools return an error directly without contacting the server; list_pipelines, list_dashboards, and dryrun_pipeline are read-only and always available. Note: this lets the AI assistant run destructive statements against your database; never enable it for production data; if you only need read access, you can use it in combination with a read-only database user.

Sensitive column masking: automatically masks as ****** based on column name patterns, including authentication-related (password, secret, token, api_key, credential), financial (credit_card, cvv, bank_account), and personal (ssn, id_card, passport). Custom patterns can be added via --mask-patterns phone,email.

Audit log: all tool calls are recorded and can be disabled via --audit-enabled false.

Use cases

Suitable for scenarios where an AI assistant needs to query and analyze metrics, logs, and tracing data in GreptimeDB, such as observability data analysis, PromQL-compatible queries, table structure and semantic exploration, Pipeline and Dashboard management, and completing tasks such as log pipeline creation, metric analysis, trace analysis, schema design suggestions, and query performance tuning through built-in prompt templates.

Limitations

  • Read-only by default; write mode is disabled by default, and the official documentation explicitly warns against enabling it for production data.
  • entity_declarations and query_semantic_graph require GreptimeDB 1.3; in earlier versions, entity_declarations is reported as a missing column, and query_semantic_graph is not provided when the view check fails.
  • Cross-database reads require the connecting account to have read permission on the target database.
  • Tool results are limited by GREPTIMEDB_MAX_RESULT_BYTES and are truncated when exceeded.
  • DNS rebinding protection is disabled by default.

License

MIT License, see LICENSE.md.

Acknowledgments

ktanaka101/mcp-server-duckdb, designcomputer/mysql_mcp_server, mikeskarl/mcp-prompt-templates.