mcp-server-mysql is a server based on the Model Context Protocol (MCP), used to provide Claude and other large language models with access to MySQL databases. Through this server, LLMs can inspect database schemas, execute queries, and optionally write data.
Main capabilities
- Read-only by default: write operations are all disabled by default and must be explicitly enabled via environment variables.
- Write switches: insert, update, and delete operations can be enabled separately via ALLOW_INSERT_OPERATION=true, ALLOW_UPDATE_OPERATION=true, and ALLOW_DELETE_OPERATION=true.
- Schema inspection: provides the mysql://tables resource, used to list all tables and column metadata of the connected database.
- Query tool: provides the mysql_query tool to execute SQL queries, read-only by default.
- Per-database permissions: supports configuring read/write permissions separately for different databases.
- Multi-database mode: allows querying across multiple databases without reconnecting.
- PII masking: automatically masks sensitive data in results.
- SSH tunnel: built-in support for SSH tunneling to remote databases.
- Remote mode: supports HTTP-based transport with bearer token authentication.
- SSL/TLS: supports encrypted connections and provides an mTLS option.
- Claude Code integration: optimized for Anthropic's Claude Code CLI.
Usage
- Client access: can be used in Claude Desktop or other clients; Claude Code is the simplest way. The official documentation provides installation guides for Smithery, Cursor, Codex, Claude Code, local repositories, and remote mode.
- Prerequisites: requires MySQL 5.7+ (8.0+ recommended), as well as a MySQL user with the corresponding permissions.
- Configuration: configured via environment variables; the official documentation lists all environment variables and advanced configuration options.
Use cases
- Let AI assistants inspect database schemas, run read-only queries, and answer data questions.
- Scenarios that require extending AI database query capabilities to team collaboration environments (the material mentions Bloome as a sponsor, providing zerolocal installation, cloud operation, and an AI agent IM platform supporting web and mobile).
Limitations and notes
- Read-only by default; writes must be explicitly enabled via environment variables.
- Specific installation commands, the complete list of environment variables, testing, and troubleshooting need to be referenced in the official documentation; this page does not provide them item by item.
- The license is MIT; see LICENSE for details.