Skip to main content

A Model Context Protocol (MCP) server that enables secure interaction with GreptimeDB databases. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.

Project description

greptimedb-mcp-server

PyPI - Version build workflow MIT License

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_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 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).

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",
        "GREPTIMEDB_TIMEZONE": ""
      }
    }
  }
}

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_greptimedb_mcp_server-0.2.2.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_greptimedb_mcp_server-0.2.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_greptimedb_mcp_server-0.2.2.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_greptimedb_mcp_server-0.2.2.tar.gz
Algorithm Hash digest
SHA256 23e2cee006151e61c3a44d1be699d8324ad33044d7be5fae177da7a33064c68c
MD5 b13c35eebc84b40928c92b25716407da
BLAKE2b-256 d07729b84e92478e80ec4deaceeecd48b078f78175eeb39fa5ea1d672504d0db

See more details on using hashes here.

File details

Details for the file iflow_mcp_greptimedb_mcp_server-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_greptimedb_mcp_server-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0973f29af197fa1c856be00fdaae27170f3e1b6b6cfe03a778efd5a211484176
MD5 abe0e5d671c8eabb2c60cd8ddeaab39d
BLAKE2b-256 89a0c8e5e50c2b72669992797f75f3d7679cbeb6b449c0d90dd778538b0e2e55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page