
chenlinyang/mcp-server-mysql
Analytics & monitoringThis page was translated automatically. Technical details may differ from the original. View the original
This is an enhanced MySQL MCP service designed to provide comprehensive read-only access capabilities for MySQL databases. The high-performance MCP service allows large language models to fully view the database structure, efficiently perform queries and analyses, and offer more advanced features.
Overview
This project is based on the @benborla29 mcp-server-mysql project, and is an enhanced optimization for Claude Code - ✅ - Fully compatible with the latest version of Claude Code, providing a stable database access experience - ✅ When setting MYSQL_DB, strictly validates SQL queries for database access, ensuring queries only serve specified databases to avoid unexpected cross-database operations - ✅ - Built-in SSH tunnel supporting remote databases - ✅ Automatic tunnel management with Claude start/stop - ✅ Added MYSQL_DISABLE_READ_ONLY_TRANSACTIONS to support CREATE TABLE - ✅ Easily configure multiple projects with different databases 1. : See PROJECT_SETUP_GUIDE.md for detailed instructions 2. : Set up automatic SSH tunnels for remote databases 3. : Integrated MCP service works seamlessly with Claude Code A model context protocol server that provides access to MySQL databases via SSH tunnels. This server enables Claude and other large language models to securely check database patterns and execute SQL queries. - Node.js v20 or later - MySQL 5.7 or later (MySQL 8.0+ recommended) - MySQL users with the appropriate permissions for the required operation - For write operations: MySQL users with INSERT, UPDATE, and DELETE permissions This project is specifically optimized for Claude Code and provides complete MySQL database access functionality. Please follow the installation guide below for configuration. If you want to clone and run this MCP service directly from the source code, please follow these steps: 👉 Code address: github or gitee Add the following to your Claude Code configuration file (Linux and MacOS generally use ~/.claude.json, Windows generally uses %USERPROFILE%/.claude.json):
Overview (machine translated)
** 🚀 This is a MySQL MCP service for the latest version of Claude Code**
This project is based on the @benborla29 mcp-server-mysql project, with enhanced optimizations for Claude Code
MySQL MCP service based on NodeJS
🌟 If this project has been helpful to you, please give a like 🌟
Main Features of This Branch:
- ✅ Latest Claude Code Compatibility - Fully compatible with the latest version of Claude Code, providing a stable database access experience
- ✅ Enhanced Database Access Validation - When
MYSQL_DBis set, strictly validate SQL queries accessing the database to ensure queries are only used for specified databases and avoid unexpected cross-database operations - ✅ SSH Tunnel Support - Built-in SSH tunnels that support remote databases
- ✅ Auto Start/Stop Hook - Automatic tunnel management that works with Claude start/stop
- ✅ DDL Operation - Added
MYSQL_DISABLE_READ_ONLY_TRANSACTIONSto supportCREATE TABLE - ✅ Multi-Project Settings - Easily configure multiple projects with different databases
Quick Start with Claude Code Users:
- Read the Setup Guide: See PROJECT_SETUP_GUIDE.md for detailed instructions
- Configure SSH Tunnel: Set up an automatic SSH tunnel for the remote database
- Working with Claude: The integrated MCP service works seamlessly with Claude Code
A model context protocol server that provides access to MySQL databases via SSH tunnels. This server enables Claude and other large language models to securely check database patterns and execute SQL queries.
Table of Contents
- Requirements
- Installation
- Claude Code
- Run from the local warehouse
- Installed and run in global mode
- Components
- Tools
- Resources
- Safety features
- Performance optimization
- Monitoring and commissioning
- Configuration
- Advanced configuration options
- Environmental variables
- Basic connections
- Performance configuration
- Security configuration
- Monitoring configuration
- Multi-database model
- Mode-specific permissions
- Testing
- Database settings
- Run tests
- Operational evaluation
- Troubleshooting
- License
- Contribution
Requirements
- Node.js v20 or higher
- MySQL 5.7 or higher (MySQL 8.0+ recommended)
- MySQL users with the appropriate permissions for the required operation
- For write operations: MySQL users with INSERT, UPDATE, and DELETE permissions
Installation
Claude Code
This project is specifically optimized for Claude Code and provides complete MySQL database access functionality. Please follow the installation guide below for configuration.
This page was translated automatically. Technical details may differ from the original.
Install
npx @chenlinyang/mcp-server-mysqlConfiguration
{
"mcpServers": {
"mcp_server_mysql": {
"command": "/path/to/node",
"args": [
"/full/path/to/mcp-server-mysql/dist/index.js"
],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "your_password",
"MYSQL_DB": "your_database",
"MULTI_DB_WRITE_MODE": "false",
"ALLOW_INSERT_OPERATION": "false",
"ALLOW_UPDATE_OPERATION": "false",
"ALLOW_DELETE_OPERATION": "false"
}
}
}
}