Runs validated, read-only MySQL queries through MCP with configurable default and runtime database connections.
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.
The read-only-local-mysql-mcp-server MCP server lets an MCP-compatible client work with MySQL through natural-language requests that the client turns into SQL. It is intended for inspecting database structure and reading records, not for modifying data.
The server exposes three tools: connect selects a runtime database from a MySQL connection string, disconnect ends that runtime selection and returns to the environment-configured database, and query executes a read-only SQL statement. Query results are returned in JSON format.
Typical requests include listing tables, inspecting a table definition, retrieving a limited set of rows, counting records, and filtering results.
At startup, the server reads the default database connection from environment variables. A call to connect changes the active connection for later queries until disconnect is called. The query tool can also receive a connection string for a single request, which takes precedence over the persistent runtime connection and the environment-based default.
The read-only-local-mysql-mcp-server MCP server accepts a MySQL URL in the form mysql://username:password@hostname:port/database_name. Host access is restricted: the configured DB_HOST and loopback addresses are allowed, and additional destinations can be supplied through DB_ALLOWED_HOSTS.
Before execution, SQL is validated. Supported statement forms are SELECT, WITH, SHOW, DESCRIBE, and EXPLAIN. The validation permits one statement and rejects comments. Queries also run in a server-side read-only transaction, providing an additional safeguard against changes.
Node.js 16 or newer, a reachable MySQL server, and an MCP client are listed as prerequisites. The package can be launched with npx, installed globally from npm, or built locally after cloning the repository with npm install and npm run build.
For the default connection, configure these variables in the MCP client definition:
DB_HOST: MySQL hostnameDB_PORT: MySQL portDB_DATABASE: database nameDB_USERNAME: MySQL userDB_PASSWORD: passwordDB_ALLOWED_HOSTS: optional comma-separated additional hosts permitted in connection stringsThe documented npx command uses @hovecapital/read-only-mysql-mcp-server@latest. Claude Code can add it through the claude mcp add command, while Claude Desktop uses its MCP configuration file. After changing configuration, restart the client.
connect(connectionString): establishes a persistent runtime connection.disconnect(): closes the runtime connection and restores the environment-configured default.query(sql, connectionString?): executes a read-only query, optionally using a connection string only for that request.The read-only-local-mysql-mcp-server MCP server does not provide write operations. SQL outside the supported statement types, multiple statements, or statements containing comments are rejected. Host restrictions also prevent arbitrary connection targets unless they are the configured host, loopback, or listed in DB_ALLOWED_HOSTS.
The README documents Claude Desktop and Claude Code setup specifically. Credentials are supplied through environment variables or connection strings, so deployment should account for how the MCP client stores and passes those values.
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>