The GreptimeDB MCP Server enables AI assistants to query, analyze, and manage time-series data, logs, metrics, and traces in GreptimeDB through a secure, read-only interface.
Core Query Capabilities: Execute SQL queries (MySQL dialect, SELECT/SHOW/DESCRIBE only), PromQL-compatible TQL queries, and time-window aggregation queries with RANGE/ALIGN syntax. Multiple output formats available (CSV, JSON, Markdown) with configurable result limits and time ranges.
Schema & Resource Management: List all tables as browsable resources with greptime://<table>/data URIs, inspect table schemas (column names, types, constraints), and read table data through resource endpoints.
Pipeline Management: Create, test (dry-run), list, and delete data processing pipelines using YAML configurations. AI-assisted generation of pipeline configurations from log samples.
Specialized Analysis Templates: Access predefined prompts for log analysis with full-text search, metrics monitoring, PromQL-style queries (TQL EVAL), IoT device monitoring with TAG/FIELD semantics, distributed trace analysis for OpenTelemetry spans, and table diagnostics including region health and query optimization.
Query Analysis & Health: Analyze SQL/TQL query execution plans with EXPLAIN functionality for performance optimization, check database connection status and server version.
Security & Privacy: Automatically blocks all DDL/DML operations (DROP, DELETE, INSERT, UPDATE), dynamic SQL execution, and file system access. Masks sensitive data in columns matching patterns like password, api_key, credit_card, and ssn with configurable patterns.
Integration & Configuration: Seamlessly integrates with Claude Desktop and other MCP-compatible AI assistants. Configurable via environment variables or command-line arguments for connection details, HTTP/HTTPS API settings, timezone, connection pool size, and data masking options.
greptimedb-mcp-server
A Model Context Protocol (MCP) server implementation for GreptimeDB.
This server provides AI assistants with a secure and structured way to explore and analyze databases. It enables them to list tables, read data, and execute SQL queries through a controlled interface, ensuring responsible database access.
Project Status
This is an experimental project that is still under development. Data security and privacy issues have not been specifically addressed, so please use it with caution.
Capabilities
list_resourcesto list tablesread_resourceto read table datalist_toolsto list toolscall_toolto execute an SQLlist_promptsto list promptsget_promptto get the prompt by name
Installation
Configuration
Set the following environment variables:
Or via command-line args:
--hostthe database host,localhostby default,--portthe database port, must be MySQL protocol port,4002by default,--userthe database username, empty by default,--passwordthe database password, empty by default,--databasethe database name,publicby default.
Usage
Claude Desktop Integration
Configure the MCP server in Claude Desktop's configuration file:
MacOS
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows
Location: %APPDATA%/Claude/claude_desktop_config.json
License
MIT License - see LICENSE.md file for details.
Contribute
Related MCP server: MCP Toolkit
Prerequisites
Python with
uvpackage managerGreptimeDB installation
MCP server dependencies
Development
Use MCP Inspector for debugging:
Acknowledgement
This library's implementation was inspired by the following two repositories and incorporates their code, for which we express our gratitude:
Thanks!