MySQL MCP Server 🚀
An intelligent MySQL MCP Server with enterprise data federation capabilities, enabling LLMs to query and analyze data across multiple disparate MySQL data sources. Goes beyond basic querying to provide comprehensive business intelligence, cross-system data correlation, and federated analytics with high-performance caching.

✨ Features
🏢 Enterprise Data Federation
- 🌐 Multi-source MySQL access: Connect to completely different business systems (CRM, ERP, E-commerce, etc.)
- 🧠 Intelligent source classification: Automatically identify and catalog CRM, E-commerce, ERP, Marketing, Support systems
- 🔗 Cross-source query engine: Execute federated queries combining data from multiple business systems
- 📊 360° business intelligence: Complete customer view across all touchpoints and systems
- 🔍 Relationship detection: Find connections between disparate systems (shared customer IDs, etc.)
📈 Advanced Analytics & Intelligence
- 👥 User behavior federation: Track customers across CRM → Marketing → E-commerce → Support journey
- 💼 Business process analytics: End-to-end analysis from procurement → inventory → sales → finance
- 🎯 Revenue attribution: Multi-touch attribution across marketing, sales, and customer systems
- 🔄 Data consistency auditing: Compare and validate data integrity across business systems
- 📈 Cross-system KPI reporting: Unified executive dashboards combining all business data
⚡ Performance & Enterprise Features
- 🚀 High-performance caching: Source-specific intelligent caching with TTL support
- 🔒 Enterprise security: Read-only access with query validation and connection timeouts
- 🏗️ Architecture detection: Automatic identification of star schemas and data warehouse patterns
- 🔧 Connection pooling: Efficient connection management across multiple business systems
- 🚀 Smithery deployment: Easy deployment with configuration UI on Smithery.ai
- MySQL 5.5+ compatible: Works with MySQL 5.5 and later versions
Quick Start
Option 1: Direct Install from GitHub
# Clone and install
git clone https://github.com/ttpears/mcp-mysql.git
cd mcp-mysql
npm install && npm run build
# Add to Claude Code with your MySQL credentials
# For server-wide access (recommended):
claude mcp add mysql-server npm start \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=your_user \
-e MYSQL_PASSWORD=your_password
# For single database access:
claude mcp add mysql-server npm start \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=your_user \
-e MYSQL_PASSWORD=your_password \
-e MYSQL_DATABASE=your_database
Option 2: Deploy on Smithery.ai (Recommended)
Visit Smithery.ai MySQL MCP Server and click "Deploy" for easy setup with configuration UI.
Features when deployed on Smithery:
- 🎛️ Configuration UI: Easy setup with form-based configuration
- 🔄 Auto-updates: Automatic updates when new versions are released
- ⚡ High performance: Optimized deployment with caching enabled
- 🔒 Secure: Environment-based secret management
Option 3: Manual Installation
npm install mysql-mcp-server
Configuration
Environment Variables
Default Data Source
| Variable | Default | Description |
|---|
MYSQL_HOST | localhost | MySQL server hostname (default source) |
MYSQL_PORT | 3306 | MySQL server port (default source) |
MYSQL_USER | root | MySQL username (default source) |
MYSQL_PASSWORD | `` | MySQL password (required for default source) |
MYSQL_DATABASE | (none) | MySQL database name (optional - server-wide access if omitted) |
MYSQL_SSL | false | Enable SSL connection (default source) |
Multi-Source Data Federation
For additional business system data sources, use pattern: MYSQL_HOST_<SOURCE>_*
| Pattern | Example | Description |
|---|
MYSQL_HOST_<SOURCE>_HOST | MYSQL_HOST_CRM_HOST | Hostname for the data source |
MYSQL_HOST_<SOURCE>_PORT | MYSQL_HOST_CRM_PORT | Port for the data source (default: 3306) |
MYSQL_HOST_<SOURCE>_USER | MYSQL_HOST_CRM_USER | Username for the data source (default: root) |
MYSQL_HOST_<SOURCE>_PASSWORD | MYSQL_HOST_CRM_PASSWORD | Password for the data source (required) |
MYSQL_HOST_<SOURCE>_DATABASE | MYSQL_HOST_CRM_DATABASE | Database name for the data source (optional) |
MYSQL_HOST_<SOURCE>_SSL | MYSQL_HOST_CRM_SSL | Enable SSL for the data source (default: false) |