Add the TiDB MCP server to Windsurf
Config last verified Jun 1, 2026
The exact config to run TiDB in Windsurf — paste it in, restart, and the tools load.
Prerequisites
- Windsurf installed.
- TIDB_HOST — Hostname of your TiDB server or TiDB Cloud cluster.
- TIDB_PORT — Port of the TiDB server, typically 4000.
- TIDB_USERNAME — TiDB username used to authenticate.
- TIDB_PASSWORD — Password for the TiDB user.
- TIDB_DATABASE — Default database to connect to.
Setup
1. Open ~/.codeium/windsurf/mcp_config.json
On Windows the file lives at %USERPROFILE%\.codeium\windsurf\mcp_config.json.
2. Add this configuration
Add to ~/.codeium/windsurf/mcp_config.json
~/.codeium/windsurf/mcp_config.json
json
{
"mcpServers": {
"tidb": {
"command": "uvx",
"args": [
"--from",
"pytidb[mcp]",
"tidb-mcp-server"
],
"env": {
"TIDB_HOST": "<TIDB_HOST>",
"TIDB_PORT": "<TIDB_PORT>",
"TIDB_USERNAME": "<TIDB_USERNAME>",
"TIDB_PASSWORD": "<TIDB_PASSWORD>",
"TIDB_DATABASE": "<TIDB_DATABASE>"
}
}
}
}3. Restart Windsurf and confirm the TiDB tools load.
Gotchas
Windsurf's Cascade reads MCP servers from an "mcpServers" object in ~/.codeium/windsurf/mcp_config.json. Unlike most clients, remote servers are configured with the "serverUrl" field rather than "url", so a config that uses "url" silently fails to connect. Native remote transport is supported without an OAuth flow.