MCP server enabling read-only MySQL queries for Claude Desktop
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Read Only Local Mysql MCP Server.
connectConnect to a MySQL database using a connection string. The connection persists for subsequent queries until changed or disconnected.
disconnectDisconnect from the current runtime database and revert to the default environment-configured connection. Takes no parameters.
queryRun a read-only SQL query against the currently connected database.
A Model Context Protocol (MCP) server that enables Claude Desktop to interact with MySQL databases through natural language queries.
Then set your database environment variables:
Done! Restart Claude Code and ask: "What tables are in my database?"
1. Open your config file:
2. Add this configuration:
3. Save, restart Claude Desktop, and test!
This server is published in the Model Context Protocol Registry as capital.hove/read-only-local-mysql-mcp-server.
Then configure your database credentials using environment variables. Restart Claude Code and you're done!
Benefits:
For Claude Desktop:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
For Claude Code:
Edit ~/.config/claude-code/settings.json (macOS/Linux) or %APPDATA%\claude-code\settings.json (Windows):
If you're using Claude Code, you can easily install this MCP server:
Then configure Claude Code by adding to your MCP settings.
Save the repository to a directory on your system:
Note: If you installed via Option 1 (MCP Registry with npx), you've already configured everything! This section is for users who chose Options 2, 3, or 4 (npm or manual installation).
If you're using Claude Code with a manual installation, add the MySQL server to your MCP settings:
Open your Claude Code settings (typically in ~/.config/claude-code/settings.json on macOS/Linux or %APPDATA%\claude-code\settings.json on Windows)
Add the MySQL MCP server configuration:
If you're using Claude Desktop with a manual installation, open your Claude Desktop configuration file:
macOS:
Windows:
Add the MySQL server configuration:
If you're using mise for Node.js version management, make sure to use the full path to the Node.js executable in your configuration.
| Variable | Description | Default |
|---|---|---|
DB_HOST | MySQL server hostname | mysql |
DB_PORT | MySQL server port | 3306 |
DB_DATABASE | Database name | database |
DB_USERNAME | MySQL username | root |
DB_PASSWORD | MySQL password | (empty) |
DB_ALLOWED_HOSTS | Comma-separated extra hosts a connection string may point at. DB_HOST and loopback are always allowed. | (empty) |
Claude will automatically convert your natural language requests into appropriate SQL queries and execute them against your database.
connectConnect to a MySQL database using a connection string. The connection persists for subsequent queries until changed or disconnected.
Parameters:
| Parameter | Required | Description |
|---|---|---|
connectionString | Yes | MySQL connection string (e.g., mysql://user:password@host:port/database) |
disconnectDisconnect from the current runtime database and revert to the default environment-configured connection. Takes no parameters.
queryRun a read-only SQL query against the currently connected database.
Parameters:
| Parameter | Required | Description |
|---|---|---|
sql | Yes | SQL query to execute (read-only) |
connectionString | No | MySQL connection string to override the current connection for this query only |
The server supports switching databases at runtime without restarting. Connection priority:
connectionString β overrides everything for a single queryconnect tool) β persists until disconnect is calledConnection string format:
The hostname must be DB_HOST, a loopback address, or listed in DB_ALLOWED_HOSTS. Any other host is rejected before a connection is attempted, so the tools cannot be used to probe the network. Connection failures return a generic message and the real error is written to stderr.
Example workflow:
Queries are checked in two layers:
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/read-only-local-mysql-mcp-server)<a href="https://allmcps.com/mcp/read-only-local-mysql-mcp-server"><img src="https://allmcps.com/api/badge/read-only-local-mysql-mcp-server?style=directory" alt="Read Only Local Mysql MCP Server on AllMCPs" /></a>