GreptimeDB MCP Server

Official

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

greptimedb-mcp-服务器

GreptimeDB的模型上下文协议 (MCP) 服务器实现。

该服务器为AI助手提供了一种安全且结构化的方式来探索和分析数据库。它使AI助手能够通过受控的界面列出表格、读取数据并执行SQL查询,从而确保负责任的数据库访问。

功能

  • list_resources列出表
  • read_resource读取表数据
  • list_tools列出工具
  • call_tool执行 SQL
  • list_prompts列出提示
  • get_prompt通过名称获取提示

安装

pip install greptimedb-mcp-server

配置

设置以下环境变量:

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

或者通过命令行参数:

  • --host数据库主机
  • --port数据库端口
  • --user数据库用户名
  • --password数据库密码
  • --database数据库名称

用法

Claude 桌面集成

在Claude Desktop的配置文件中配置MCP服务器:

MacOS

位置: ~/Library/Application Support/Claude/claude_desktop_config.json

视窗

位置: %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" } } } }

执照

MIT 许可证 - 有关详细信息,请参阅 LICENSE.md 文件。

贡献

先决条件

  • Python 与uv包管理器
  • GreptimeDB 安装
  • MCP 服务器依赖项

发展

# 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

使用MCP Inspector进行调试:

npx @modelcontextprotocol/inspector uv \ --directory \ /path/to/greptimedb-mcp-server \ run \ -m \ greptimedb_mcp_server.server

致谢

本库的实现受到了以下两个仓库的启发并整合了它们的代码,对此我们表示感谢:

谢谢!

-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器实现,使 AI 助手能够安全地与 GreptimeDB 交互,允许他们通过受控界面探索数据库模式、读取数据和执行 SQL 查询。

  1. Capabilities
    1. Installation
      1. Configuration
        1. Usage
          1. Claude Desktop Integration
        2. License
          1. Contribute
            1. Prerequisites
            2. Development
          2. Acknowledgement
            ID: s7x4xtbklm