TDengine Query MCP Server

MIT License
4

Integrations

  • Supports configuration through environment variables using .env files for setting database connection parameters and logging preferences.

  • Provides issue tracking functionality through GitHub's repository system, allowing users to report problems or request support for the TDengine MCP server.

  • Allows installation of the TDengine MCP server package directly from the Python Package Index using pip.

TDengine 查询 MCP 服务器

模型上下文协议 (MCP) 服务器,为 AI 助手提供只读的TDengine 数据库查询。您可以直接使用 AI 工具执行查询、探索数据库结构并调查数据。

支持的AI工具

该 MCP 服务器可与任何支持模型上下文协议的工具配合使用,包括:

  • Cursor IDE : 在.cursor/mcp.json中设置
  • Anthropic Claude :与兼容的 MCP 客户端一起使用
  • 其他兼容 MCP 的 AI 助手:请遵循工具的 MCP 配置说明

功能与限制

它的作用

  • ✅ 执行只读TDengine 查询(仅限 SELECT、SHOW、DESCRIBE)
  • ✅ 提供数据库/稳定信息和元数据
  • ✅ 列出可用的数据库和库

它不能做什么

  • ❌执行写操作(INSERT、UPDATE、DELETE、CREATE、ALTER 等)
  • ❌ 提供数据库设计或模式生成功能
  • ❌ 充当完整的数据库管理工具

此工具专为通过只读查询进行数据调查和探索而设计。它不适用于数据库管理、架构管理或数据修改。

如何使用

从源代码运行

推荐使用此 MCP 服务器的方式是直接通过uv运行,无需安装。以下示例中,Claude Desktop 和 Cursor 均采用此配置。

如果你想克隆存储库:

git clone https://github.com/Abeautifulsnow/tdengine-mcp.git cd tdengine-mcp

然后就可以直接运行服务器了:

uv run src/tdengine_mcp_server -th 192.100.8.22 -db log -ll debug

或者,您可以更改src/tdengine_mcp_server/目录中的.env文件来设置环境变量,然后使用以下命令运行服务器:

uv run src/tdengine_mcp_server

重要提示:.env 文件的优先级高于命令行参数。

通过pip命令从 Pypi 安装

# Install globally with pip pip install tdengine_mcp_server

然后运行:

python -m tdengine_mcp_server -h

通过uvx命令安装

uvx tdengine-mcp-server -h

通过npx命令从 smithery 安装

npx -y @smithery/cli@latest install @Abeautifulsnow/tdengine-mcp --client cursor --config '"{}"'

您可以在--client选项后使用claude 、windsurf 等替代选项更改客户端。您也可以参考: smithery/tdengine-mcp-server

配置选项

.env 文件

环境变量描述默认
日志级别设置日志级别(DEBUG、INFO、WARN、ERROR)信息
TDENGINE_HOST环境的数据库主机本地主机
TDENGINE_PORT数据库端口6041
TDENGINE_用户名数据库用户名
TDENGINE_密码数据库密码taosdata
TDENGINE_数据库数据库名称日志
TDENGINE_超时设置连接超时时间(以秒为单位)三十
运输控制要使用的传输标准输入输出

命令行用法

$ python3 -m tdengine_mcp_server -h usage: __main__.py [-h] [-th TAOS_HOST] [-tp TAOS_PORT] [-tu TAOS_USERNAME] [-pwd TAOS_PASSWORD] [-db TAOS_DATABASE] [-to TAOS_TIMEOUT] [-ll LOG_LEVEL] TDengine MCP Server options: -h, --help show this help message and exit -th, --taos-host TAOS_HOST TDengine host address. Default: `localhost` -tp, --taos-port TAOS_PORT TDengine port number. Default: `6041` -tu, --taos-username TAOS_USERNAME TDengine username. Default: `root` -pwd, --taos-password TAOS_PASSWORD TDengine password. Default: `taosdata` -db, --taos-database TAOS_DATABASE TDengine database name. Default: `default` -to, --taos-timeout TAOS_TIMEOUT TDengine connection timeout. Default: `30` -ll, --log-level LOG_LEVEL Log level. Default: `INFO` -trans, --transport {sse,stdio} The transport to use. Default: `sse`

与人工智能助手集成

您的AI助手可以通过MCP服务器与TDengine数据库进行交互。以下是一些示例:

示例查询:

Can you use the query tool to show me the first 10 records from the database?
I need to analyze our sales data. Can you run a SQL query to get the total sales per region for last month from the development database?
Can you list all the available databases we have?

使用 TDengine MCP 工具

TDengine Query MCP 服务器提供了三个主要工具供您的 AI 助手使用:

1. 查询

针对特定表执行只读 SQL 查询:

Use the query tool to run: SELECT * FROM customers WHERE itemid > '2025-01-01' LIMIT 10;
2. 信息

获取有关您的马厩的详细信息:

Use the info tool to check the meta info about the specified stable. DESCRIBE disks_info;

安全注意事项

  • ✅ 只允许只读查询(SELECT、SHOW、DESCRIBE)

故障排除

连接问题

如果您在连接时遇到问题:

  1. 在 MCP 配置中验证数据库凭据
  2. 确保 TDengine 服务器正在运行并且可以访问
  3. 检查防火墙规则是否阻止连接
  4. 通过在配置中设置LOG_LEVEL来启用调试模式

常见错误

错误:查询执行失败

  • 验证 SQL 语法
  • 检查您是否仅使用受支持的查询类型(SELECT、SHOW、DESCRIBE)
  • 确保您的查询确实是只读的

贡献

欢迎贡献代码!欢迎提交 Pull 请求。


如需更多信息或支持,请在 GitHub 存储库上打开一个问题

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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议 (MCP) 服务器为 AI 助手提供只读 TDengine 数据库查询,允许用户直接从 AI 工具执行查询、探索数据库结构和调查数据。

  1. Supported AI Tools
    1. Features & Limitations
      1. What It Does
      2. What It Doesn't Do
    2. How to use
      1. Run from source code
      2. Install From Pypi by pip command
      3. Install by uvx command
      4. Install From smithery by npx command
    3. Configuration Options
      1. .env file
      2. cli usage
    4. Integration with AI Assistants
      1. Using TDengine MCP Tools
    5. Security Considerations
      1. Troubleshooting
        1. Connection Issues
        2. Common Errors
      2. Contributing

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
          Last updated -
          1
          2,728
          1,407
          TypeScript
          MIT License
          • Apple
        • -
          security
          F
          license
          -
          quality
          Implements the Model Context Protocol (MCP) to provide AI models with a standardized interface for connecting to external data sources and tools like file systems, databases, or APIs.
          Last updated -
          16
          Python
          • Apple
          • Linux
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) server that wraps the dbt CLI tool, enabling AI coding agents to interact with dbt projects through standardized MCP tools. Developed by Mammoth Growth.
          Last updated -
          8
          Python
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.
          Last updated -
          TypeScript
          MIT License
          • Apple
          • Linux

        View all related MCP servers

        ID: k8v8dsx68k