Back to .md Directory

Get started with Windsurf and TiDB MCP Server

Walks through connecting a TiDB cluster to Windsurf via MCP, with both guided and manual setup paths.

May 2, 2026
0 downloads
0 views
ai mcp
View source

What this file does

Walks through connecting a TiDB cluster to Windsurf via MCP, with both guided and manual setup paths.

When to use it

  • Setting up Windsurf to query a TiDB Cloud Starter cluster
  • Configuring a custom TiDB cluster with manual MCP credentials
  • Generating and storing a root password for TiDB Cloud access

Assumes this stack

WindsurfTiDBPythonuv

title: Get started with Windsurf and TiDB MCP Server description: This guide shows you how to configure the TiDB MCP Server in Windsurf.

Get started with Windsurf and TiDB MCP Server

This guide shows you how to configure the TiDB MCP Server in Windsurf.

Prerequisites

Before you begin, ensure you have the following:

  • Windsurf: Download and install Windsurf from windsurf.com.
  • Python (>=3.10) and uv: Ensure Python (version 3.10 or later) and uv are installed. Follow the installation guide to install uv.
  • A TiDB cluster: For a managed option, create a TiDB Cloud Starter cluster at tidbcloud.com.

Connect to TiDB Cloud Starter (recommended)

Use the TiDB Cloud console to gather the connection details, then update Windsurf's MCP configuration.

  1. Go to the Clusters page, select your cluster, and then click Use with AI Tools in the upper-right corner.

  2. In the Access your_cluster_name with AI tools dialog, select the Branch and Database that Windsurf should access.

  3. Review the Prerequisites list in the dialog and install any missing dependencies.

  4. 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.
  5. Select the Windsurf tab and copy the provided connection values.

  6. Update your mcp_config.json file using the copied values. For more information, see the Windsurf MCP documentation.

Manual configuration (any TiDB cluster)

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>"
      }
    }
  }
}

See also

What's inside

Prerequisites, guided TiDB Cloud setup, manual config with JSON example, and a see-also link.

Change this for your project

  • Replace "TIDB_HOST": "<YOUR_TIDB_HOST>" with your actual host
  • Replace "TIDB_PORT": "<YOUR_TIDB_PORT>" with your actual port
  • Replace "TIDB_USERNAME": "<YOUR_TIDB_USERNAME>" with your actual username
  • Replace "TIDB_PASSWORD": "<YOUR_TIDB_PASSWORD>" with your actual password

Where it goes

Save as AGENTS.md in your repository root. Read by Codex, Cursor and other agents that follow the AGENTS.md convention.

Worth borrowing

  • Using environment variables in MCP config to avoid hardcoding secrets in JSON
  • Offering a guided UI path and a manual fallback for different user preferences

Related Documents