Loading...

This MCP server provides Claude Code and other LLMs secure access to MySQL databases, including schema inspection and SQL query execution via SSH tunnels.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
This MCP server provides Claude Code and other LLMs secure access to MySQL databases, including schema inspection and SQL query execution via SSH tunnels.
This MCP server is relatively safe when configured for read-only access and used with proper security measures like prepared statements. Enabling write operations increases the risk, especially if access controls and input validation are not carefully implemented. Remote mode introduces additional risks if the authorization is not properly configured.
Performance depends on the complexity of the SQL queries and the network latency between the MCP server and the MySQL database. Consider using connection pooling and query caching to improve performance.
Cost depends on the resources used by the MCP server and the MySQL database. Consider the cost of API calls, tokens, and infrastructure resources.
npm install -g{
"mcpServers": {
"mcp_server_mysql": {
"command": "/path/to/npx/binary/npx",
"args": [
"-y",
"@benborla29/mcp-server-mysql"
],
"env": {
// Basic connection settings
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "",
"MYSQL_DB": "db_name",
"PATH": "/path/to/node/bin:/usr/bin:/bin",
// Performance settings
"MYSQL_POOL_SIZE": "10",
"MYSQL_QUERY_TIMEOUT": "30000",
"MYSQL_CACHE_TTL": "60000",
// Security settings
"MYSQL_RATE_LIMIT": "100",
"MYSQL_MAX_QUERY_COMPLEXITY": "1000",
"MYSQL_SSL": "true",
// Monitoring settings
"ENABLE_LOGGING": "true",
"MYSQL_LOG_LEVEL": "info",
"MYSQL_METRICS_ENABLED": "true",
// Write operation flags
"ALLOW_INSERT_OPERATION": "false",
"ALLOW_UPDATE_OPERATION": "false",
"ALLOW_DELETE_OPERATION": "false"
}
}
}
}MYSQL_PORTOPENAI_API_KEYmysql_queryExecutes SQL queries against the connected MySQL database.
Potentially destructive if write operations are enabled; otherwise, safe for read-only queries.
Environment Variable
This MCP server is relatively safe when configured for read-only access and used with proper security measures like prepared statements. Enabling write operations increases the risk, especially if access controls and input validation are not carefully implemented. Remote mode introduces additional risks if the authorization is not properly configured.
Autonomy depends on the configured permissions. Read-only mode is safer, while write operations require careful consideration of access controls and potential impact.
Production Tip
Always start with read-only mode and gradually enable write operations as needed, with thorough testing and monitoring.
Set the ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, and ALLOW_DELETE_OPERATION environment variables to 'true'.
Refer to the PROJECT_SETUP_GUIDE.md for detailed instructions on setting up SSH tunnels.
For database servers with credentials, local or user scope is recommended to keep credentials private.
Use the `/mcp` command in Claude Code to check server status and authenticate if needed. Check the server logs for error messages.
Refer to the documentation on Schema-Specific Permissions for instructions.
Node.js v20 or higher and MySQL 5.7 or higher (MySQL 8.0+ recommended) are supported.
Set IS_REMOTE_MCP=true and REMOTE_SECRET_KEY in the .env file, then run the server using `npx @benborla29/mcp-server-mysql`.