MySQL Database Access
An MCP server that provides read-only access to MySQL databases.
What is MySQL Database Access?
MySQL Database Access is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server that provides read-only access to mysql databases.
An MCP server that provides read-only access to MySQL databases.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server that provides read-only access to MySQL databa
Use Cases
Maintainer
Works with
Installation
NPM
npx -y mysql-mcp-serverManual Installation
npx -y mysql-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MySQL Database Access
The MySQL Database Access MCP server provides AI assistants with safe, read-only access to MySQL databases through four focused tools: listing databases and tables, describing schema, and executing SELECT queries. It enforces read-only semantics at the query level — only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed — making it suitable for connecting AI models to production data without write-access risk. Connection credentials are passed as environment variables so the database password never appears in chat context.
Prerequisites
- Node.js 18 or later with npx available
- A running MySQL server (version 5.7+ or 8.x) accessible from your machine
- MySQL user credentials with at least SELECT privileges on the target databases
- An MCP-compatible client such as Claude Desktop or Cursor
Verify MySQL connectivity
Confirm you can reach the MySQL server with the credentials you plan to use before configuring the MCP server.
mysql -h your-mysql-host -u your-mysql-user -pInstall the package globally (optional)
You can install `mysql-mcp-server` globally for convenience, or rely on npx to run it on demand without a global install.
npm install -g mysql-mcp-serverTest the server from the command line
Run the server directly with environment variables to confirm it starts and connects to MySQL before adding it to your MCP client.
MYSQL_HOST=your-host MYSQL_PORT=3306 MYSQL_USER=your-user MYSQL_PASSWORD=your-password npx mysql-mcp-serverAdd the server to your MCP client configuration
Add the configuration block below to your Claude Desktop or Cursor settings, filling in the real values for your MySQL instance.
Restart your MCP client
After saving the configuration file, restart Claude Desktop or your MCP client so it picks up the new server definition.
MySQL Database Access Examples
Client configuration
Add this block to your Claude Desktop `claude_desktop_config.json`. The server reads connection details from the `env` block — no credentials appear in chat.
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["mysql-mcp-server"],
"env": {
"MYSQL_HOST": "your-mysql-host",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your-mysql-user",
"MYSQL_PASSWORD": "your-mysql-password",
"MYSQL_DATABASE": "your-default-database"
}
}
}
}Prompts to try
These prompts use the four tools the server exposes: list_databases, list_tables, describe_table, and execute_query.
- "List all databases available on this MySQL server"
- "Show me the tables in the 'ecommerce' database"
- "Describe the schema of the 'orders' table in the 'ecommerce' database"
- "Query the top 10 customers by total order value from the orders and customers tables"
- "How many rows are in each table in the reporting database?"Troubleshooting MySQL Database Access
Connection refused or timeout when the server starts
Verify `MYSQL_HOST` and `MYSQL_PORT` are correct and that the MySQL server allows connections from your machine's IP. Check any firewall rules or MySQL bind-address settings in `my.cnf`.
Access denied error for the MySQL user
Confirm the user exists and has SELECT privileges: run `SHOW GRANTS FOR 'your-user'@'%';` in MySQL. Grant privileges with `GRANT SELECT ON *.* TO 'your-user'@'%';` if needed.
Write queries return an error even though I'm the DB owner
This is by design. The server enforces read-only access and will reject any INSERT, UPDATE, DELETE, or DDL statements regardless of user privileges.
Frequently Asked Questions about MySQL Database Access
What is MySQL Database Access?
MySQL Database Access is a Model Context Protocol (MCP) server that mcp server that provides read-only access to mysql databases. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MySQL Database Access?
Install via npm with the command: npx -y mysql-mcp-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 Access?
MySQL Database Access works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MySQL Database Access free to use?
Yes, MySQL Database Access is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MySQL Database Access Alternatives — Similar Databases Servers
Looking for alternatives to MySQL Database Access? 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 Access 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 Access?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.