Tidb MCP Server

Go [tidbcloud.com](https://tidbcloud.com) to create a free TiDB database cluster

Local serverstdioPython

What is the Tidb MCP server?

Tidb MCP server exists for a simple reason — assistants are far more useful when they can act on Tidb directly instead of describing what you should do. Go tidbcloud.com to create a free TiDB database cluster.

What the assistant can call

Once Tidb is connected, these are the calls the assistant has available:

  • TIDB_HOST — TiDB host address, e.g. 'gateway01.us-east-1.prod.aws.tidbcloud.com'
  • TIDB_PORT — TiDB port (default: 4000)
  • TIDB_USERNAME — Database username, e.g. 'xxxxxxxxxx.<username>'
  • TIDB_PASSWORD — Database password
  • TIDB_DATABASE — Database name, default is test

Configuration and credentials

You will need one environment variable: TIDB_HOST. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • uv (Python package installer)

Setting it up

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.

Choosing this one

Plenty of database access servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Tidb's toolset — TIDB_HOST, TIDB_PORT, TIDB_USERNAME and 2 more — is a fair guide to whether it matches your workflow. It is maintained by c4pt0r; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the tidb mcp server does with a few real requests.

Available tools

ToolWhat it does
TIDB_HOSTTiDB host address, e.g. 'gateway01.us-east-1.prod.aws.tidbcloud.com'
TIDB_PORTTiDB port (default: 4000)
TIDB_USERNAMEDatabase username, e.g. 'xxxxxxxxxx.\<username\>'
TIDB_PASSWORDDatabase password
TIDB_DATABASEDatabase name, default is test

How to install the Tidb MCP server

{
  "mcpServers": {
      "tidb": {
          "command": "uv",
          "args": [
              "--directory",
              "/path/to/mcp-server-tidb",
              "run",
              "src/main.py"
          ]
      }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • uv (Python package installer)
VariableDescriptionRequired
TIDB_HOSTEndpoint or connection string the server talks to.Optional

Example prompts to try

  • Use Tidb to TIDB HOST.
  • Use Tidb to TIDB PORT.
  • Use Tidb to TIDB USERNAME.

Frequently asked questions

It connects Tidb to MCP-compatible AI assistants such as Claude and Cursor, exposing 5 tools (TIDB_HOST, TIDB_PORT, TIDB_USERNAME, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Tidb directly.