MySQL▌
by malove86
Access MySQL databases, run SQL queries, and retrieve data easily with configurable parameters. Compatible with MySQL Wo
Provides direct interface to MySQL databases for executing SQL queries and retrieving relational data with configurable connection parameters.
Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.
best for
- / Database administrators managing MySQL instances
- / Developers analyzing database schemas and data
- / AWS RDS users needing database insights
- / Data analysts querying MySQL databases
capabilities
- / Execute SQL queries with prepared statements
- / List databases, tables, and describe table structures
- / View table indexes and statistics
- / Connect to local MySQL or cloud instances
- / Inspect database schemas and metadata
- / Manage secure SSL connections
what it does
Connects Claude to MySQL databases (including AWS RDS) to execute queries, explore schemas, and analyze table structures. Provides secure database access with SSL support and connection pooling.
about
MySQL is a community-built MCP server published by malove86 that provides AI assistants with tools and capabilities via the Model Context Protocol. Access MySQL databases, run SQL queries, and retrieve data easily with configurable parameters. Compatible with MySQL Wo It is categorized under databases.
how to install
You can install MySQL in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
MySQL is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
mcp-mysql-server
一个基于Model Context Protocol的MySQL数据库操作服务器。该服务器使AI模型能够通过标准化接口与MySQL数据库进行交互。
安装
npx @malove86/mcp-mysql-server
配置
服务器支持两种部署模式:
1. 本地运行模式
在MCP设置配置文件中使用命令行运行:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@malove86/mcp-mysql-server"],
"env": {
"MYSQL_HOST": "your_host",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database",
"MYSQL_PORT": "3306"
}
}
}
}
2. 远程URL模式 (v0.2.2+)
指向远程运行的MCP服务器:
{
"mcpServers": {
"mcp-mysql-server": {
"url": "http://your-server-address:port/mcp-mysql-server"
}
}
}
在远程服务器上,您需要设置环境变量后启动MCP服务器:
# 设置环境变量
export MYSQL_HOST=your_host
export MYSQL_USER=your_user
export MYSQL_PASSWORD=your_password
export MYSQL_DATABASE=your_database
export MYSQL_PORT=3306 # 可选,默认为3306
# 启动服务器
npx @malove86/mcp-mysql-server
注意:MYSQL_PORT是可选的,默认值为3306。
版本功能
v0.2.4+ 新特性
- 多用户并发支持:服务器现在可同时处理多个用户的请求
- 高效连接池管理:使用改进的连接池,支持最多50个并发连接
- 请求级别隔离:每个请求都有唯一标识符,便于跟踪和调试
- 详细日志记录:记录每个请求的执行过程和资源使用情况
- 改进的错误处理:更精确地捕获和报告数据库错误
- 性能优化:连接池复用和优化的连接管理提高处理速度
v0.2.2+ 特性
- 自动数据库连接:在服务器启动时,如果设置了环境变量,会自动尝试连接数据库
- 无需客户端参数:当使用URL模式时,客户端不需要提供数据库连接信息
- 无感知数据库操作:可以直接使用
list_tables、query等工具,无需先调用connect_db - 更安全:敏感的数据库凭据只在服务器端存在,不会暴露在客户端对话中
- 优雅的容错:即使初始连接失败,后续操作会自动重试连接
可用工具
1. connect_db
使用提供的凭据建立与MySQL数据库的连接。如果已通过环境变量设置了连接,此工具是可选的。
{
"host": "localhost",
"user": "root",
"password": "your_password",
"database": "your_database",
"port": 3306 // 可选,默认为3306
}
2. query
执行SELECT查询,支持可选的预处理语句参数。
{
"sql": "SELECT * FROM users WHERE id = ?",
"params": [1] // 可选参数
}
3. list_tables
列出已连接数据库中的所有表。
{} // 从v0.2.4开始不再需要任何参数
4. describe_table
获取特定表的结构。
{
"table": "users"
}
功能特点
- 安全的连接处理,自动清理
- 支持预处理语句参数
- 全面的错误处理和验证
- TypeScript支持
- 自动连接管理
- 服务器环境变量配置
- 支持URL远程连接模式
- 多用户并发支持
- 高性能连接池
性能
- 支持最多50个并发连接(可配置)
- 连接池自动管理,提高资源利用率
- 详细的请求跟踪和性能监控
安全性
- 使用预处理语句防止SQL注入
- 通过环境变量支持安全密码处理
- 执行前验证查询
- 完成后自动关闭连接
- URL模式下敏感凭据不暴露在客户端
- 连接隔离,防止用户间数据泄露
贡献
欢迎贡献!请随时提交Pull Request到 https://github.com/Malove86/mcp-mysql-server.git
许可证
MIT
FAQ
- What is the MySQL MCP server?
- MySQL is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for MySQL?
- This profile displays 55 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.7 out of 5—verify behavior in your own environment before production use.
Use Cases▌
Direct Database Queries from AI
Enable Claude to query your database directly using natural language
Example
Ask 'Show me top 10 customers by revenue this month' and get SQL results instantly
Eliminate manual SQL writing for ad-hoc queries, get insights 10x faster
Data Analysis & Reporting
Generate complex reports and analytics without leaving conversation
Example
Analyze sales trends, cohort retention, user behavior patterns conversationally
Democratize data access—non-technical team members can query databases
Schema Exploration
Understand database structure, relationships, and data models
Example
'Explain the user_orders table schema and its relationships'
Onboard engineers faster, explore unfamiliar databases efficiently
Data Validation & Quality Checks
Run data quality queries to catch anomalies and inconsistencies
Example
Find duplicate records, missing values, orphaned foreign keys automatically
Maintain data integrity with less manual SQL work
Implementation Guide▌
Prerequisites
- ›Claude Desktop 0.7.0+ or Cursor with MCP support
- ›Database credentials (read-only recommended for safety)
- ›Network access from Claude client to database
- ›Understanding of database security and access control
Time Estimate
15-30 minutes including configuration and testing
Installation Steps
- 1.Install MCP server: npm install -g @modelcontextprotocol/server-[name]
- 2.Configure database connection in Claude Desktop config (~/.claude/mcp.json)
- 3.Provide connection string: host, port, database, username, password
- 4.Restart Claude Desktop to load MCP server
- 5.Test connection: 'List all tables in database'
- 6.Run simple query: 'Show me 5 rows from users table'
- 7.Verify results and permissions are correct
- 8.Document query patterns for team use
Troubleshooting
- ⚠Connection refused: Check database is running and network accessible
- ⚠Authentication failed: Verify credentials, check user permissions
- ⚠Claude can't see tables: Grant appropriate read permissions to database user
- ⚠Slow queries: Add indexes, limit result set size, use read replicas
- ⚠MCP server not loading: Check config syntax, restart Claude Desktop
Best Practices▌
✓ Do
- +Use read-only database credentials to prevent accidental writes
- +Connect to read replica, not production primary database
- +Set query timeout limits to prevent long-running queries
- +Document database schema and common queries for AI context
- +Monitor query performance and optimize slow queries
- +Use connection pooling for better performance
- +Test with non-production data first
✗ Don't
- −Don't use production write credentials—risk of data corruption
- −Don't query production database during peak traffic hours
- −Don't expose sensitive PII without proper access controls
- −Don't skip query result validation—AI can misinterpret schema
- −Don't allow unlimited result set sizes—set LIMIT clauses
- −Don't share database credentials in plain text config files
💡 Pro Tips
- ★Create database views for common queries to simplify AI access
- ★Add schema comments/descriptions so AI understands column meanings
- ★Use semantic table/column names ('customer_lifetime_value' not 'clv')
- ★Set up query logging to audit what Claude is querying
- ★Create saved query templates for recurring analysis
- ★Combine with data visualization tools for better insights
Technical Details▌
Architecture
MCP server acts as bridge between Claude and database, translating natural language to SQL queries and returning results in structured format.
Protocols
- Model Context Protocol (MCP)
- Database-specific protocols (PostgreSQL, MySQL, MongoDB)
Compatibility
- PostgreSQL
- MySQL
- SQLite
- MongoDB
- Redis
When to Use This▌
✓ Use When
Use for ad-hoc data queries, exploratory analysis, report generation, schema exploration, and democratizing data access. Best for read-heavy analytics workloads.
✗ Avoid When
Avoid for production write operations, mission-critical transactions, real-time OLTP workloads, or when database contains sensitive PII without proper access controls. Use read replicas, not primary.
Integration▌
- →Read replica connection for analytics queries
- →Database view layer to abstract complex joins
- →Query result caching for repeated questions
- →Audit logging of all AI-generated queries
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
List & Promote Your MCP Server
Share your MCP server with the developer community
Ratings
4.7★★★★★55 reviews- ★★★★★Dhruvi Jain· Dec 24, 2024
We wired MySQL into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Camila Desai· Dec 24, 2024
According to our notes, MySQL benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Olivia Perez· Dec 24, 2024
I recommend MySQL for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Charlotte Kim· Dec 16, 2024
MySQL reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Harper Martin· Dec 12, 2024
Useful MCP listing: MySQL is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Oshnikdeep· Nov 15, 2024
Strong directory entry: MySQL surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Chen Sharma· Nov 15, 2024
I recommend MySQL for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Sofia Shah· Nov 15, 2024
According to our notes, MySQL benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Chen Khan· Nov 7, 2024
Useful MCP listing: MySQL is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Harper Taylor· Nov 3, 2024
MySQL reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
showing 1-10 of 55