MySQL MCP
Enables management of multiple MySQL database connections with support for executing SQL queries, natural language queries, listing databases, and exploring database schemas through a central metadata system.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MySQL MCPlist all tables in the customers database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP (Management Control Plane)
A system for managing multiple MySQL databases with natural language query support, built with FastMCP framework.
Features
Manage multiple MySQL database connections
Store metadata about all managed databases in a central metadata database
Query data using natural language
Built with FastMCP framework for easy integration with AI assistants
Related MCP server: MySQL MCP Server
Installation
Install Python 3.7+
Install required packages:
pip install -r requirements.txt
Setup
Create a MySQL database for storing metadata:
mysql -u root -p < init_metadata_db.sqlUpdate
config.iniwith your metadata database connection details:[metadata_db] host = localhost port = 3306 user = your_username password = your_password database = metadata_dbAdd your database connections to the metadata database using the provided SQL schema.
Usage
Run the FastMCP server:
python mysql_mcp_server.pyOnce the server is running, you can access the SSE endpoint at:
http://localhost:8000/sseThe server exposes the following tools:
list_databases()- List all registered databasesexecute_query(database_id, query)- Execute a SQL query on a specific databasenatural_language_query(database_id, natural_query)- Execute a natural language query on a specific databaseget_database_tables(database_id)- Get list of tables in a specific database
Configuration
All configuration is stored in config.ini:
metadata_db: Connection details for the metadata databaseapp: Application settings
Architecture
mysql_mcp_server.py: FastMCP server implementationdb_manager.py: Database connection and management logicnlp_processor.py: Natural language processing to convert queries to SQLdatabase_models.py: Data classes representing database entitiesconfig.ini: Configuration fileinit_metadata_db.sql: Schema for the metadata databaserequirements.txt: Python dependencies
Extending the System
To improve natural language processing capabilities:
Enhance the
natural_language_queryfunction inmysql_mcp_server.pyAdd more patterns to recognize different query types
Consider integrating with advanced NLP libraries like spaCy or NLTK
Integration with AI Assistants
This FastMCP server can be integrated with AI assistants that support the Model Context Protocol (MCP), allowing them to:
List available databases
Execute SQL queries
Process natural language queries
Explore database schemas
This server cannot be deployed
Maintenance
Related MCP Connectors
Ask data questions in natural language. Get SQL, insights, and charts from your databases.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
Read and edit DB Planner database schemas, diagrams and board layouts as an AI agent.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.-
- AlicenseBqualityDmaintenanceEnables AI assistants to manage MySQL databases through natural language commands. Supports database operations, table management, data queries, and import/export functionality with built-in security features.1512 npm1MIT
- AlicenseAqualityCmaintenanceEnables interaction with MySQL databases (including AWS RDS and cloud instances) through natural language. Supports database connections, query execution, schema inspection, and comprehensive database management operations.816 npm8MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to securely connect to and manage MySQL databases with support for multiple database connections, complete CRUD operations, schema inspection, and dynamic connection management through natural language.4 npm81MIT