From 3a410ca46669abe970c492b54abca03351d023dd Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 15:55:32 +0800 Subject: [PATCH 1/9] feat: description of use with ai tools --- TOC-tidb-cloud-starter.md | 3 +- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 125 +++++++++++++++++++++ 2 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 tidb-cloud/tidb-cloud-use-with-ai-tools.md diff --git a/TOC-tidb-cloud-starter.md b/TOC-tidb-cloud-starter.md index ed32db0ea1b09..6dfcd3c2b740e 100644 --- a/TOC-tidb-cloud-starter.md +++ b/TOC-tidb-cloud-starter.md @@ -11,7 +11,8 @@ - [MySQL Compatibility](/mysql-compatibility.md) - Get Started - [Try Out TiDB Cloud](/tidb-cloud/tidb-cloud-quickstart.md) - - [Try Out TiDB + AI](/vector-search/vector-search-get-started-using-python.md) + - [Try Out TiDB + AI Tools](/tidb-cloud/tidb-cloud-use-with-ai-tools.md) + - [Try Out TiDB + Vector](/vector-search/vector-search-get-started-using-python.md) - [Try Out HTAP](/tidb-cloud/tidb-cloud-htap-quickstart.md) - [Try Out TiDB Cloud CLI](/tidb-cloud/get-started-with-cli.md) - Key Concepts diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md new file mode 100644 index 0000000000000..9a7979cf578d8 --- /dev/null +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -0,0 +1,125 @@ +--- +title: Use {{{ .starter }}} with AI Tools +summary: Learn how to use your {{{ .starter }}} cluster with AI tools. +--- + +# Connect to Your {{{ .starter }}} + +This document describes how to use your {{{ .starter }}} cluster with AI tools. + +## Steps + +After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it with AI tools via the following steps: + +1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click a cluster name to go to its overview page, and then click **Use with AI Tools** at the top of the page. +2. In the dialog of **Access `your_cluster_name` with AI tools**, select the **Branch** and **Database** that you want to connect in the AI tool. +3. Ensure that you satisfy the **Prerequisites**. If not, follow the instructions on the page to install the required dependencies. +4. For the password: + + 1. If you have not set a password yet, click **Generate Password** to generate a random password. The generated password will not be shown again, so save your password in a secure location. + 2. If you have already set a password, you can: + + 1. Click **Reset password** in the **Prerequisites** section. This resets the password of the `root` user and might break existing connections to this cluster that use `root`. + 2. You can **Enter the password for easy setup** in the input box. + +5. Switch to the tab you want: **Cursor**, **Claude Code**, **VS Code**, or **Windsurf**. +6. Follow the tool-specific setup steps in the selected tab. + +## Tool-specific setup + +### Cursor + +1. Click **Add to Cursor** to open Cursor, and then click **Install** to finish the setup. +2. Or add the configuration to `.cursor/mcp.json`, like below: + +```json +{ + "mcpServers": { + "TiDB": { + "command": "uvx --from pytidb[mcp] tidb-mcp-server", + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } + } +} +``` + +### Claude Code + +1. Click the first copy button to copy the command. +2. Open the terminal and add the MCP server by running the copied command. +3. Alternatively, follow Claude Code's documentation to add the configuration to `.mcp.json` for project scope, like below: + +```json +{ + "mcpServers": { + "TiDB": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } + } +} +``` + +### VS Code + +1. Click **Add to VS Code** to open VS Code, and then click **Install** to finish the setup. +2. Or add the configuration to `.vscode/mcp.json`, like below: + +```json +{ + "mcpServers": { + "TiDB": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } + } +} +``` + +### Windsurf + +Follow Windsurf's documentation to add the configuration to `mcp_config.json`, like below: + +```json +{ + "mcpServers": { + "TiDB": { + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } + } +} +``` + +## See also + +- [Try Out TiDB + Vector](/vector-search/vector-search-get-started-using-python.md) From f4b88b630fae1130b8877be704651e70d29b91f2 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 16:44:56 +0800 Subject: [PATCH 2/9] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index 9a7979cf578d8..996f1065b295b 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -1,9 +1,9 @@ --- -title: Use {{{ .starter }}} with AI Tools +title: Use {{{ .starter }}} with AI tools summary: Learn how to use your {{{ .starter }}} cluster with AI tools. --- -# Connect to Your {{{ .starter }}} +# Use {{{ .starter }}} with AI tools This document describes how to use your {{{ .starter }}} cluster with AI tools. @@ -12,15 +12,15 @@ This document describes how to use your {{{ .starter }}} cluster with AI tools. After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it with AI tools via the following steps: 1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click a cluster name to go to its overview page, and then click **Use with AI Tools** at the top of the page. -2. In the dialog of **Access `your_cluster_name` with AI tools**, select the **Branch** and **Database** that you want to connect in the AI tool. -3. Ensure that you satisfy the **Prerequisites**. If not, follow the instructions on the page to install the required dependencies. +2. In the **Access `your_cluster_name` with AI tools** dialog, select the **Branch** and **Database** that you want to connect to in the AI tool. +3. Ensure that you meet the **Prerequisites**. If not, follow the instructions on the page to install the required dependencies. 4. For the password: 1. If you have not set a password yet, click **Generate Password** to generate a random password. The generated password will not be shown again, so save your password in a secure location. 2. If you have already set a password, you can: 1. Click **Reset password** in the **Prerequisites** section. This resets the password of the `root` user and might break existing connections to this cluster that use `root`. - 2. You can **Enter the password for easy setup** in the input box. + 2. You can enter your password in the **Enter the password for easy setup** input box. 5. Switch to the tab you want: **Cursor**, **Claude Code**, **VS Code**, or **Windsurf**. 6. Follow the tool-specific setup steps in the selected tab. @@ -30,7 +30,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit ### Cursor 1. Click **Add to Cursor** to open Cursor, and then click **Install** to finish the setup. -2. Or add the configuration to `.cursor/mcp.json`, like below: +2. Or add the configuration to `.cursor/mcp.json`, as follows: ```json { From a0aa3f3e8f38c0aa8ccd73068225a87e0c18eed6 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 16:46:31 +0800 Subject: [PATCH 3/9] Apply suggestions from code review --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index 996f1065b295b..8193a48415bc0 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -53,7 +53,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit 1. Click the first copy button to copy the command. 2. Open the terminal and add the MCP server by running the copied command. -3. Alternatively, follow Claude Code's documentation to add the configuration to `.mcp.json` for project scope, like below: +3. Alternatively, follow Claude Code's documentation to add the configuration to `.mcp.json` for project scope, as follows: ```json { @@ -77,7 +77,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit ### VS Code 1. Click **Add to VS Code** to open VS Code, and then click **Install** to finish the setup. -2. Or add the configuration to `.vscode/mcp.json`, like below: +2. Or add the configuration to `.vscode/mcp.json`, as follows: ```json { @@ -100,7 +100,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit ### Windsurf -Follow Windsurf's documentation to add the configuration to `mcp_config.json`, like below: +Follow Windsurf's documentation to add the configuration to `mcp_config.json`, as follows: ```json { From 1a90add01ba5e1c2f706ddc32a75e773e5016a8a Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 16:52:56 +0800 Subject: [PATCH 4/9] Update tidb-cloud/tidb-cloud-use-with-ai-tools.md Co-authored-by: Yuiham --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index 8193a48415bc0..1400e9dba319d 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -17,10 +17,9 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit 4. For the password: 1. If you have not set a password yet, click **Generate Password** to generate a random password. The generated password will not be shown again, so save your password in a secure location. - 2. If you have already set a password, you can: - - 1. Click **Reset password** in the **Prerequisites** section. This resets the password of the `root` user and might break existing connections to this cluster that use `root`. - 2. You can enter your password in the **Enter the password for easy setup** input box. + 2. If you have already set a password: + 1. You can enter your password in the **Enter the password for easy setup** input box. + 2. If you forget your password, clicking **Reset password** in the **Prerequisites** section to get a new password. Be aware that resetting the password will drop root's connection to the current cluster. 5. Switch to the tab you want: **Cursor**, **Claude Code**, **VS Code**, or **Windsurf**. 6. Follow the tool-specific setup steps in the selected tab. From f21e62f260fca75d7e2bc54a45fa6c9e1aba87c4 Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 17:42:51 +0800 Subject: [PATCH 5/9] Apply suggestions from code review Co-authored-by: Yuiham --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index 1400e9dba319d..3b4b2bda9bebc 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -52,7 +52,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit 1. Click the first copy button to copy the command. 2. Open the terminal and add the MCP server by running the copied command. -3. Alternatively, follow Claude Code's documentation to add the configuration to `.mcp.json` for project scope, as follows: +3. Alternatively, follow [Claude Code's documentation](https://code.claude.com/docs/en/mcp#project-scope) to add the configuration to `.mcp.json` for project scope, as follows: ```json { @@ -99,7 +99,7 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit ### Windsurf -Follow Windsurf's documentation to add the configuration to `mcp_config.json`, as follows: +Follow [Windsurf's documentation](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin) to add the configuration to `mcp_config.json`, as follows: ```json { From 7428c151b8173e7b3c9a16fad154d2ceada401ec Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 17:46:10 +0800 Subject: [PATCH 6/9] feat: add command of claude code --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 111 +++++++++++---------- 1 file changed, 61 insertions(+), 50 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index 3b4b2bda9bebc..a5d54f591d01a 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -31,71 +31,82 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit 1. Click **Add to Cursor** to open Cursor, and then click **Install** to finish the setup. 2. Or add the configuration to `.cursor/mcp.json`, as follows: -```json -{ - "mcpServers": { - "TiDB": { - "command": "uvx --from pytidb[mcp] tidb-mcp-server", - "env": { - "TIDB_HOST": "", - "TIDB_PORT": "", - "TIDB_USERNAME": "", - "TIDB_PASSWORD": "", - "TIDB_DATABASE": "" - } + ```json + { + "mcpServers": { + "TiDB": { + "command": "uvx --from pytidb[mcp] tidb-mcp-server", + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } } - } -} -``` + } + ``` ### Claude Code 1. Click the first copy button to copy the command. -2. Open the terminal and add the MCP server by running the copied command. +2. Open the terminal and add the MCP server by running the copied command, as follows: + + ```bash + claude mcp add --transport stdio TiDB \ + --env TIDB_HOST='' \ + --env TIDB_PORT= \ + --env TIDB_USERNAME='' \ + --env TIDB_PASSWORD='' \ + --env TIDB_DATABASE='' \ + -- uvx --from 'pytidb[mcp]' 'tidb-mcp-server' + ``` + 3. Alternatively, follow [Claude Code's documentation](https://code.claude.com/docs/en/mcp#project-scope) to add the configuration to `.mcp.json` for project scope, as follows: -```json -{ - "mcpServers": { - "TiDB": { - "type": "stdio", - "command": "uvx", - "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], - "env": { - "TIDB_HOST": "", - "TIDB_PORT": "", - "TIDB_USERNAME": "", - "TIDB_PASSWORD": "", - "TIDB_DATABASE": "" - } + ```json + { + "mcpServers": { + "TiDB": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } } - } -} -``` + } + ``` ### VS Code 1. Click **Add to VS Code** to open VS Code, and then click **Install** to finish the setup. 2. Or add the configuration to `.vscode/mcp.json`, as follows: -```json -{ - "mcpServers": { - "TiDB": { - "type": "stdio", - "command": "uvx", - "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], - "env": { - "TIDB_HOST": "", - "TIDB_PORT": "", - "TIDB_USERNAME": "", - "TIDB_PASSWORD": "", - "TIDB_DATABASE": "" - } + ```json + { + "mcpServers": { + "TiDB": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { + "TIDB_HOST": "", + "TIDB_PORT": "", + "TIDB_USERNAME": "", + "TIDB_PASSWORD": "", + "TIDB_DATABASE": "" + } + } } - } -} -``` + } + ``` ### Windsurf From f198a96573e8f4540f620d8be8ba90ca9caac3a9 Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 25 Dec 2025 14:58:44 +0800 Subject: [PATCH 7/9] Apply suggestions from code review Co-authored-by: Aolin --- TOC-tidb-cloud-starter.md | 2 +- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 116 +++++++++++++-------- 2 files changed, 73 insertions(+), 45 deletions(-) diff --git a/TOC-tidb-cloud-starter.md b/TOC-tidb-cloud-starter.md index 6dfcd3c2b740e..21cf79895f67e 100644 --- a/TOC-tidb-cloud-starter.md +++ b/TOC-tidb-cloud-starter.md @@ -12,7 +12,7 @@ - Get Started - [Try Out TiDB Cloud](/tidb-cloud/tidb-cloud-quickstart.md) - [Try Out TiDB + AI Tools](/tidb-cloud/tidb-cloud-use-with-ai-tools.md) - - [Try Out TiDB + Vector](/vector-search/vector-search-get-started-using-python.md) + - [Try Out TiDB + Vector Search](/vector-search/vector-search-get-started-using-python.md) - [Try Out HTAP](/tidb-cloud/tidb-cloud-htap-quickstart.md) - [Try Out TiDB Cloud CLI](/tidb-cloud/get-started-with-cli.md) - Key Concepts diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index a5d54f591d01a..eb3cf7bb06671 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -1,57 +1,82 @@ --- -title: Use {{{ .starter }}} with AI tools -summary: Learn how to use your {{{ .starter }}} cluster with AI tools. +title: Use {{{ .starter }}} with AI Tools +summary: Learn how to connect your {{{ .starter }}} cluster to AI-powered development tools that support the Model Context Protocol (MCP), such as Cursor, Claude Code, VS Code, and Windsurf. --- -# Use {{{ .starter }}} with AI tools +# Use {{{ .starter }}} with AI Tools -This document describes how to use your {{{ .starter }}} cluster with AI tools. +This document describes how to connect your {{{ .starter }}} cluster to AI-powered development tools that support the Model Context Protocol (MCP), such as Cursor, Claude Code, Visual Studio Code (VS Code), and Windsurf. -## Steps +By configuring your TiDB cluster as an MCP server, you can enable AI assistants in your development tools to query your database schema, understand your data model, and generate context-aware code suggestions. -After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it with AI tools via the following steps: +## Before you begin -1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click a cluster name to go to its overview page, and then click **Use with AI Tools** at the top of the page. -2. In the **Access `your_cluster_name` with AI tools** dialog, select the **Branch** and **Database** that you want to connect to in the AI tool. -3. Ensure that you meet the **Prerequisites**. If not, follow the instructions on the page to install the required dependencies. -4. For the password: +To complete this guide, you need the following: - 1. If you have not set a password yet, click **Generate Password** to generate a random password. The generated password will not be shown again, so save your password in a secure location. - 2. If you have already set a password: - 1. You can enter your password in the **Enter the password for easy setup** input box. - 2. If you forget your password, clicking **Reset password** in the **Prerequisites** section to get a new password. Be aware that resetting the password will drop root's connection to the current cluster. +- A {{{ .starter }}} cluster. If you don't have any, you can [create a {{{ .starter }}} cluster](/develop/dev-guide-build-cluster-in-cloud.md). +- [Python 3.11 or higher](https://www.python.org/downloads/) installed. +- [uv](https://docs.astral.sh/uv/getting-started/installation/) installed. +- An AI development tool that supports MCP, such as: -5. Switch to the tab you want: **Cursor**, **Claude Code**, **VS Code**, or **Windsurf**. -6. Follow the tool-specific setup steps in the selected tab. + - [Cursor](https://cursor.com) + - [Claude Code](https://claude.com/product/claude-code) + - [Visual Studio Code](https://code.visualstudio.com) + - [Windsurf](https://windsurf.com) + +## Connect to AI tools + +After you create a {{{ .starter }}} cluster in TiDB Cloud, perform the following steps to connect it to your AI tool. + +1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click the name of your target cluster to go to its overview page. Then, click **Use with AI Tools** at the top of the page. +2. In the **Access `your_cluster_name` with AI tools** dialog, select the **Branch** and **Database** that you want the AI tool to access. +3. Verify that you meet all the **Prerequisites** listed. If not, follow the on-screen instructions to install the required dependencies. +4. Configure the password: + + - If you have not set a password yet, click **Generate Password** to generate a random password. + + The generated password will not show again, so save your password in a secure location. + + - If you have already set a password, enter your password 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. + + Note that resetting your password disconnects all existing root user sessions. + +5. Select the tab for your AI tool: **Cursor**, **Claude Code**, **VS Code**, or **Windsurf**. +6. Complete the setup steps for the selected tool. + + For more information, see [Tool-specific setup](#tool-specific-setup). ## Tool-specific setup ### Cursor -1. Click **Add to Cursor** to open Cursor, and then click **Install** to finish the setup. -2. Or add the configuration to `.cursor/mcp.json`, as follows: +To configure Cursor as an MCP client for TiDB, you can use one of the following methods: + +- **Method 1**: in the TiDB Cloud console, click **Add to Cursor** to launch Cursor, and then click **Install**. +- **Method 2**: manually add the following configuration to your `.cursor/mcp.json` file: ```json { - "mcpServers": { + "mcpServers": { "TiDB": { - "command": "uvx --from pytidb[mcp] tidb-mcp-server", - "env": { + "command": "uvx --from pytidb[mcp] tidb-mcp-server", + "env": { "TIDB_HOST": "", "TIDB_PORT": "", "TIDB_USERNAME": "", "TIDB_PASSWORD": "", "TIDB_DATABASE": "" + } } - } - } + } } ``` ### Claude Code -1. Click the first copy button to copy the command. -2. Open the terminal and add the MCP server by running the copied command, as follows: +To configure Claude Code as an MCP client for TiDB, you can use one of the following methods: + +- **Method 1**: copy the setup command from the TiDB Cloud console and run it in your terminal: ```bash claude mcp add --transport stdio TiDB \ @@ -63,54 +88,56 @@ After your {{{ .starter }}} cluster is created on TiDB Cloud, you can use it wit -- uvx --from 'pytidb[mcp]' 'tidb-mcp-server' ``` -3. Alternatively, follow [Claude Code's documentation](https://code.claude.com/docs/en/mcp#project-scope) to add the configuration to `.mcp.json` for project scope, as follows: +- **Method 2**: add the following configuration to your project-level `.mcp.json` file. For more information, see the [Claude Code documentation](https://code.claude.com/docs/en/mcp#project-scope). ```json { - "mcpServers": { + "mcpServers": { "TiDB": { - "type": "stdio", - "command": "uvx", - "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], - "env": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { "TIDB_HOST": "", "TIDB_PORT": "", "TIDB_USERNAME": "", "TIDB_PASSWORD": "", "TIDB_DATABASE": "" + } } - } - } + } } ``` ### VS Code -1. Click **Add to VS Code** to open VS Code, and then click **Install** to finish the setup. -2. Or add the configuration to `.vscode/mcp.json`, as follows: +To configure VS Code as an MCP client for TiDB, you can use one of the following methods: + +- **Method 1**: click **Add to VS Code** to launch VS Code, and then click **Install**. +- **Method 2**: add the following configuration to your `.vscode/mcp.json` file: ```json { - "mcpServers": { + "mcpServers": { "TiDB": { - "type": "stdio", - "command": "uvx", - "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], - "env": { + "type": "stdio", + "command": "uvx", + "args": ["--from", "pytidb[mcp]", "tidb-mcp-server"], + "env": { "TIDB_HOST": "", "TIDB_PORT": "", "TIDB_USERNAME": "", "TIDB_PASSWORD": "", "TIDB_DATABASE": "" + } } - } - } + } } ``` ### Windsurf -Follow [Windsurf's documentation](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin) to add the configuration to `mcp_config.json`, as follows: +To add the TiDB MCP plugin to Windsurf, update your `mcp_config.json` file as follows. For more information, see the [Windsurf documentation](https://docs.windsurf.com/windsurf/cascade/mcp#adding-a-new-mcp-plugin). ```json { @@ -132,4 +159,5 @@ Follow [Windsurf's documentation](https://docs.windsurf.com/windsurf/cascade/mcp ## See also -- [Try Out TiDB + Vector](/vector-search/vector-search-get-started-using-python.md) +- [Try Out TiDB + Vector Search](/vector-search/vector-search-get-started-using-python.md) +- [Developer Guide Overview](/develop/dev-guide-overview.md) From a9b8f8a31a58b3f39362cd4be0948db3930280d1 Mon Sep 17 00:00:00 2001 From: Aolin Date: Thu, 25 Dec 2025 16:39:39 +0800 Subject: [PATCH 8/9] revise wording Co-authored-by: xixirangrang --- tidb-cloud/tidb-cloud-use-with-ai-tools.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/tidb-cloud-use-with-ai-tools.md index eb3cf7bb06671..4ace2be44d854 100644 --- a/tidb-cloud/tidb-cloud-use-with-ai-tools.md +++ b/tidb-cloud/tidb-cloud-use-with-ai-tools.md @@ -7,7 +7,7 @@ summary: Learn how to connect your {{{ .starter }}} cluster to AI-powered develo This document describes how to connect your {{{ .starter }}} cluster to AI-powered development tools that support the Model Context Protocol (MCP), such as Cursor, Claude Code, Visual Studio Code (VS Code), and Windsurf. -By configuring your TiDB cluster as an MCP server, you can enable AI assistants in your development tools to query your database schema, understand your data model, and generate context-aware code suggestions. +By configuring your {{{ .starter }}} cluster as an MCP server, you can enable AI assistants in your development tools to query your database schema, understand your data model, and generate context-aware code suggestions. ## Before you begin @@ -27,7 +27,7 @@ To complete this guide, you need the following: After you create a {{{ .starter }}} cluster in TiDB Cloud, perform the following steps to connect it to your AI tool. -1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click the name of your target cluster to go to its overview page. Then, click **Use with AI Tools** at the top of the page. +1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click the name of your target cluster to go to its overview page. 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 you want the AI tool to access. 3. Verify that you meet all the **Prerequisites** listed. If not, follow the on-screen instructions to install the required dependencies. 4. Configure the password: @@ -52,7 +52,7 @@ After you create a {{{ .starter }}} cluster in TiDB Cloud, perform the following To configure Cursor as an MCP client for TiDB, you can use one of the following methods: -- **Method 1**: in the TiDB Cloud console, click **Add to Cursor** to launch Cursor, and then click **Install**. +- **Method 1**: in the **Access `your_cluster_name` with AI tools** dialog of the [TiDB Cloud console](https://tidbcloud.com), click **Add to Cursor** to launch Cursor, and then click **Install**. - **Method 2**: manually add the following configuration to your `.cursor/mcp.json` file: ```json @@ -76,7 +76,7 @@ To configure Cursor as an MCP client for TiDB, you can use one of the following To configure Claude Code as an MCP client for TiDB, you can use one of the following methods: -- **Method 1**: copy the setup command from the TiDB Cloud console and run it in your terminal: +- **Method 1**: copy the setup command from the **Access `your_cluster_name` with AI tools** dialog of the [TiDB Cloud console](https://tidbcloud.com/), and then run it in your terminal: ```bash claude mcp add --transport stdio TiDB \ @@ -113,7 +113,7 @@ To configure Claude Code as an MCP client for TiDB, you can use one of the follo To configure VS Code as an MCP client for TiDB, you can use one of the following methods: -- **Method 1**: click **Add to VS Code** to launch VS Code, and then click **Install**. +- **Method 1**: in the **Access `your_cluster_name` with AI tools** dialog of the [TiDB Cloud console](https://tidbcloud.com/), click **Add to VS Code** to launch VS Code, and then click **Install**. - **Method 2**: add the following configuration to your `.vscode/mcp.json` file: ```json From 73ad37f1fbd0897c5b8a386021d01df92c4463a0 Mon Sep 17 00:00:00 2001 From: Aolin Date: Thu, 25 Dec 2025 16:44:00 +0800 Subject: [PATCH 9/9] rename to "use-tidb-cloud-with-ai-tools" --- TOC-tidb-cloud-starter.md | 2 +- ...oud-use-with-ai-tools.md => use-tidb-cloud-with-ai-tools.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tidb-cloud/{tidb-cloud-use-with-ai-tools.md => use-tidb-cloud-with-ai-tools.md} (100%) diff --git a/TOC-tidb-cloud-starter.md b/TOC-tidb-cloud-starter.md index 21cf79895f67e..cc613f1570f79 100644 --- a/TOC-tidb-cloud-starter.md +++ b/TOC-tidb-cloud-starter.md @@ -11,7 +11,7 @@ - [MySQL Compatibility](/mysql-compatibility.md) - Get Started - [Try Out TiDB Cloud](/tidb-cloud/tidb-cloud-quickstart.md) - - [Try Out TiDB + AI Tools](/tidb-cloud/tidb-cloud-use-with-ai-tools.md) + - [Try Out TiDB + AI Tools](/tidb-cloud/use-tidb-cloud-with-ai-tools.md) - [Try Out TiDB + Vector Search](/vector-search/vector-search-get-started-using-python.md) - [Try Out HTAP](/tidb-cloud/tidb-cloud-htap-quickstart.md) - [Try Out TiDB Cloud CLI](/tidb-cloud/get-started-with-cli.md) diff --git a/tidb-cloud/tidb-cloud-use-with-ai-tools.md b/tidb-cloud/use-tidb-cloud-with-ai-tools.md similarity index 100% rename from tidb-cloud/tidb-cloud-use-with-ai-tools.md rename to tidb-cloud/use-tidb-cloud-with-ai-tools.md