| title | Get started with Windsurf and TiDB MCP Server |
|---|---|
| summary | This guide shows you how to configure the TiDB MCP Server in Windsurf. |
This guide shows how to configure the TiDB MCP Server in Windsurf.
Before you begin, ensure you have the following:
- Windsurf: Download and install Windsurf from windsurf.com.
- Python (>=3.10) and uv: Ensure Python (3.10 or later) and
uvare installed. Follow the installation guide to installuv. - A {{{ .starter }}} instance: You can create a free {{{ .starter }}} instance on TiDB Cloud.
Use the TiDB Cloud console to gather the connection details, then update Windsurf's MCP configuration.
-
On the My TiDB page, click the name of your target {{{ .starter }}} instance to go to its overview page, and then click Use with AI Tools in the upper-right corner.
-
In the displayed dialog, select the Branch and Database that Windsurf should access.
-
Review the Prerequisites list in the dialog and install any missing dependencies.
-
Configure the root password:
- If you have not set a password yet, click Generate Password and store it in a secure location (it is shown only once).
- If a password already exists, enter it in the Enter the password for easy setup field.
- If you forget the password, click Reset password in the Prerequisites section to generate a new one.
-
Select the Windsurf tab and copy the provided connection values.
-
Update your
mcp_config.jsonfile using the copied values. For more information, see the Windsurf MCP documentation.
If you prefer manual setup, update your mcp_config.json file as follows and replace the placeholders with your connection parameters:
{
"mcpServers": {
"TiDB": {
"command": "uvx",
"args": ["--from", "pytidb[mcp]", "tidb-mcp-server"],
"env": {
"TIDB_HOST": "<YOUR_TIDB_HOST>",
"TIDB_PORT": "<YOUR_TIDB_PORT>",
"TIDB_USERNAME": "<YOUR_TIDB_USERNAME>",
"TIDB_PASSWORD": "<YOUR_TIDB_PASSWORD>",
"TIDB_DATABASE": "<YOUR_TIDB_DATABASE>"
}
}
}
}