Get started with Claude Desktop and TiDB MCP Server
This guide shows how to configure the TiDB MCP Server in Claude Desktop.
Prerequisites
Before you begin, ensure you have the following:
- Claude Desktop: Download and install Claude Desktop from claude.ai.
- Python (>=3.10) and uv: Ensure Python (3.10 or later) and
uvare installed. Follow the installation guide to installuv. - A TiDB Cloud Starter instance: You can create a free TiDB Cloud Starter instance on TiDB Cloud.
Setup steps
Follow the steps below to set up the TiDB MCP Server in Claude Desktop:
Open the Settings dialog.
Click the Developers tab in the dialog.
Click the Edit Config button to open the MCP config file
claude_desktop_config.json.Copy the following configuration into the
claude_desktop_config.jsonfile.{ "mcpServers": { "TiDB": { "command": "uvx --from pytidb[mcp] tidb-mcp-server", "env": { "TIDB_HOST": "localhost", "TIDB_PORT": "4000", "TIDB_USERNAME": "root", "TIDB_PASSWORD": "", "TIDB_DATABASE": "test" } } } }On the My TiDB page, click the name of your target TiDB Cloud Starter instance to go to its overview page.
Click Connect in the upper-right corner to get the connection parameters, and replace the
TIDB_HOST,TIDB_PORT,TIDB_USERNAME,TIDB_PASSWORD, andTIDB_DATABASEvalues with your own.Restart Claude Desktop.
For more details, see how to configure the MCP server in Claude Desktop.