TDengine Query MCP Server
This server enables read-only TDengine database querying and exploration for AI assistants.
Run read-only SQL queries (
SELECT,SHOW,DESCRIBE) withquery_taos_db_data.List databases with
get_all_dbs.List stables with
get_all_stables, optionally for a specified database.Inspect stable field/schema information with
get_field_infos.Check whether a stable exists with
test_table_exists.Switch the current session database with
switch_dbusingUSE.Access database-list and all-stables/schema resources, plus prompts for writing or explaining TDengine SQL.
It does not support write operations, schema design/generation, or full database administration.
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.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TDengine Query MCP Server show me the first 10 records from the sales_data table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TDengine Query MCP Server
A Model Context Protocol (MCP) server that provides read-only TDengine database queries for AI assistants. Execute queries, explore database structures, and investigate your data directly from your AI-powered tools.
Requirements: Python 3.12+ and the MCP Python SDK v2 (
mcp>=2.3,<3). See Migrating to MCP SDK v2 if you are coming from0.0.x.
Supported AI Tools
This MCP server works with any tool that supports the Model Context Protocol, including:
Cursor IDE: Set up in
.cursor/mcp.jsonAnthropic Claude: Use with a compatible MCP client
Other MCP-compatible AI assistants: Follow the tool's MCP configuration instructions
Related MCP server: MySQL Query MCP Server
Features & Limitations
What It Does
✅ Execute read-only TDengine queries (SELECT, SHOW, DESCRIBE only)
✅ Provide database/stable information and metadata
✅ List available database and stables
What It Doesn't Do
❌ Execute write operations (INSERT, UPDATE, DELETE, CREATE, ALTER, etc.)
❌ Provide database design or schema generation capabilities
❌ Function as a full database management tool
This tool is designed specifically for data investigation and exploration through read-only queries. It is not intended for database administration, schema management, or data modification.
How to use
Run from source code
The recommended way to use this MCP server is to run it directly with uv without installation. This is how both Claude Desktop and Cursor are configured to use it in the examples below.
If you want to clone the repository:
git clone https://github.com/Abeautifulsnow/tdengine-mcp.git
cd tdengine-mcpThen you can run the server directly:
uv run src/tdengine_mcp_server -th 192.100.8.22 -db log -ll debugAlternatively you can change the .env file in the src/tdengine_mcp_server/ directory to set the environment variables and run the server with the following command:
uv run src/tdengine_mcp_serverImportant: the .env file will have higher priority than the command line arguments.
Install From Pypi by pip command
# Install globally with pip
pip install tdengine_mcp_serverand then run:
python -m tdengine_mcp_server -hInstall by uvx command
uvx tdengine-mcp-server -hInstall From smithery by npx command
npx -y @smithery/cli@latest install @Abeautifulsnow/tdengine-mcp --client cursor --config '"{}"'You can change the client after the --client option with alternatives claude, 'windsurf' and so on. Also you can refer to this: smithery/tdengine-mcp-server
Configuration Options
.env file
Environment Variable | Description | Default |
LOG_LEVEL | Set the log level (DEBUG, INFO, WARN, ERROR) | INFO |
TDENGINE_HOST | Database host for environment | localhost |
TDENGINE_PORT | Database port | 6041 |
TDENGINE_USERNAME | Database username | root |
TDENGINE_PASSWORD | Database password | taosdata |
TDENGINE_DATABASE | Database name | log |
TDENGINE_TIMEOUT | Set the connection timeout in seconds | 30 |
TRANSPORT | Control the transport to use ( | stdio |
MCP_HOST | Host to bind for the HTTP transports ( | 0.0.0.0 |
MCP_PORT | Port to bind for the HTTP transports ( | 8000 |
.envis loaded by the server itself (python-dotenv), not by the MCP SDK. Since SDK v2 no longer readsMCP_*variables or.envfiles on its own,MCP_HOST/MCP_PORTare honoured by this server's own configuration layer.
cli usage
$ 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] [-trans {sse,stdio,http,streamable-http}]
[--host HOST] [--port PORT]
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 {sse,stdio,http,streamable-http}, --transport {sse,stdio,http,streamable-http}
The transport to use (`http` is an alias of
`streamable-http`). Default: `sse`
--host HOST Host to bind for the HTTP transports (sse /
streamable-http). Default: `0.0.0.0`
--port PORT Port to bind for the HTTP transports (sse /
streamable-http). Default: `8000`HTTP endpoints: sse serves GET /sse (messages back to POST /messages/), http / streamable-http serves /mcp. The HTTP transport runs stateless with JSON responses, so it can sit behind a plain reverse proxy or load balancer.
Integration with AI Assistants
Your AI assistant can interact with TDengine databases through the MCP server. Here are some examples:
Example queries:
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?Using TDengine MCP Tools
The server exposes six tools, two resources and two prompts:
Tool | Purpose |
| Run any read-only SQL ( |
| List databases |
| List stables of a database (defaults to the configured one) |
|
|
| Check whether a stable exists |
|
|
Resource | Purpose |
| Database list as text |
| All stables + field schema as JSON |
Prompt | Purpose |
| TDengine-oriented prompt for writing queries |
| Ask the model to explain a given SQL statement |
Example:
Use the query_taos_db_data tool to run:
SELECT * FROM customers WHERE itemid > '2025-01-01' LIMIT 10;Use the get_field_infos tool to check the meta info about the specified stable.Security Considerations
✅ Only read-only queries are allowed (SELECT, SHOW, DESCRIBE)
Troubleshooting
Connection Issues
If you're having trouble connecting:
Verify your database credentials in your MCP configuration
Ensure the TDengine server is running and accessible
Check for firewall rules blocking connections
Enable debug mode by setting
LOG_LEVELin your configuration
Common Errors
Error: Query execution failed
Verify your SQL syntax
Check that you're only using supported query types (SELECT, SHOW, DESCRIBE)
Ensure your query is truly read-only
Migrating to MCP SDK v2
Version 0.1.0 upgrades the server from MCP Python SDK 1.6.0 to 2.3.0. The MCP surface (tool / resource / prompt names and arguments) is unchanged, so existing MCP clients keep working. Internally:
FastMCPwas renamed toMCPServer;mcp.server.fastmcp.*no longer exists and all imports moved tomcp.server.mcpserver.*.Transport options (
host,port,json_response,stateless_http) are no longer constructor settings: they are passed torun(), andstreamable-http(aliashttp) is available as a third transport. TheMCP_HOST/MCP_PORTenvironment variables are read by this project instead of the SDK.Tool handlers that raise now surface a generic
Error executing tool <name>to the client, so database and SQL errors are raised asToolErrorto keep the real reason visible to the model.Sync handlers run on a worker thread in v2, so the blocking
taosrestHTTP calls no longer stall the event loop.mcp2.x pullsmcp-types,httpx2andopentelemetry-api, and requirespydantic>=2.12;httpx/httpx-sse/pydantic-settingsare no longer installed.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
For more information or support, please open an issue on the GitHub repository.
Available Tools
6 toolsget_all_dbsB
Get all databases.
Returns:
TaosSqlResponse: All databases in the current Taos configuration.
Inputs: no named parameters. Returns: data, head, rows, status, +1 more
get_all_stablesC
Get all stables.
Args:
db_name (Optional[str]): The name of the database. Defaults to None. When the value is None, it means the configured database is used.
Returns:
TaosSqlResponse: All stables in the current Taos database.
Inputs: db_name. Returns: data, head, rows, status, +1 more
get_field_infosC
Get the field information of the specified stable.
Args:
db_name (Optional[str]): The name of the database. Defaults to None. When the value is None, it means the configured database is used.
stable_name (str): The name of the stable.
Returns:
TaosSqlResponse: The field information of the specified stable.
Inputs: stable_name (required), db_name. Returns: data, head, rows, status, +1 more
query_taos_db_dataB
Important: Run a read-only SQL query on Taos database(涛思数据库).
Args:
sql_stmt (str): The sql statement you want to retrieve data from taos db.
Returns:
List: All data from the specified table.Inputs: sql_stmt (required). Returns: data, head, rows, status, +1 more
switch_dbB
Switch to the specified database.
Args:
db_name (str): The name of the database to switch to.
Returns:
TaosSqlResponse: The result of the `USE` command.
Inputs: db_name (required). Returns: data, head, rows, status, +1 more
test_table_existsB
Important: Check if the stable exists in the current Taos database(涛思数据库) configuration.
Args:
stable_name (str): The name of the stable.
Returns:
Dict: The `stable_name` exists or not in the current Taos configuration. If the `stable_name` does not exist, an empty dictionary is returned.
The key of the dictionary is the `stable_name` name, and the value is a boolean indicating whether the `stable_name` exists.
Inputs: stable_name (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: get_all_dbs lists databases, get_all_stables lists stables, get_field_infos retrieves field details, query_taos_db_data executes SQL queries, switch_db changes database context, and test_table_exists checks stable existence. The descriptions clearly differentiate their functions, preventing agent misselection.
The naming follows a consistent snake_case pattern with clear verb_noun structures (e.g., get_all_dbs, switch_db, test_table_exists). The only minor deviation is query_taos_db_data, which includes 'taos_db' in the name while others omit it, but this doesn't significantly impact readability or predictability.
With 6 tools, this server is well-scoped for database querying and management. Each tool serves a specific, necessary function in the TDengine domain, from basic queries to metadata inspection and context switching, without being overly sparse or bloated.
The toolset covers core database operations effectively: querying data, listing databases and stables, inspecting schema, switching contexts, and checking existence. A minor gap is the lack of write operations (e.g., insert, update, delete), but for a query-focused server, the surface is largely complete and supports common agent workflows.
Maintenance
Related MCP Connectors
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseAqualityBmaintenanceA Model Context Protocol server implementation that enables AI assistants to securely interact with GreptimeDB, allowing them to explore database schema, read data, and execute SQL queries through a controlled interface.1529MIT
- AlicenseAqualityCmaintenanceA Model Context Protocol server that provides read-only MySQL database queries for AI assistants, allowing them to execute queries, explore database structures, and investigate data directly from AI-powered tools.322 npm13MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI assistants with comprehensive access to SQL databases, enabling schema inspection, query execution, and database operations with enterprise-grade security.30 npm9MIT
- FlicenseAqualityNot gradedmaintenanceA Model Context Protocol server that provides read-only access to Datasette instances, enabling AI assistants to explore, query, and analyze data from Datasette databases through a standardized interface.52-