TiDB

TiDB MCP Server
  • javascript

0

GitHub Stars

javascript

Language

4 months ago

First Indexed

3 weeks ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "l1806858547-tidb-server": {
      "command": "npx",
      "args": [
        "-y",
        "tidb-mcp-server"
      ],
      "env": {
        "TIDB_DB": "your_database",
        "TIDB_HOST": "your_tidb_host",
        "TIDB_PASS": "your_password",
        "TIDB_PORT": "your_tidb_port",
        "TIDB_USER": "your_username",
        "ALLOW_DELETE_OPERATION": "false",
        "ALLOW_INSERT_OPERATION": "false",
        "ALLOW_UPDATE_OPERATION": "false"
      }
    }
  }
}

You can run a TiDB MCP Server that lets you execute SELECT queries against TiDB through MCP tools. This server is designed to be lightweight, easy to configure, and safe when you control access, so you can focus on querying data without managing complex integration steps.

How to use

Start by launching the TiDB MCP Server locally through your MCP client workflow. The server you run is a local, stdio-based MCP endpoint that accepts commands from your MCP toolchain.

Set up the required environment variables for your TiDB connection, including host, port, user, password, and the default database. You can enable or disable data-modifying operations (INSERT, UPDATE, DELETE) depending on your security needs. Then, use the MCP tool to run a TiDB query. The example below shows how to execute a SELECT statement through the MCP tool and receive results back in your client.

Example usage flow (in your MCP-enabled environment): 1) Start the MCP server via the standard stainless command sequence provided in the installation steps. 2) In your MCP client, call the tidb_query tool with a SQL statement such as SELECT * FROM your_table LIMIT 10 to retrieve data.

How to install

Prerequisites: you need Node.js version 16 or newer and access to a TiDB instance.

Install via Smithery to integrate with Claude Desktop automatically:

npx -y @smithery/cli install @l1806858547/tidb-server --client claude

Alternatively, install and run directly with npx:

npx tidb-mcp-server

Or perform a global installation and run the server from anywhere on your system:

npm install -g tidb-mcp-server
tidb-mcp-server

Configuration and security notes

Before running, set the TiDB connection details as environment variables. These variables are required to connect to your TiDB instance and to control which database you operate on.

Environment variables to set (example values shown):

export TIDB_HOST="your_tidb_host"
export TIDB_PORT="your_tidb_port"
export TIDB_USER="your_username"
export TIDB_PASS="your_password"
export TIDB_DB="your_database"

# Optional operation permissions (default: false)
export ALLOW_INSERT_OPERATION="false"  # Set to "true" to allow INSERT operations
export ALLOW_UPDATE_OPERATION="false"  # Set to "true" to allow UPDATE operations
export ALLOW_DELETE_OPERATION="false"  # Set to "true" to allow DELETE operations

Warning: Enabling data-modifying operations (INSERT, UPDATE, DELETE) can create modification risks. Enable only what you need and ensure proper access controls are in place.

Available tools

tidb_query

Executes SELECT queries against TiDB through the MCP, returning result sets for MCP clients.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational