mcp-registry/mysql_mcp_server_pro

    ==================
      
       /// MCP ///
      /// MYS ///
        
    ==================
        
    [server:online]
    [protocol:ready]

mysql_mcp_server_pro

by wenb1n-dev

Python-based Model Context Protocol (MCP) server for secure, role-based interaction with MySQL. Adds SQL execution, health / lock / index analysis tooling and is easily extensible.

235
26
Open Source

01

execute_sql

SQL execution tool that can execute ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE", "CREATE", "ALTER", "DROP", "TRUNCATE"] commands based on permission configuration

02

get_chinese_initials

Convert Chinese field names to pinyin initials

03

get_db_health_running

Analyze MySQL health status (connection status, transaction status, running status, lock status detection)

04

get_table_desc

Search for table structures in the database based on table names, supporting multi-table queries

05

get_table_index

Search for table indexes in the database based on table names, supporting multi-table queries

06

get_table_lock

Check if there are row-level locks or table-level locks in the current MySQL server

07

get_table_name

Search for table names in the database based on table comments and descriptions

08

get_db_health_index_usage

Get the index usage of the currently connected mysql database, including redundant index situations, poorly performing index situations, and the top 5 unused index situations with query times greater than 30 seconds

09

use_prompt_queryTableData

Use built-in prompts to let the model construct a chain call of tools in mcp (not a commonly used fixed tool, you need to modify the code to enable it, see this class for details)

Installation

1. Clone the repository
git clone https://github.com/wenb1n-dev/mysql_mcp_server_pro.git cd mysql_mcp_server_pro
2. Create virtual env (recommended)
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate
3. Install server and dependencies
pip install -U pip pip install -r requirements.txt
4. Configure connection & security
• Copy config.example.yaml → config.yaml
• Fill in the following keys:
• (Optional) enable anomaly module by setting anomaly.enabled: true
mysql: host: <MYSQL_HOST> port: 3306 user: <MYSQL_USER> password: <MYSQL_PASSWORD> database: <DB_NAME> auth: oauth2_client_id: <CLIENT_ID> oauth2_client_secret: <CLIENT_SECRET> allowed_origins: ["*"]
5. Run migrations (if provided)
python manage.py migrate # or alembic upgrade head depending on framework
6. Launch the MCP server
python -m mcp_server # or uvicorn mcp_server.app:app --reload
7. Verify
GET http://localhost:8080/health returns {"status":"ok"}

Documentation

License: MIT License
Updated 7/30/2025

Table of Contents