Ray0907/mysql-analyzer-mcp
If you are the rightful owner of mysql-analyzer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MySQL Analyzer MCP Server is a standalone server designed to provide static analysis tools for MySQL databases, focusing on schema integrity, naming conventions, and performance metrics.
MySQL Analyzer MCP Server
A standalone Model Context Protocol (MCP) server providing a suite of tools for static analysis of MySQL databases, focusing on schema integrity, naming conventions, and performance metrics.
š·ļø Naming Conventions
This MCP server enforces modern, consistent naming conventions:
- Tables:
CamelCase
(e.g.,Users
,ProductCategories
) - Columns:
snake_case
(e.g.,user_id
,created_at
) - Indexes & Constraints:
snake_case
with prefixes (e.g.,uk_users_email
,idx_orders_status
)
š Quick Start
1. Setup Environment
Create a .env
file from the example:
cp .env.example .env
Then, edit the .env
file with your database credentials.
2. Build and Install
Run the build script to set up the virtual environment and install dependencies:
./build.sh
3. Run the MCP Server
Activate the virtual environment and run the server:
source .venv/bin/activate
python src/mysql_analyzer_mcp/server.py
4. Test with MCP Inspector
You can test the server using the MCP inspector:
npx @modelcontextprotocol/inspector python src/mysql_analyzer_mcp/server.py
š ļø MCP Tools
This server provides a suite of tools to analyze and improve your MySQL database.
Available Tools
analyze_naming_conventions
: Analyzes table and column names and can generate SQL patches to fix them.analyze_database_indexes
: Checks for redundant or missing indexes.analyze_database_performance
: Identifies potential performance bottlenecks.analyze_database_schema
: Validates schema best practices (e.g., charset, collation).comprehensive_analysis
: Runs all analyses and provides a summary report.generate_sql_patches
: Generates SQL patches for specific issues.
Example Usage in Claude
- "Analyze my MySQL database naming conventions and generate fixes."
- "Run a comprehensive analysis of my database."
- "Check my database indexes for redundancy."
šļø Project Structure
mysql-analyzer-mcp/
āāā src/
ā āāā mysql_analyzer_mcp/
ā āāā __init__.py
ā āāā server.py # Main MCP server logic using the official MCP SDK
āāā analyzers/
ā āāā __init__.py
ā āāā naming_analyzer.py
ā āāā index_analyzer.py
ā āāā schema_analyzer.py
ā āāā performance_analyzer.py
ā āāā utils.py # Shared database utility functions
āāā build.sh # Build and setup script
āāā config.py # Centralized configuration management
āāā db_connector.py # Database connection handling
āāā patch_generator.py # SQL patch generation logic
āāā pyproject.toml # Package configuration
āāā requirements.txt # Dependencies
āāā .env.example # Environment template
š§ Configuration
All tool arguments and environment variables are documented within the server's tool definitions and can be inspected via MCP.
Built with ā¤ļø following Model Context Protocol standards.