by GreptimeTeam
Provides AI assistants with a secure and structured interface to list tables, read data, and execute SQL queries on GreptimeDB.
A Model Context Protocol (MCP) server implementation that enables AI assistants to interact with GreptimeDB in a controlled manner. It exposes operations for listing tables, reading table data, executing arbitrary SQL statements, and managing prompts.
pip install greptimedb-mcp-server
export GREPTIMEDB_HOST=localhost
export GREPTIMEDB_PORT=4002
export GREPTIMEDB_USER=root
export GREPTIMEDB_PASSWORD=
export GREPTIMEDB_DATABASE=public
export GREPTIMEDB_TIMEZONE=UTC
Or run the server with flags such as --host
, --port
, --user
, --password
, --database
, --timezone
.uv run -m greptimedb_mcp_server.server
The server can also be started with a specific working directory using the --directory
option.list_resources
: retrieve a list of tables in the database.read_resource
: fetch rows from a specified table with optional limits.list_tools
: enumerate available tools (e.g., SQL executor).call_tool
: run an arbitrary SQL query and return results.list_prompts
/ get_prompt
: manage prompt templates for AI assistants.Q: Is the server production‑ready? A: It is experimental; data security and privacy concerns have not been fully addressed, so use with caution.
Q: Which database versions are supported? A: GreptimeDB exposing a MySQL‑compatible protocol (default port 4002).
Q: How can I secure the server? A: Run it in a trusted environment, limit network exposure, and consider adding authentication layers on top of the MCP interface.
Q: Can I customize prompts?
A: Yes, use the list_prompts
and get_prompt
endpoints to retrieve and manage prompt templates.
Q: How do I debug the server?
A: The project recommends the MCP Inspector (npx @modelcontextprotocol/inspector uv …
) for interactive debugging.
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.
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.
list_resources
to list tablesread_resource
to read table datalist_tools
to list toolscall_tool
to execute an SQLlist_prompts
to list promptsget_prompt
to get the prompt by namepip install greptimedb-mcp-server
Set the following environment variables:
GREPTIMEDB_HOST=localhost # Database host
GREPTIMEDB_PORT=4002 # Optional: Database MySQL port (defaults to 4002 if not specified)
GREPTIMEDB_USER=root
GREPTIMEDB_PASSWORD=
GREPTIMEDB_DATABASE=public
GREPTIMEDB_TIMEZONE=UTC
Or via command-line args:
--host
the database host, localhost
by default,--port
the database port, must be MySQL protocol port, 4002
by default,--user
the database username, empty by default,--password
the database password, empty by default,--database
the database name, public
by default.--timezone
the session time zone, empty by default(using server default time zone).Configure the MCP server in Claude Desktop's configuration file:
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Location: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"greptimedb": {
"command": "uv",
"args": [
"--directory",
"/path/to/greptimedb-mcp-server",
"run",
"-m",
"greptimedb_mcp_server.server"
],
"env": {
"GREPTIMEDB_HOST": "localhost",
"GREPTIMEDB_PORT": "4002",
"GREPTIMEDB_USER": "root",
"GREPTIMEDB_PASSWORD": "",
"GREPTIMEDB_DATABASE": "public",
"GREPTIMEDB_TIMEZONE": ""
}
}
}
}
MIT License - see LICENSE.md file for details.
uv
package manager# Clone the repository
git clone https://github.com/GreptimeTeam/greptimedb-mcp-server.git
cd greptimedb-mcp-server
# Create virtual environment
uv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
uv sync
# Run tests
pytest
Use MCP Inspector for debugging:
npx @modelcontextprotocol/inspector uv \
--directory \
/path/to/greptimedb-mcp-server \
run \
-m \
greptimedb_mcp_server.server
This library's implementation was inspired by the following two repositories and incorporates their code, for which we express our gratitude:
Thanks!
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "greptimedb": { "command": "uv", "args": [ "run", "-m", "greptimedb_mcp_server.server" ], "env": { "GREPTIMEDB_HOST": "localhost", "GREPTIMEDB_PORT": "4002", "GREPTIMEDB_USER": "root", "GREPTIMEDB_PASSWORD": "", "GREPTIMEDB_DATABASE": "public", "GREPTIMEDB_TIMEZONE": "" } } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by googleapis
An MCP server that streamlines database tool development by handling connection pooling, authentication, observability, and secure access, allowing agents to interact with databases via natural language.
by bytebase
Provides a universal gateway that lets MCP‑compatible clients explore and query MySQL, PostgreSQL, SQL Server, MariaDB, and SQLite databases through a single standardized interface.
by designcomputer
Enables secure interaction with MySQL databases via the Model Context Protocol, allowing AI applications to list tables, read contents, and execute queries safely.
by benborla
Provides read‑only access to MySQL databases for large language models, allowing schema inspection and safe execution of SQL queries.
by ClickHouse
Enables AI assistants to run read‑only ClickHouse queries, list databases and tables, and execute embedded chDB queries through an MCP interface.
by chroma-core
Offers an MCP server exposing Chroma's vector database capabilities for LLM applications, supporting collection and document management, multiple embedding functions, and flexible client types such as in‑memory, persistent, HTTP, and cloud.
by kiliczsh
Enables LLMs to interact with MongoDB databases via a standardized interface, offering schema inspection, query execution, aggregation, and write capabilities, with optional read‑only mode and smart ObjectId handling.
by domdomegg
Provides read and write access to Airtable bases for AI systems, enabling inspection of schemas and manipulation of records.
by XGenerationLab
A Model Context Protocol (MCP) server that enables natural language queries to databases