Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

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.

README.md

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

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Databases servers.