MySQL Database Integration
This server enables AI models to interact with MySQL databases through a standardized interface.
What is MySQL Database Integration?
MySQL Database Integration is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this server enables ai models to interact with mysql databases through a standardized interface.
This server enables AI models to interact with MySQL databases through a standardized interface.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- connect_db
- query
- execute
- list_tables
- describe_table
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @f4ww4z/mcp-mysql-serverManual Installation
npx -y @f4ww4z/mcp-mysql-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MySQL Database Integration
MCP MySQL Server is a Node.js MCP server that lets AI assistants connect to and interact with MySQL databases through a standardized interface. It exposes tools for establishing connections, executing SELECT queries with prepared statements, running INSERT/UPDATE/DELETE operations, listing tables, and describing table schemas — making it straightforward for Claude to answer questions about data, generate reports, or assist with database administration tasks without requiring a separate SQL client.
Prerequisites
- Node.js 16+ and npx available
- An accessible MySQL server (local or remote) with valid credentials
- Database user with appropriate SELECT, INSERT, UPDATE, DELETE permissions
- Claude Desktop or another MCP-compatible client
Add the server to your Claude Desktop config
Add the mcp-mysql entry to your MCP client config with your MySQL connection details as environment variables. The server will use these to connect when tools are invoked.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@f4ww4z/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_db_user",
"MYSQL_PASSWORD": "your_db_password",
"MYSQL_DATABASE": "your_database_name"
}
}
}
}Restart Claude Desktop
Save the configuration and fully restart Claude Desktop so it picks up the new MySQL server.
Connect to the database
Ask Claude to connect to the MySQL database. It will use the connect_db tool with the credentials from the environment variables.
Explore the schema
Have Claude list tables and describe their structure before running queries. This helps Claude understand the database schema and write accurate SQL.
Run queries and operations
Use Claude to run SELECT queries (via the query tool with prepared statement support) or data modification operations (via the execute tool for INSERT/UPDATE/DELETE).
MySQL Database Integration Examples
Client configuration
Add this to your Claude Desktop claude_desktop_config.json. All four MySQL environment variables are required for the connection to succeed.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@f4ww4z/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "appuser",
"MYSQL_PASSWORD": "s3cur3password",
"MYSQL_DATABASE": "production_db"
}
}
}
}Prompts to try
Use these prompts to explore and query your MySQL database through Claude.
- "List all tables in the database"
- "Describe the structure of the users table"
- "How many orders were placed in the last 30 days?"
- "Show me the top 10 customers by total order value"
- "Insert a new product with name 'Widget B', price 29.99, and category 'hardware' into the products table"Troubleshooting MySQL Database Integration
Connection refused or ECONNREFUSED error
Verify MYSQL_HOST is correct and the MySQL server is running. For Docker-based MySQL, use the container's network address or 127.0.0.1. If connecting to a remote host, check firewall rules allow port 3306 from your machine.
Access denied for user error
Double-check MYSQL_USER and MYSQL_PASSWORD in the env block. Ensure the MySQL user has the required privileges on the specified MYSQL_DATABASE. Run 'SHOW GRANTS FOR your_user@localhost;' in MySQL to verify permissions.
npx does not find the package or installs an old version
Run 'npx -y @f4ww4z/mcp-mysql-server' in a terminal to see the error. Clear the npx cache with 'npx clear-npx-cache' if a stale version is cached. Ensure you have internet access to reach the npm registry.
Frequently Asked Questions about MySQL Database Integration
What is MySQL Database Integration?
MySQL Database Integration is a Model Context Protocol (MCP) server that this server enables ai models to interact with mysql databases through a standardized interface. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MySQL Database Integration?
Install via npm with the command: npx -y @f4ww4z/mcp-mysql-server. 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 Database Integration?
MySQL Database Integration works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MySQL Database Integration free to use?
Yes, MySQL Database Integration is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MySQL Database Integration Alternatives — Similar Databases Servers
Looking for alternatives to MySQL Database Integration? 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 Database Integration 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 Database Integration?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.