Provides compatibility with MariaDB 10.0+ databases for querying, schema analysis, and cross-database analytics with the same capabilities as MySQL integration.
Enables querying and analyzing MySQL databases with read-only access, schema inspection, relationship detection, and federated queries across multiple MySQL data sources for comprehensive business intelligence.
Connects to Salesforce MySQL backend systems for CRM data access, enabling customer analytics and cross-system correlation with other business data sources.
Connects to SAP's MySQL interface for ERP system reporting, enabling procurement, inventory, sales, and finance data analysis across business processes.
Integrates with Shopify's MySQL database for e-commerce analytics, including order history, customer lifetime value calculations, and purchase behavior analysis.
Provides access to WooCommerce MySQL databases for e-commerce platform analytics, order tracking, and integration with other business systems.
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
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
Configuration
Environment Variables
Default Data Source
Variable | Default | Description |
|
| MySQL server hostname (default source) |
|
| MySQL server port (default source) |
|
| MySQL username (default source) |
| `` | MySQL password (required for default source) |
| (none) | MySQL database name (optional - server-wide access if omitted) |
|
| Enable SSL connection (default source) |
Multi-Source Data Federation
For additional business system data sources, use pattern: MYSQL_HOST_<SOURCE>_*
Pattern | Example | Description |
|
| Hostname for the data source |
|
| Port for the data source (default: 3306) |
|
| Username for the data source (default: root) |
|
| Password for the data source (required) |
|
| Database name for the data source (optional) |
|
| Enable SSL for the data source (default: false) |
Note: Each additional data source requires at least MYSQL_HOST_<SOURCE>_HOST and MYSQL_HOST_<SOURCE>_PASSWORD to be configured.
Caching Configuration
Variable | Default | Description |
|
| Enable/disable intelligent caching system |
|
| Custom cache directory path |
|
| Maximum cache file size in bytes (50MB) |
|
| Days to retain cached files |
Configuration Examples
Enterprise data federation setup:
Single database access (legacy mode):
Custom caching configuration:
Usage
Running the Server
Available Tools
mysql_inventory
🏢 START HERE - Get comprehensive inventory of all configured business systems and their databases.
Parameters:
refresh(boolean, optional): Force refresh of data source inventoryhost(string, optional): Get inventory for specific data source only
Examples:
What you get:
🏢 Business system classification (CRM, E-commerce, ERP, Marketing, Support, etc.)
📊 Database inventory with record counts and connection health
🔗 Federation capabilities and shared identifiers across systems
💡 Cross-system analysis recommendations
mysql_cross_host_query
🚀 ENTERPRISE POWER TOOL - Execute federated queries across multiple business systems.
Parameters:
queries(array, required): Array of queries to execute across different data sourceshost(string, required): Data source name to execute query ondatabase(string, optional): Database name within the data sourcequery(string, required): SQL query to executealias(string, optional): Alias for this query result
combine_strategy(string, optional): How to combine results ('separate', 'union', 'comparison', 'correlation')analysis_focus(string, optional): Focus area ('performance', 'data_consistency', 'user_behavior', 'business_metrics')
Example - 360° Customer Intelligence:
mysql_query
Execute read-only SQL queries against specific data sources.
Parameters:
query(string, required): SQL query to executeparams(array, optional): Parameters for prepared statementsdatabase(string, optional): Database name to connect tohost(string, optional): Data source name (defaults to 'default')
Examples:
mysql_schema
Get comprehensive schema information including relationships, constraints, and data patterns.
Parameters:
table(string, optional): Specific table name to analyzeinclude_relationships(boolean, default: true): Include foreign key relationshipsinclude_sample_data(boolean, default: false): Include sample data and statisticssample_size(number, default: 100, max: 1000): Number of sample rows to analyze
Examples:
mysql_analyze_tables
Analyze table relationships and suggest optimal query patterns for user behavior analysis.
Parameters:
tables(array, required): List of table names to analyzeanalysis_type(string, optional): Type of analysis ('relationships', 'user_behavior', 'data_flow')
Examples:
mysql_discover_analytics
🚀 START HERE - Intelligently discover and analyze your entire MySQL server with expert data analytics insights and intelligent caching.
Parameters:
databases(array, optional): List of databases to analyze (if not specified, discovers all accessible databases)focus_area(string, optional): Analytics focus ('user_behavior', 'sales_analytics', 'engagement', 'general')include_recommendations(boolean, default: true): Include expert query recommendationscross_database_analysis(boolean, default: true): Analyze relationships across databasesdetail_level(string, optional): Level of analysis ('summary', 'detailed', 'full')max_tables_per_db(number, default: 20): Maximum tables to analyze per databasepage(number, default: 1): Page number for paginationpage_size(number, default: 5): Number of databases per page
Examples:
What you get:
🌐 Complete multi-database server analysis with all executed SQL queries shown
🧠 Intelligent table classification across all databases (fact tables, dimension tables, user tables, event tables)
🔄 Cross-database relationship mapping and pattern detection
📊 Expert analytics insights and performance recommendations per database
📈 Ready-to-use SQL queries for cross-database analytics patterns
🔍 Data quality assessments and optimization suggestions
🏗️ Architecture analysis (star schema detection, data warehouse patterns)
⚡ High-performance caching: All results cached with TTL for faster subsequent queries
📄 Pagination support: Handle large servers with configurable page sizes
🚀 Intelligent Caching System
The server includes a comprehensive caching system that dramatically improves performance for repeated operations:
Cache Types & TTL
Query Results: 1-hour TTL -
~/.mcp-mysql-cache/queries/[date]/Schema Analysis: 1-2 hour TTL -
~/.mcp-mysql-cache/schema-snapshots/Discovery Reports: 4-hour TTL -
~/.mcp-mysql-cache/reports/discovery-reports/Relationship Analysis: Cached -
~/.mcp-mysql-cache/reports/relationship-analysis/
Cache Features
Automatic TTL management: Expired cache automatically detected and refreshed
Intelligent key generation: Complex queries cached with hash-based keys
Size limits: Configurable maximum file size (default: 50MB)
Storage organization: Organized by date and operation type
Cache info: All responses include cache hit/miss information
Cross-session: Cache persists across server restarts
Cache Benefits
Faster repeated queries: Instant responses for cached operations
Reduced database load: Less strain on your MySQL server
Improved UX: Near-instantaneous results for complex analytics
Development efficiency: Quick iterations during data exploration
Security Features
Query Validation: Only read-only operations allowed (SELECT, SHOW, DESCRIBE, EXPLAIN)
Length Limits: Queries limited to 10,000 characters
Prepared Statements: Parameterized queries to prevent SQL injection
Connection Timeouts: Configurable timeouts to prevent hanging connections
Error Handling: Comprehensive error catching and logging
Database User Setup
For security, create a dedicated read-only MySQL user:
Development
Compatibility
MySQL 5.5+
MariaDB 10.0+
Node.js 18+
Error Handling
The server provides detailed error messages for:
Connection failures
Invalid queries
Query execution errors
Parameter validation errors
All errors are logged to stderr while maintaining MCP protocol compliance.
Deployment
GitHub
Smithery.ai Registry
Ensure
mcp.jsonis properly configuredPush to GitHub repository
Submit to Smithery.ai MCP Registry
Include the
mcp.jsonfile for automatic discovery
Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
🐛 Issues: GitHub Issues
💬 Discussions: GitHub Discussions
📚 Documentation: Full Documentation
This server cannot be installed