mysql-mcp-core
v1.0.0
Published
Professional MySQL MCP server with integrated security guardrails, schema introspection, and performance auditing.
Maintainers
Readme
MYSQL MCP
A professional, high-performance Model Context Protocol (MCP) server for MySQL. Built for enterprise AI agents, it features interactive security guardrails, native schema introspection, performance auditing, and big data streaming.
Features
1. Interactive Guardrails (Safety-First)
Prevents accidental data loss by intercepting destructive queries (UPDATE, DELETE, DROP, ALTER, TRUNCATE). The server blocks execution and requires explicit human confirmation before proceeding.
2. Native Schema Resources
Exposes the full database schema as an MCP Resource (mysql://localhost/schema). This allows the LLM to contextually understand your tables and columns without consuming token-heavy tool calls.
3. Performance & Security Auditing
Built-in MCP Prompts (performance_audit, security_review) instruct the AI to analyze your schema for missing indexes, normalization issues, and security vulnerabilities.
4. Big Data Streaming Export
Avoid chat overflow when querying thousands of rows. The stream_export tool pipes query results directly to local CSV or JSON files on your disk.
Quick Start
You don't need to clone the repository. If you have Node.js installed, use npx directly in your MCP client configuration.
Claude Desktop Configuration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"mysql-mcp": {
"command": "npx",
"args": ["-y", "mysql-mcp-core"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Note: If your MySQL server is running inside a Docker container while Claude Desktop is on your host, use host.docker.internal instead of localhost for MYSQL_HOST.
Technical Specifications
Environment Variables
| Variable | Description | Default |
| :--- | :--- | :--- |
| MYSQL_HOST | Database host | localhost |
| MYSQL_USER | Database user | root |
| MYSQL_PASSWORD| Database password | (empty) |
| MYSQL_DATABASE| Database name | test |
MCP Tools
query: Execute a SQL query. (Destructive operations requireconfirm: true).inspect_table: Get detailed schema and index information for a specific table.analyze_performance: RunEXPLAINon a SELECT query to see the execution plan.stream_export: Export large query results to a local CSV/JSON file.
MCP Resources
mysql://localhost/schema: Full JSON representation of the current database schema.
MCP Prompts
performance_audit: Triggers an AI review of your schema for indexing opportunities.security_review: Triggers an AI review of your schema for primary keys and sensitive data.
Best Practices
Do not use the root user. For security, create a dedicated user for the MCP server:
CREATE USER 'mcp_agent'@'localhost' IDENTIFIED BY 'secure_password';
GRANT SELECT, INSERT, UPDATE, DELETE ON your_database.* TO 'mcp_agent'@'localhost';
FLUSH PRIVILEGES;Contributing
We welcome contributions! Please check the issues page or open a Pull Request.
Built for the global AI community.
