Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

greptimedb-mcp-server

MCP.Pizza Chef: GreptimeTeam

The greptimedb-mcp-server is a Model Context Protocol server implementation designed for GreptimeDB. It provides AI assistants with a secure, structured interface to explore databases by listing tables, reading data, and executing SQL queries. This server ensures responsible database access through controlled capabilities like listing resources, calling tools, and managing prompts, making it ideal for integrating AI workflows with GreptimeDB data.

Use This MCP server To

List database tables for AI-driven data exploration Execute SQL queries securely via AI assistants Read and retrieve table data for analysis Manage and invoke database-related prompts Integrate GreptimeDB with AI-enhanced workflows Control AI access to database resources securely

README

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.

Capabilities

  • list_resources to list tables
  • read_resource to read table data
  • list_tools to list tools
  • call_tool to execute an SQL
  • list_prompts to list prompts
  • get_prompt to get the prompt by name

Installation

pip install greptimedb-mcp-server

Configuration

Set the following environment variables:

GREPTIMEDB_HOST=localhost    # Database host
GREPTIMEDB_PORT=4002         # Optional: Database port (defaults to 4002 if not specified)
GREPTIMEDB_USER=root
GREPTIMEDB_PASSWORD=
GREPTIMEDB_DATABASE=public

Or via command-line args:

  • --host the database host
  • --port the database port
  • --user the database username
  • --password the database password
  • --database the database name

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

{
  "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"
      }
    }
  }
}

License

MIT License - see LICENSE.md file for details.

Contribute

Prerequisites

  • Python with uv package manager
  • GreptimeDB installation
  • MCP server dependencies

Development

# 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

Acknowledgement

This library's implementation was inspired by the following two repositories and incorporates their code, for which we express our gratitude:

Thanks!

greptimedb-mcp-server FAQ

How do I install greptimedb-mcp-server?
Install it via pip using 'pip install greptimedb-mcp-server'.
How do I configure database connection settings?
Set environment variables like GREPTIMEDB_HOST, GREPTIMEDB_PORT, GREPTIMEDB_USER, GREPTIMEDB_PASSWORD, and GREPTIMEDB_DATABASE or use command-line arguments.
What capabilities does this MCP server provide?
It supports listing tables, reading table data, executing SQL queries, listing tools, and managing prompts.
How does greptimedb-mcp-server ensure secure database access?
It exposes a controlled interface for AI to interact with the database, limiting operations to safe, authorized actions.
Can I use this server with different LLM providers?
Yes, it is provider-agnostic and works with models like OpenAI, Claude, and Gemini.
Is it possible to extend or customize prompts?
Yes, the server supports listing and retrieving prompts by name for flexible AI interactions.
What is the default port if GREPTIMEDB_PORT is not set?
The default port is 4002.
Can this server be used in production environments?
Yes, it is designed for secure and structured database access suitable for production use.