TiDB Cloud Zero MCP Server

TiDB Cloud Zero MCP Server

Enables AI agents to interact with a persistent MySQL database through the Model Context Protocol, with automatic provisioning of a free TiDB Cloud Zero instance requiring no signup or configuration.

Category
Visit Server

README

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.

Quick Start

git clone https://github.com/siddontang/tidb-cloud-zero-mcp.git
cd tidb-cloud-zero-mcp
uv run server.py

That'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.py

Connect 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/mcp

Bring 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.py

Or 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
query Run SELECT / SHOW / DESCRIBE / EXPLAIN
execute Run CREATE / INSERT / UPDATE / DELETE / ALTER
batch_execute Run multiple SQL statements sequentially
list_tables List all tables with row counts
describe_table Get table schema
get_database_info 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 server

License

MIT


Try TiDB Cloud: Free TrialEssential 101Startup ProgramTiDB Cloud AI

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured