MySQL

v2.0.8Databasesstable

🔧 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

aimcp-servermodel-context-protocolmysqloauth2
Share:
243
Stars
0
Downloads
0
Weekly
0/5

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

Execute MySQL queries with AI
List databases and table structures
Manage relational data
wenb1n-dev

Maintainer

LicenseMIT License
Languagepython
Versionv2.0.8
UpdatedMay 19, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @benborla29/mcp-server-mysql

Manual Installation

npx -y @benborla29/mcp-server-mysql

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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_pro
2

Set 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=readonly
3

Add 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"
      }
    }
  }
}
4

Restart Claude Desktop

Fully quit and relaunch Claude Desktop to start the MySQL MCP server process with the configured credentials.

5

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.

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.

Quick Config Preview

{ "mcpServers": { "mysql": { "command": "npx", "args": ["-y", "@benborla29/mcp-server-mysql"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides