MySQL Database Access

v0.1.3Databasesstable

An MCP server that provides read-only access to MySQL databases.

mcpmysqldatabasemodel-context-protocolai
Share:
68
Stars
0
Downloads
0
Weekly
0/5

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

Query MySQL databases with read-only access.
Retrieve and analyze data from relational databases.
Integrate MySQL data into AI workflows safely.
dpflucas

Maintainer

LicenseMIT License
Languagejavascript
Versionv0.1.3
UpdatedMay 9, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y mysql-mcp-server

Manual Installation

npx -y mysql-mcp-server

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 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
1

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

Install 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-server
3

Test 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-server
4

Add 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.

5

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.

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-database-access": { "command": "npx", "args": ["-y", "mysql-mcp-server"] } } }

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

Read the full setup guide →

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.

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