MCP MySQL
Enables interaction with MySQL databases (including AWS RDS and cloud instances) through natural language, supporting query execution, schema inspection, index management, and comprehensive database operations with secure SSL connections.
What is MCP MySQL?
MCP MySQL is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables interaction with mysql databases (including aws rds and cloud instances) through natural language, supporting query execution, schema inspection, index management, and comprehensive database o...
Enables interaction with MySQL databases (including AWS RDS and cloud instances) through natural language, supporting query execution, schema inspection, index management, and comprehensive database operations with secure SSL connections.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Enables interaction with MySQL databases (including AWS RDS
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-mysql-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP MySQL
MCP MySQL Server provides a natural language interface to MySQL databases, including AWS RDS and other cloud-hosted instances, through the Model Context Protocol. It exposes tools for executing SQL queries, inspecting table schemas, and checking connection status, while enforcing safety guardrails that block destructive DDL operations. Developers and analysts can query and explore databases conversationally without writing raw SQL, making it ideal for rapid data exploration and reporting workflows.
Prerequisites
- Node.js 16+ and npm installed
- A running MySQL database (local, AWS RDS, or other cloud instance)
- Database credentials: host, port, username, password, and database name
- An MCP-compatible client such as Claude Desktop or Cursor
Clone the repository
Clone the MCP MySQL server repository and enter the project directory.
git clone https://github.com/TickHaiJun/mysql-mcp-server.git
cd mysql-mcp-serverInstall Node.js dependencies
Install all required npm packages for the server.
npm installPrepare your database connection details
Gather the five required connection parameters: DB_HOST, DB_PORT (default 3306), DB_USER, DB_PASSWORD, and DB_NAME. For AWS RDS, use the endpoint hostname as DB_HOST.
Configure your MCP client
Add the MySQL server to your MCP client configuration, supplying database credentials as environment variables.
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mysql-mcp-server/src/index.js"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "yourpassword",
"DB_NAME": "yourdatabase"
}
}
}
}Test the connection
Ask your AI assistant to check the connection status. The get_connection_status tool will confirm the server can reach your database.
MCP MySQL Examples
Client configuration
Claude Desktop configuration for the MCP MySQL server. Replace credentials and path with your actual values.
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/mysql-mcp-server/src/index.js"],
"env": {
"DB_HOST": "mydb.cluster-xyz.us-east-1.rds.amazonaws.com",
"DB_PORT": "3306",
"DB_USER": "admin",
"DB_PASSWORD": "yourpassword",
"DB_NAME": "production"
}
}
}
}Prompts to try
Example natural language queries you can run after the server is connected.
- "Show me all tables in the database and describe their structure."
- "How many orders were placed in the last 30 days? Group them by status."
- "Find all users who signed up in 2024 but have never made a purchase."
- "Is the database connection currently healthy?"Troubleshooting MCP MySQL
Connection refused or ECONNREFUSED error
Verify DB_HOST and DB_PORT are correct. For AWS RDS, ensure your security group allows inbound traffic on port 3306 from your IP. For local MySQL, confirm the service is running with 'mysqladmin ping -h localhost'.
Query blocked — 'operation not permitted' for DROP or ALTER
The server deliberately blocks DROP, TRUNCATE, ALTER, and other destructive DDL statements as a safety measure. Use a direct MySQL client for schema migrations.
Authentication failed for user
Double-check DB_USER and DB_PASSWORD in your config. Ensure the MySQL user has SELECT (and optionally INSERT/UPDATE/DELETE) privileges on DB_NAME. Run 'SHOW GRANTS FOR your_user@\'%\';' in MySQL to verify.
Frequently Asked Questions about MCP MySQL
What is MCP MySQL?
MCP MySQL is a Model Context Protocol (MCP) server that enables interaction with mysql databases (including aws rds and cloud instances) through natural language, supporting query execution, schema inspection, index management, and comprehensive database operations with secure ssl connections. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP MySQL?
Follow the installation instructions on the MCP MySQL GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP MySQL?
MCP MySQL works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP MySQL free to use?
Yes, MCP MySQL is open source and available under the Apache 2.0 license. You can use it freely in both personal and commercial projects.
MCP MySQL Alternatives — Similar Databases Servers
Looking for alternatives to MCP MySQL? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP MySQL in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP MySQL?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.