MCP HubMCP Hub
c4pt0r

mcp-server-tidb

by: c4pt0r

mcp server for tidb

17created 06/03/2025
Visit
TiDB
database

📌Overview

Purpose: To provide a serverless implementation of the MCP server compatible with the TiDB database.

Overview: The mcp-server-tidb is a flexible and lightweight server designed to run with TiDB, allowing users to leverage a serverless architecture for their database needs without complex setup requirements. It supports configuration through environment variables or a .env file for easy integration.

Key Features:

  • Easy Installation: Simplifies setup with straightforward commands to clone the repository and install dependencies via the uv package installer.

  • Environment Configuration: Supports dynamic configuration through environment variables, allowing users to set the database connection details easily.


mcp-server-tidb

MCP server implementation for TiDB (serverless) database.

Prerequisites

  • uv (Python package installer)

Installation

# Clone the repository
git clone https://github.com/c4pt0r/mcp-server-tidb
cd mcp-server-tidb

# Install the package and dependencies using uv
uv venv
uv pip install -e .

Configuration

Go to tidbcloud.com to create a free TiDB database cluster.

Configuration can be provided through environment variables or a .env file:

  • TIDB_HOST - TiDB host address, e.g. 'gateway01.us-east-1.prod.aws.tidbcloud.com'
  • TIDB_PORT - TiDB port (default: 4000)
  • TIDB_USERNAME - Database username, e.g. 'xxxxxxxxxx.'
  • TIDB_PASSWORD - Database password
  • TIDB_DATABASE - Database name, default is test

Run with Claude Desktop

Configure Claude Desktop as follows:

claude_desktop_config.json:

{
  "mcpServers": {
    "tidb": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-tidb",
        "run",
        "src/main.py"
      ]
    }
  }
}

If running mcp-server-tidb in WSL, use this configuration:

{
  "mcpServers": {
    "tool-with-env-vars": {
      "command": "wsl.exe",
      "args": [
        "bash",
        "-c",
        "/path/to/uv --directory /path/to/mcp-server-tidb run python src/main.py"
      ]
    }
  }
}