Skip to main content
Glama
GreptimeTeam

GreptimeDB MCP Server

Official
by GreptimeTeam

greptimedb-mcp-服务器

PyPI - 版本 构建工作流程 MIT 许可证

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 MySQL port (defaults to 4002 if not specified)
GREPTIMEDB_USER=root
GREPTIMEDB_PASSWORD=
GREPTIMEDB_DATABASE=public

或者通过命令行参数:

  • --host数据库主机,默认为localhost

  • --port数据库端口,必须是 MySQL 协议端口,默认为4002

  • --user数据库用户名,默认为空,

  • --password数据库密码,默认为空,

  • --database数据库名称,默认为public

用法

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 文件。

贡献

Related MCP server: SQLite MCP Server

先决条件

  • 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

致谢

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

谢谢!

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GreptimeTeam/greptimedb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server