TiDB MCP Server
Сервер TiDB MCP
Сервер Model Context Protocol (MCP) для TiDB, позволяющий выполнять запросы SELECT с помощью инструментов MCP.
Функции
Выполнение запросов SELECT на TiDB
Безопасное соединение через переменные среды
Легкий и простой в использовании
Related MCP server: MCP Server for MySQL
Предпосылки
Node.js 16+
Экземпляр TiDB
Установка
Установка через Smithery
Чтобы автоматически установить TiDB Server для Claude Desktop через Smithery :
npx -y @smithery/cli install @l1806858547/tidb-server --client claudeЧерез npx
npx tidb-mcp-serverГлобальная установка
npm install -g tidb-mcp-server
tidb-mcp-serverКонфигурация
Перед запуском установите следующие переменные среды:
export TIDB_HOST="your_tidb_host"
export TIDB_PORT="your_tidb_port"
export TIDB_USER="your_username"
export TIDB_PASS="your_password"
export TIDB_DB="your_database"
# Optional operation permissions (default: false)
export ALLOW_INSERT_OPERATION="false" # Set to "true" to allow INSERT operations
export ALLOW_UPDATE_OPERATION="false" # Set to "true" to allow UPDATE operations
export ALLOW_DELETE_OPERATION="false" # Set to "true" to allow DELETE operations
WARNING: Enabling these operations may expose your database to modification risks.
Only enable what you need and ensure proper access controls are in place.Использование
Запустите сервер:
tidb-serverДобавьте в конфигурацию MCP (cline_mcp_settings.json):
{
"mcpServers": {
"tidb-server": {
"command": "npx",
"args": ["-y", "tidb-mcp-server"], # Also adding the -y flag for consistency
"env": {
"TIDB_HOST": "your_tidb_host",
"TIDB_PORT": "your_tidb_port",
"TIDB_USER": "your_username",
"TIDB_PASS": "your_password",
"TIDB_DB": "your_database"
}
}
}
}Используйте инструмент MCP:
const result = await use_mcp_tool({
server_name: 'tidb-server',
tool_name: 'tidb_query',
arguments: {
sql: 'SELECT * FROM your_table LIMIT 10'
}
});Разработка
Клонируйте репозиторий:
git clone https://github.com/l1806858547/tidb-server.git
cd tidb-serverУстановить зависимости:
npm installСтроить:
npm run buildБегать:
node build/index.jsЛицензия
Массачусетский технологический институт
Available Tools
1 tooltidb_queryC
Execute SQL queries against TiDB
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The SQL query to execute |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on permissions, side effects, rate limits, or response format. It fails to address critical aspects like whether queries are read-only, transactional, or have other constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste, clearly front-loading the tool's purpose. It is appropriately sized for a simple tool with one parameter and no complex context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete for a tool that executes SQL queries. It omits essential context like return value format, error handling, or behavioral traits, leaving significant gaps for an AI agent to understand the tool fully.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the input schema already documents the 'sql' parameter fully. The description does not add any meaning beyond what the schema provides, such as SQL dialect specifics or query limitations, resulting in a baseline score.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Execute SQL queries') and target resource ('against TiDB'), providing a specific verb+resource combination. It distinguishes the tool's function effectively, though there are no sibling tools to differentiate from, which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or context for its application. It lacks explicit usage instructions, making it minimally helpful for decision-making in a broader toolset.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
tidb_query
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.
A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The naming pattern is straightforward and clear.
A single tool is too few for a database server like TiDB, which typically requires operations beyond just querying (e.g., schema management, data manipulation, administration). This minimal set severely limits functionality.
The tool surface is severely incomplete for a TiDB server. It only supports query execution, missing essential operations like creating/dropping tables, inserting/updating/deleting data, managing indexes, or handling transactions.
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for Studex tools, notifications, and profile integrations
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables SQL query execution, database management, and business intelligence capabilities through MySQL connections.892 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.14,187 npm2,157MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.14,187 npmMIT
- AlicenseBqualityCmaintenanceA Model Context Protocol server that enables SQL operations (SELECT, INSERT, UPDATE, DELETE) and table management through a standardized interface with SQLite databases.731 npm1ISC