From 3a410ca46669abe970c492b54abca03351d023dd Mon Sep 17 00:00:00 2001 From: Cheese Date: Wed, 24 Dec 2025 15:55:32 +0800 Subject: [PATCH 1/6] 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/6] 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/6] 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/6] 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/6] 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/6] 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