MCP Server for MySQL Operations and Monitoring

What is MCP-MySQL-Ops?
MCP-MySQL-Ops lets Claude Desktop, OpenWebUI, and other MCP clients inspect a
MySQL server through natural-language requests. Its tools read server status,
connections, schemas, table sizes, indexes, locks, and Performance Schema data.
Example requests:
Show the MySQL server version and uptime.
List active connections.
Find the largest tables in all databases.
Show recent slow-query patterns.
Check lock waits and index usage.
More requests to try: see
Example queries by area for
exploratory analysis, performance monitoring, capacity planning, and
administration and maintenance.
Quick Start
You need a MySQL account and a server reachable from the computer that runs
MCP-MySQL-Ops. Choose one path. Claude Desktop uses a local stdio bundle;
Docker Compose runs the MCP server, OpenWebUI, optional MCPO compatibility
proxy, and a test MySQL database.
All registered MySQL tools are read-only in both paths.
Option A: Claude Desktop with MCPB (fastest)
- Download
mcp-mysql-ops-<version>.mcpb from the latest
GitHub Release.
- Open Settings → Extensions → Advanced settings → Install Extension… and
select the file.
- Enter the MySQL connection settings. Host and password are required; port,
user, and default database are prefilled and can be changed.
- Ask:
Show the MySQL server version and uptime.
The MySQL server must be reachable from the computer running Claude Desktop.
See the Claude Desktop guide for uvx, source,
and troubleshooting options.
Option B: OpenWebUI with Docker Compose
Requirements: Git, Docker with the Compose plugin, and a model provider for
OpenWebUI whose model supports tool calling.
1. Configure
git clone https://github.com/call518/MCP-MySQL-Ops.git
cd MCP-MySQL-Ops
cp .env.example .env
cp mcp-config.json.http mcp-config.json.http.local
chmod 600 mcp-config.json.http.local
openssl rand -hex 32 # use the output as WEBUI_SECRET_KEY
vi .env # set WEBUI_SECRET_KEY and review the MYSQL_* values
The default stack uses the included MySQL tutorial database. To use an existing
server, set its MYSQL_* values and follow the
custom database instructions.
2. Start
docker compose up -d
docker compose ps # wait until mcp-server is healthy
This starts OpenWebUI (http://localhost:3004), the MCP server
(http://localhost:18004/mcp), MCPO (http://localhost:8004), and the tutorial
MySQL database (127.0.0.1:13306). Published ports bind to 127.0.0.1 by
default.
3. Connect a model provider
These steps apply to both the direct MCP connection and MCPO.
Open http://localhost:3004 and create the administrator account.
Under Settings → Admin → Connections, add an OpenAI connection with URL
https://api.openai.com/v1, Auth Bearer with your OpenAI API key, and
API Type set to Chat Completions, then save it. For another provider,
see the OpenWebUI guide.
The Quick Start calls tools through Chat Completions with model reasoning
turned off, using this default already present in .env.example:
DEFAULT_MODEL_PARAMS={"reasoning_effort":"none"}
This value applies to every model and requires API Type: Chat
Completions. With Responses, OpenWebUI 0.13 still sends
reasoning_effort, and every request fails with
Unsupported parameter: 'reasoning_effort'. If the open-webui-data volume
already exists, set the same value under Settings → Admin → Models → Model
Defaults → Model Parameters because its saved database value takes
precedence. To keep model reasoning through Responses instead, see the
OpenWebUI guide.
4. Connect the MCP server
- Under Settings → Admin → Tools → Integrations → External Tool Servers,
add a connection of type
MCP (Streamable HTTP) with URL
http://mcp-server:8000/mcp and authentication None.
- Under Settings → Admin → System → Interface → Chat, turn on Tool
Search and Defer Built-in Tools, and set Deferral Threshold to
0
so that the complete tool list fits the model's limits.
- In a new chat, enable the connection under Integrations → Tools and ask:
Use mcp-mysql-ops to show the MySQL server version and uptime.
MCPO is optional. MCPO exposes the MCP tools as an OpenAPI REST server;
OpenWebUI does not need it for the direct MCP connection above. To run without
MCPO, start only:
docker compose up -d mysql mysql-init-data mcp-server open-webui
The OpenWebUI guide explains direct MCP versus MCPO,
Bearer authentication, model settings, existing MySQL servers, and
troubleshooting.
Other installation and operation guides
| Guide |
Contents |
| Usage |
Example queries by area |
| Configuration |
MySQL connection, transports, authentication, and local files |
| Claude Desktop |
MCPB, uvx, source, Docker bridge, and remote connector |
| OpenWebUI |
Direct MCP, MCPO, reasoning models, and troubleshooting |
| Development |
Tests, MCPB builds, and release verification |
Architecture & Internal (DeepWiki)
Overview
You are working with the MCP MySQL Operations Server, a powerful tool that provides comprehensive MySQL database monitoring and analysis capabilities through natural language queries. This server offers 19 specialized tools for database administration, performance monitoring, and system analysis. Leverages MySQL's Performance Schema and Information Schema for deep insights into database operations and performance metrics.
Features
- ✅ Zero Configuration: Works with MySQL 5.7.9+ and 8.0+ out-of-the-box with automatic version detection.
- ✅ Natural Language: Ask questions like "Show me slow queries" or "Analyze table sizes."
- ✅ Production Safe: Read-only operations, AWS RDS/Aurora MySQL compatible with regular user permissions.
- ✅ Performance Schema Integration: Advanced query analytics using MySQL's built-in Performance Schema.
- ✅ Comprehensive Database Monitoring: Storage engine analysis, connection monitoring, and performance insights.
- ✅ Smart Query Analysis: Query performance identification using Performance Schema statistics.
- ✅ Schema & Structure Discovery: Database structure exploration with detailed table and index analysis.
- ✅ Storage Engine Intelligence: InnoDB monitoring, table optimization recommendations.
- ✅ Multi-Database Operations: Seamless cross-database analysis and monitoring.
- ✅ Enterprise-Ready: Safe read-only operations with AWS RDS/Aurora MySQL compatibility.
- ✅ Developer-Friendly: Simple codebase for easy customization and tool extension.
🔧 Advanced Capabilities
- Performance Schema-based query monitoring and analysis.
- Real-time connection and process monitoring.
- Storage engine status and optimization analysis.
- Database capacity and table size analysis.
- Index usage and efficiency tracking.
Tool Usage Examples


Docker Compose Tutorial
Note: The mysql container included in docker-compose.yml is intended for quickstart testing purposes only. You can connect to your own MySQL instance by adjusting the environment variables as needed.
If you want to use your own MySQL instance instead of the built-in test container:
- Update the target MySQL connection information in your
.env file (see MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE).
- Use
docker-compose.custom-db.yml, which omits the mysql and
mysql-init-data services.
Flow Diagram of Quickstart/Tutorial

1. Environment Setup
Note: The system automatically handles user permissions - both root users and regular users are supported with appropriate access control.
git clone https://github.com/call518/MCP-MySQL-Ops.git
cd MCP-MySQL-Ops
# Copy and check environment configuration
cp .env.example .env
Default configuration (works out-of-the-box):
#### MySQL Root Configuration for Docker:
MYSQL_ROOT_HOST=%
MYSQL_ROOT_PASSWORD=changeme
#### MySQL Host Configuration:
MYSQL_HOST=host.docker.internal
MYSQL_PORT=13306
MYSQL_USER=root
MYSQL_PASSWORD=${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE=test_ecommerce
For your own MySQL server:
# Edit .env file with your MySQL connection details
MYSQL_HOST=your-mysql-server.com
MYSQL_PORT=3306
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_default_db
# Start the stack without the built-in MySQL services
docker compose -f docker-compose.custom-db.yml up -d
Note: The MySQL container is configured with proper volume mapping for data persistence and initial database setup.
Additional Resources:
2. Run Docker Stack
# Start all services (MySQL + MCP server + test interfaces)
docker compose up -d
# Check container status
docker compose ps
# Watch the logs (Ctrl+C to exit)
docker compose logs -f mysql-init-data
⏱️ Container Startup Sequence & Wait Time:
- MySQL Container: Starts first and initializes database (~30-60 seconds)
- MySQL Init Data: Generates test data automatically (~1-2 minutes)
- MCP Server: Starts after MySQL is ready (~10-20 seconds)
- OpenWebUI: Starts last to ensure all services are available (~10-30 seconds)
💡 Please wait 2-3 minutes for all containers to fully initialize before accessing the web interface. You can monitor the startup progress with:
# Monitor all container logs
docker compose logs -f
# Check if all containers are healthy
docker compose ps
3. Automatic Test Data Generation
🎉 No manual setup required! Test data is automatically generated during first startup by the mysql-init-data container.
What happens automatically:
- ✅ 4 comprehensive test databases created (
test_ecommerce, test_analytics, test_inventory, test_hr)
- ✅ ~2,745 realistic records with proper foreign key relationships
- ✅ User permissions automatically configured for your
MYSQL_USER (from .env)
- ✅ Test users and roles created for different access scenarios
Manual execution (if needed):
# Force regenerate test data (optional)
docker compose run --rm mysql-init-data /scripts/create-test-data.sh
# Check generation logs
docker logs mcp-mysql-ops-mysql-init-data
Verification:
# Connect and verify test databases exist
docker exec -it mcp-mysql-ops-mysql-8 mysql -u [your_mysql_user] -p -e "SHOW DATABASES;"
4. Access to OpenWebUI
🌐 Web Interface: http://localhost:3004/