mysql-mcp-server
Verified Safeby matpb
Overview
Provides secure, read-only access to MySQL databases through a Model Context Protocol (MCP) server, including schema introspection and Google Cloud SQL Proxy support.
Installation
npx -y @matpb/mysql-mcp-serverEnvironment Variables
- MYSQL_HOST
- MYSQL_PORT
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_DATABASE
- CLOUD_SQL_PROXY_ENABLED
- CLOUD_SQL_INSTANCE
- GOOGLE_APPLICATION_CREDENTIALS
Security Notes
The server implements robust query sanitization using `QuerySanitizer.ts` to explicitly reject mutation operations (INSERT, UPDATE, DELETE, DROP, etc.), transaction commands, and dangerous keywords (INTO OUTFILE, FOR UPDATE). Table names in `DescribeTableTool` are sanitized via regex to prevent SQL injection. It loads credentials from environment variables, avoiding hardcoded secrets. The Cloud SQL Proxy provides a secure connection tunnel, and its binary is auto-downloaded from a trusted Google source. While the auto-download feature inherently depends on the integrity of the source, the overall implementation of read-only enforcement and secure connection methods is strong.
Similar Servers
mcp-mysql-server
Provides an MCP-compliant interface for AI models to securely interact with a MySQL database for CRUD operations, schema inspection, and performance analysis.
postgres-mysql-mcp-server
A Model Context Protocol (MCP) server that enables AI assistants to query PostgreSQL and MySQL databases for schema introspection and data retrieval.
MsSqlMCP
Provides an MCP Server for SQL Server database schema inspection and safe, read-only query execution to AI clients.
mysql-mcp
Provides an MCP (Model Context Protocol) server for MySQL, enabling AI agents to programmatically interact with and manage MySQL databases.