MySQL MCP Server
by kaulvimal
This project provides a read-only Model Context Protocol (MCP) server for interacting with MySQL databases. It allows MCP compatible clients to inspect database schemas, retrieve metadata, and execute read-only SQL queries.
Last updated: N/A
What is MySQL MCP Server?
A read-only Model Context Protocol (MCP) server for interacting with MySQL databases. It exposes tools via MCP for database interaction, focusing on schema inspection, metadata retrieval, and read-only query execution.
How to use MySQL MCP Server?
- Clone the repository. 2. Install dependencies using
npm install
. 3. Build the project usingnpm run build
. 4. Create a shell script to run the server, setting necessary environment variables for database connection. 5. Make the script executable. 6. Configure your MCP client (e.g., Cursor) to use the script as the server command.
Key features of MySQL MCP Server
Schema & Metadata Tools (get_table_columns, get_schema, get_indexes, get_constraints, compare_schemas, explain_schema, detect_schema_changes, find_relationships, find_navigation_paths)
Query Execution Tools (execute_query, execute_batch, prepare_statement, explain_query)
Visualization Tools (visualize_schema)
Performance Tools (get_performance_metrics)
Read-only operations enforced for safety
Extensible design
Use cases of MySQL MCP Server
Inspecting MySQL database schemas
Retrieving database metadata
Executing read-only SQL queries
Generating schema visualizations for documentation
Monitoring database performance metrics
FAQ from MySQL MCP Server
What databases are supported?
What databases are supported?
Currently, only MySQL databases are supported.
Are write operations supported?
Are write operations supported?
No, this server is designed for read-only operations to ensure data safety.
How do I configure the database connection?
How do I configure the database connection?
You can configure the database connection using environment variables (DB_HOST, DB_USER, DB_PASSWORD, DB_PORT) or by setting them directly in the execution script.
Is there query history?
Is there query history?
Server-side query history is not currently implemented.
What is the purpose of the find_relationships
tool?
What is the purpose of the find_relationships
tool?
It discovers explicit foreign key relationships and can optionally attempt to find implicit relationships based on naming conventions.