-
Notifications
You must be signed in to change notification settings - Fork 709
cloud: add use TiDB Cloud Starter with AI Tools #22228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ti-chi-bot
merged 9 commits into
pingcap:release-8.5
from
Icemap:cheese/cloud-use-with-ai-tools
Dec 25, 2025
+165
−1
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3a410ca
feat: description of use with ai tools
Icemap f4b88b6
Apply suggestions from code review
Icemap a0aa3f3
Apply suggestions from code review
Icemap 1a90add
Update tidb-cloud/tidb-cloud-use-with-ai-tools.md
Icemap f21e62f
Apply suggestions from code review
Icemap 7428c15
feat: add command of claude code
Icemap f198a96
Apply suggestions from code review
Icemap a9b8f8a
revise wording
Oreoxmt 73ad37f
rename to "use-tidb-cloud-with-ai-tools"
Oreoxmt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,163 @@ | ||
| --- | ||
| 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 | ||
|
|
||
| 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 {{{ .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 | ||
|
|
||
| To complete this guide, you need the following: | ||
|
|
||
| - 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: | ||
|
|
||
| - [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** 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: | ||
|
|
||
| - 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 | ||
|
|
||
| To configure Cursor as an MCP client for TiDB, you can use one of the following methods: | ||
|
|
||
| - **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 | ||
| { | ||
| "mcpServers": { | ||
| "TiDB": { | ||
| "command": "uvx --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>" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Claude Code | ||
|
|
||
| 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 **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 \ | ||
| --env TIDB_HOST='<YOUR_TIDB_HOST>' \ | ||
| --env TIDB_PORT=<YOUR_TIDB_PORT> \ | ||
| --env TIDB_USERNAME='<YOUR_TIDB_USERNAME>' \ | ||
| --env TIDB_PASSWORD='<YOUR_TIDB_PASSWORD>' \ | ||
| --env TIDB_DATABASE='<YOUR_TIDB_DATABASE>' \ | ||
| -- uvx --from 'pytidb[mcp]' 'tidb-mcp-server' | ||
| ``` | ||
|
|
||
| - **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": { | ||
| "TiDB": { | ||
| "type": "stdio", | ||
| "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>" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### VS Code | ||
|
|
||
| To configure VS Code as an MCP client for TiDB, you can use one of the following methods: | ||
|
|
||
| - **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 | ||
| { | ||
| "mcpServers": { | ||
| "TiDB": { | ||
| "type": "stdio", | ||
| "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>" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Windsurf | ||
|
|
||
| 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 | ||
| { | ||
| "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 | ||
|
|
||
| - [Try Out TiDB + Vector Search](/vector-search/vector-search-get-started-using-python.md) | ||
| - [Developer Guide Overview](/develop/dev-guide-overview.md) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.