TiDB Cloud Zero MCP Server
Click on "Install 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., "@TiDB Cloud Zero MCP ServerCreate a products table with id, name, and price columns"
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.
TiDB Cloud Zero MCP Server
Give any AI agent a persistent MySQL database through the Model Context Protocol.
Zero config — the server automatically provisions a free TiDB Cloud Zero instance on first use. No signup, no API keys, no credentials. Just run it.
How It Works
┌─────────────┐ MCP ┌──────────────┐ HTTPS ┌─────────────────┐
│ AI Agent │◄────────────►│ MCP Server │◄────────────►│ TiDB Cloud Zero │
│ (Claude, │ stdio/http │ (this repo) │ /v1beta/sql │ (free MySQL) │
│ Cursor) │ │ │ pure HTTP │ │
└─────────────┘ └──────────────┘ └─────────────────┘On first query, the server calls POST https://zero.tidbapi.com/v1alpha1/instances to create a free database, then uses the TiDB Serverless HTTP API for all SQL — pure HTTPS, no MySQL driver, no persistent connections.
The instance credentials are cached locally (~/.tidb-cloud-zero-mcp/instance.json) and reused until expiry.
Related MCP server: MySQL MCP Server
Quick Start
git clone https://github.com/siddontang/tidb-cloud-zero-mcp.git
cd tidb-cloud-zero-mcp
uv run server.pyThat's it. No environment variables needed. The first query auto-provisions a database.
Connect to Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"tidb": {
"command": "uv",
"args": ["run", "--project", "/path/to/tidb-cloud-zero-mcp", "server.py"]
}
}
}Connect to Claude Code
claude mcp add tidb -- uv run --project /path/to/tidb-cloud-zero-mcp server.pyConnect to Cursor / Windsurf
Add to your MCP settings:
{
"tidb": {
"command": "uv",
"args": ["run", "--project", "/path/to/tidb-cloud-zero-mcp", "server.py"]
}
}HTTP Transport
uv run server.py --transport http
# Connect at http://localhost:8000/mcpBring Your Own Database (Optional)
If you already have a TiDB Cloud instance, set TIDB_URL:
export TIDB_URL="mysql://user:password@host/database"
uv run server.pyOr individual variables:
export TIDB_HOST="gateway01.us-west-2.prod.aws.tidbcloud.com"
export TIDB_USERNAME="your_user"
export TIDB_PASSWORD="your_password"
export TIDB_DATABASE="test"Tools
Tool | Description |
| Run SELECT / SHOW / DESCRIBE / EXPLAIN |
| Run CREATE / INSERT / UPDATE / DELETE / ALTER |
| Run multiple SQL statements sequentially |
| List all tables with row counts |
| Get table schema |
| Database info, version, and instance status |
Example Interactions
Once connected, ask your AI agent:
"Create a users table and add some sample data"
"Show me all tables in the database"
"Analyze the data in the orders table"
"Write a query to find the top 10 customers by revenue"
The agent uses MCP tools to interact with TiDB Cloud Zero directly — no configuration needed.
Architecture
Every SQL query is a single HTTP POST to TiDB's Serverless HTTP API:
POST https://http-{host}/v1beta/sql
Authorization: Basic {base64(user:pass)}
TiDB-Database: {database}
Content-Type: application/json
{"query": "SELECT * FROM users"}This means:
No MySQL driver — works anywhere with HTTPS
No connection management — stateless, each query is independent
Edge-compatible — runs in serverless functions and edge workers
Auto-provisioning — database created on first use via Zero API
Why TiDB Cloud Zero?
Feature | Benefit |
Zero signup | No account, no credit card — just use it |
MySQL compatible | Works with every tool, ORM, and language |
Serverless | No provisioning, no maintenance |
HTTP API | No drivers needed, pure HTTPS |
Vector Search | Store embeddings alongside relational data |
Disposable | 72-hour instances for testing and demos |
Development
uv sync # Install dependencies
uv run mcp dev server.py # Test with MCP Inspector
uv run server.py --transport http # Run HTTP serverLicense
MIT
Try TiDB Cloud: Free Trial • Essential 101 • Startup Program • TiDB Cloud AI
Available Tools
6 toolsbatch_executeA
Execute multiple SQL statements sequentially.
Args: statements: List of SQL statements to execute in order
Example: batch_execute([ "CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255))", "INSERT INTO users (name) VALUES ('Alice')", "INSERT INTO users (name) VALUES ('Bob')" ])
| Name | Required | Description | Default |
|---|---|---|---|
| statements | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must disclose behavioral traits. It only mentions 'sequentially', but fails to describe error handling, transactional behavior, partial failure semantics, permissions, or return aggregation. Critical for a batch execution tool, this gap leaves the agent uncertain about side effects and failure atomicity.
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 concise: a one-sentence summary plus an Args section and a clear example. It is well-structured and front-loaded, with no wasted words. The example is illustrative without being overly verbose.
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?
The tool has moderate complexity, with an output schema available. The description provides an example and clarifies ordering, but omits important contextual information such as failure semantics, transaction boundaries, and how results are returned. Given the presence of an output schema, return format is less critical, but the gap around error handling lowers completeness.
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 alone defines 'statements' as an array of strings, but the description adds crucial meaning: 'List of SQL statements to execute in order' and the example clarifies usage with DDL and DML statements. Since schema description coverage is 0%, the description compensates well for this single parameter.
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 tool's action: 'Execute multiple SQL statements sequentially.' It specifies the resource (SQL statements) and scope (multiple, sequential), distinguishing it from the sibling tool 'execute' which presumably handles a single statement. This is a specific verb+resource with clear scope.
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 implies usage for running multiple statements in one call, but it does not explicitly contrast with sibling tools like 'execute' or 'query', nor does it provide guidance on when to prefer batch_execute over alternatives. No exclusions or when-not-to-use scenarios are given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_tableA
Get the schema of a table (columns, types, keys).
Args: table: Table name to describe
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only says 'Get the schema' and does not disclose whether the operation is read-only, what happens if the table does not exist, or any permissions required. The verb implies non-mutating but insufficient context is given for a tool with zero annotation support.
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 one sentence plus an argument definition, front-loaded with the purpose. No wasted words, and the structure with 'Args:' is clean and easy to parse.
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?
For a simple 1-parameter tool with an output schema, the description adequately covers purpose and parameter semantics. It lacks usage guidance but remains sufficient for a basic describe operation. The sibling tools make the intended use clear enough.
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?
Schema coverage is 0%, so the description's 'Args: table: Table name to describe' provides essential meaning beyond the bare 'string' type. It clarifies the purpose of the parameter, though it does not specify format, constraints, or examples.
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 states the verb 'Get' and the resource 'schema of a table' with explicit details (columns, types, keys). This clearly distinguishes it from sibling tools like list_tables, query, and get_database_info.
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?
Usage is implied: use this when you need a table's schema. However, there is no explicit guidance on when to choose this over query or execute, nor any exclusion criteria. It falls short of naming alternatives or when-not-to-use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
executeA
Execute a write SQL statement (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP).
Returns the number of affected rows.
Examples: execute("CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255))") execute("INSERT INTO users (name) VALUES ('Alice')")
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description discloses a key behavior—returning the number of affected rows—and labels the operation as a write. However, there are no annotations, and it omits additional important details such as transaction handling, permission requirements, or the risks of DROP statements.
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 short, front-loaded with the core purpose, and includes concise examples. Every sentence adds value without redundancy.
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?
For a one-parameter tool with an output schema, the description is adequate but not fully complete. It would benefit from explicit warnings about destructive statements (DROP) and a note to use query for read-only SELECT, given the tool's powerful nature.
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 is bare (0% coverage) with only 'sql' as a string parameter. The description compensates with concrete examples showing how to pass entire SQL statements, adding meaning beyond the schema's mere type definition.
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 tool executes write SQL statements (CREATE, INSERT, UPDATE, DELETE, ALTER, DROP), identifying a specific action and resource. This distinguishes it from sibling tools like query (for reads) and list_tables (for metadata).
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 clear context by enumerating the statement types it handles, implying it is for write operations. It does not explicitly name alternatives like query for SELECT, but the sibling list and the 'write SQL' phrase give sufficient guidance for typical usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_database_infoA
Get database connection info, TiDB version, and instance status.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of disclosing behavior. It clearly indicates a read-only 'Get' action, but it does not mention any permissions, rate limits, or side effects. For a simple info tool, this is adequate but not rich.
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 sentence that lists three specific outputs without any filler, making it extremely concise and easy to parse.
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 simplicity (no params) and the presence of an output schema, the description fully covers the tool's purpose. The output schema defines the return structure, so the description needn't elaborate further.
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 tool has zero parameters, so the description adds no parameter semantics, but none are needed. The baseline for 0-parameter tools is 4, as the schema already covers everything.
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 uses a specific verb ('Get') and clearly names the resources: database connection info, TiDB version, and instance status. This clearly distinguishes it from sibling tools like list_tables or query, which focus on other aspects.
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 implies usage for retrieving database-level metadata, but it does not explicitly state when to use this tool versus alternatives such as describe_table or query. There is no mention of exclusions or preferred scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesA
List all tables in the current database with row counts.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It implies a read-only operation ('List') and adds the return detail of row counts, but it does not explicitly state that it is non-mutating, discuss potential performance implications, or mention any permissions or side effects. For a simple listing tool this is adequate but not comprehensive.
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, front-loaded sentence with no filler. It communicates the essential information efficiently, earning every word.
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 tool's simplicity (no parameters) and the presence of an output schema (per context signals), the description is complete. It states exactly what the tool does and what information is returned, which is sufficient for an agent to select and invoke it correctly.
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 tool has zero parameters, so the baseline is 4. The description adds meaningful context by indicating that rows counts are included in the output, which goes beyond what the empty schema conveys. No parameter explanations are needed since there are none.
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 tool's action and scope: 'List all tables in the current database with row counts.' It uses a specific verb ('List') and resource ('tables') and adds the distinct detail of 'row counts', which differentiates it from sibling tools like describe_table or get_database_info.
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 clear context for when to use the tool: to list all tables and their row counts. It does not explicitly mention alternatives or exclusions, but the purpose is obvious enough that an agent would know when to invoke it versus query or execute. No misleading guidance is present.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
queryA
Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN).
Returns results as a formatted table.
Examples: query("SELECT * FROM users LIMIT 10") query("SHOW TABLES") query("DESCRIBE users")
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It explicitly states the tool is read-only, which is a critical safety signal, and mentions that results are returned as a formatted table. It does not cover potential errors or limits, but the core behavior is well-disclosed.
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 extremely concise: a single purpose sentence, a result note, and three examples. Every sentence adds value and the key information is front-loaded.
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?
The tool is simple (one parameter) and an output schema exists, so return values are already defined. The description covers usage, allowed statements, and output format, making it complete for an agent to invoke the tool correctly.
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 has only 'sql' with no description (0% coverage). The description compensates by specifying allowed statement types (SELECT, SHOW, DESCRIBE, EXPLAIN) and providing concrete examples, adding semantic meaning beyond the raw parameter name.
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 'Execute a read-only SQL query' with specific allowed commands (SELECT, SHOW, DESCRIBE, EXPLAIN), which is a specific verb+resource. The read-only scoping distinguishes it from the sibling tool 'execute'.
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 clearly indicates this is for read-only SQL queries, providing context for when to use it. However, it does not explicitly mention alternatives or exclusions, though the read-only scope is an implicit exclusion.
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. Dates show when Glama detected each change.
6 tool updates
v0.1.0- First observed
batch_execute - First observed
describe_table - First observed
execute - First observed
get_database_info - First observed
list_tables - First observed
query
TDQS
Some overlap exists between query and list_tables/describe_table since query supports SHOW and DESCRIBE, which can duplicate those tools. However, the descriptions clarify the intended use cases, making selection mostly straightforward.
Names use a consistent lowercase underscore style with imperative verbs, but mix single-word verbs (query, execute) with verb_noun pairs (list_tables, describe_table). This is a minor deviation from a fully uniform pattern.
Six tools is well within the ideal range for a database server MCP, covering both read and write operations without being bloated.
The tool set covers core database operations: listing tables, describing schema, running read-only queries, executing write statements, batch execution, and retrieving server info. No obvious gaps for its stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
An agent-native database over MCP: shared, validated, structured records in every AI chat.
Your AI Agent's Infrastructure Layer. Connect Claude, Copilot, Codex, or ChatGPT to 200+ managed open source services. Start databases, pipelines, and applications through natural language.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI models to interact with MySQL databases through natural language, supporting SQL queries, table creation, and schema exploration.3-
- AlicenseAqualityDmaintenanceA Model Context Protocol server that allows AI agents to execute SQL queries against a MySQL database, supporting operations like reading data, creating tables, inserting, updating, and deleting records.64548MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with TiDB serverless databases through the Model Context Protocol. Allows users to connect to and manage TiDB cloud databases using natural language through Claude Desktop.24Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol service that enables AI assistants to directly query and manage MySQL databases through natural language. It supports SQL execution, schema inspection, and atomic transactions for comprehensive database interaction.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/siddontang/tidb-cloud-zero-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server