MySQL
🔧 MySQL MCP Server for Model Context Protocol Features: • Execute any MySQL query • List all databases • List tables in database • Describe table structure • Environment-based configuration • Built with TypeScript & MCP SDK Ready to use with Claude D
What is MySQL?
MySQL is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 🔧 mysql mcp server for model context protocol features: • execute any mysql query • list all databases • list tables in database • describe table structure • environment-based configuration • built w...
🔧 MySQL MCP Server for Model Context Protocol Features: • Execute any MySQL query • List all databases • List tables in database • Describe table structure • Environment-based configuration • Built with TypeScript & MCP SDK Ready to use with Claude D
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- mysql_query
- mysql_execute
- list_tables
- describe_table
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @benborla29/mcp-server-mysqlManual Installation
npx -y @benborla29/mcp-server-mysqlConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MySQL
The MySQL MCP Server (mysql_mcp_server_pro) gives AI assistants direct read and write access to MySQL databases through a rich set of tools covering query execution, schema inspection, index analysis, query optimization, and database health monitoring. It supports three permission levels — readonly, writer, and admin — so you can safely expose databases to AI without granting excessive privileges. Database administrators and backend developers use it to let AI assistants answer schema questions, debug slow queries, and assist with data migrations using natural language.
Prerequisites
- Python 3.8 or later installed
- pip available on your PATH
- A running MySQL instance (local or remote) with a user account
- Network access from the machine running the MCP server to the MySQL host
- An MCP-compatible client such as Claude Desktop
Install the mysql_mcp_server_pro package
Install the server from PyPI using pip. This pulls in the MCP SDK and the MySQL connector.
pip install mysql_mcp_server_proSet database connection environment variables
Configure the server by setting environment variables for your MySQL connection. MYSQL_ROLE controls what SQL operations are permitted.
export MYSQL_HOST=localhost
export MYSQL_PORT=3306
export MYSQL_USER=myuser
export MYSQL_PASSWORD=mypassword
export MYSQL_DATABASE=mydb
export MYSQL_ROLE=readonlyAdd the server to your Claude Desktop config
Edit claude_desktop_config.json to launch the server via npx with environment variables embedded in the env block.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@benborla29/mcp-server-mysql"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "myuser",
"MYSQL_PASSWORD": "mypassword",
"MYSQL_DATABASE": "mydb",
"MYSQL_ROLE": "readonly"
}
}
}
}Restart Claude Desktop
Fully quit and relaunch Claude Desktop to start the MySQL MCP server process with the configured credentials.
Verify with a schema query
Ask the AI assistant to list all tables in your database or describe a specific table structure to confirm the connection is working.
MySQL Examples
Client configuration
Claude Desktop configuration for MySQL MCP server with readonly access to a local MySQL instance.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@benborla29/mcp-server-mysql"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "myuser",
"MYSQL_PASSWORD": "mypassword",
"MYSQL_DATABASE": "mydb",
"MYSQL_ROLE": "readonly"
}
}
}
}Prompts to try
Example prompts that use the MySQL MCP tools for querying, schema inspection, and optimization.
- "List all tables in the database and describe their columns"
- "Show me the 10 most recent orders from the orders table"
- "Are there any unused indexes on the products table?"
- "Analyze the performance of this query: SELECT * FROM orders WHERE customer_id = 42"
- "Check the current database health — any active locks or long-running transactions?"Troubleshooting MySQL
Connection refused or 'Can't connect to MySQL server'
Verify MYSQL_HOST and MYSQL_PORT are correct and that the MySQL instance is running. If MySQL is on a remote host, confirm the user account allows connections from the MCP server's IP address using 'GRANT ... TO user@'%'' in MySQL.
Permission denied errors when running INSERT or UPDATE
The server defaults to MYSQL_ROLE=readonly which only permits SELECT, SHOW, DESCRIBE, and EXPLAIN. Change MYSQL_ROLE to 'writer' for INSERT/UPDATE/DELETE or 'admin' for DDL operations like CREATE and DROP.
npx installs a different mysql package instead of @benborla29/mcp-server-mysql
Make sure you include the full scoped package name @benborla29/mcp-server-mysql in your args. Alternatively, install the Python package directly with 'pip install mysql_mcp_server_pro' and run it with 'python -m mysql_mcp_server_pro'.
Frequently Asked Questions about MySQL
What is MySQL?
MySQL is a Model Context Protocol (MCP) server that 🔧 mysql mcp server for model context protocol features: • execute any mysql query • list all databases • list tables in database • describe table structure • environment-based configuration • built with typescript & mcp sdk ready to use with claude d It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MySQL?
Install via npm with the command: npx -y @benborla29/mcp-server-mysql. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with MySQL?
MySQL works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MySQL free to use?
Yes, MySQL is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MySQL Alternatives — Similar Databases Servers
Looking for alternatives to 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 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 MySQL?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.