← Back to directory
M

MySQL MCP Server

Community
A read-only MySQL MCP server for querying databases through Claude Desktop.
GitHub source repository ↗
★ 7 Stars Category · Database Popular Source revision bac3c34c436e
53FMRS · D

The MySQL MCP server provides a convenient way to query read-only MySQL databases via Claude using natural language. It supports dynamic connections and per-query overrides, but its security relies solely on query validation, so a dedicated read-only user is recommended. Its functionality is limited, making it suitable for analysis and development scenarios, but not for production or write-heavy use cases.

Reliability
9/20
Security and permissions
8/20
Maintenance
9/20
Documentation
14/20
Setup experience
13/20
Read the FMRS scoring method →

The MySQL MCP Server is a Model Context Protocol implementation that enables Claude Desktop to interact with MySQL databases via natural language. It only executes read-only SQL queries, such as SELECT, and blocks data-modifying operations. It features dynamic connection configuration, allowing runtime switching between databases via connection strings. It is distributed as an npm package @hovecapital/read-only-mysql-mcp-server and is also available on GitHub.

Tools

connect
Connect to a MySQL database using a connection string; the connection persists until changed or disconnected.
disconnect
Disconnect from the current runtime database and revert to environment-configured defaults.
query
Execute a read-only SQL query on the currently connected database, optionally overriding the connection for that query.

Setup

Recommended: Use Claude Code CLI: run claude mcp add mysql -s user -- npx -y @hovecapital/read-only-mysql-mcp-server@latest, then set environment variables DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD. Alternatively, manually edit the Claude Desktop configuration file (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Windows: %APPDATA%\Claude\claude_desktop_config.json) and add the server configuration under mcpServers.

claude_desktop_config.json
{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["-y", "@hovecapital/read-only-mysql-mcp-server@latest"],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_DATABASE": "your_database_name",
        "DB_USERNAME": "your_username",
        "DB_PASSWORD": "your_password"
      }
    }
  }
}

Fit and risk

Best for

  • Data analysts and developers who want to query read-only MySQL data using natural language
  • Claude Desktop users who need to interact with local MySQL databases seamlessly
  • Teams that need to query MySQL without directly writing SQL

Not for

  • Applications that require write or modify operations on the database
  • Applications that need to connect to non-MySQL databases (e.g., PostgreSQL)
  • Production environments without additional security measures and a dedicated read-only user

Required permissions

  • Requires Node.js v16 or higher
  • Requires a MySQL database server
  • Requires Claude Desktop or Claude Code
  • Requires database credentials (via environment variables or connection string)
  • Grants only SELECT operations if credentials are limited, but if broad credentials are used, read access to all data is possible

Risks and side effects

  • Security may be misleading: the server only blocks non-SELECT statements, but if the provided credentials have write permissions, data could be modified; use a dedicated read-only user
  • Data privacy: database credentials are stored in environment variables, accessible to other processes on the same system
  • Network exposure: if the MySQL server is exposed, unauthorized access is possible; ensure network security
  • Resource usage: complex queries may consume significant resources; monitor query performance

Troubleshooting

  1. Config not taking effect after restart: verify you edited the correct config file and fully restart Claude.
  2. Connection failures: check MySQL is running, verify credentials, ensure network connectivity.
  3. Path errors: if manually installed, ensure the absolute path to dist/index.js is correct.
  4. JSON syntax issues: validate the claude_desktop_config.json format.
  5. View logs: run `node dist/index.js` to see server logs.

Use cases

Query database tables and data using natural language
View table structures without writing SQL manually
Fetch sample data for analysis
Provide non-technical users with database query capability

Supported clients

Claude DesktopFull support