MySQL MCP is an MCP server that provides Model Context Protocol clients with direct access to MySQL databases for schema exploration, documentation export, and query execution. Designed primarily for Cursor and adaptable to other MCP-compatible environments, the server allows developers and data analysts to inspect relational tables, examine column constraints, and test SQL statements directly through natural language prompts. It includes three distinct security modes: read-only mode to prevent unintended database mutations, limited write mode for insert and update tasks without destructive schema changes, and full access mode for comprehensive administrative workflows. In addition to data queries, MySQL MCP offers built-in documentation tools that extract table definitions and database-level summaries into Markdown, JSON, or SQL format saved directly into local project directories. The server also integrates query caching to accelerate repeated read operations and reduce unnecessary database load. Configurable environment variables control connection timeouts, row limits, allowed database schemas, and query logging.
Category: Databases & Data Stores
Tags: database, mysql, relational, SQL
bash cd mysql-mcp pip install -r requirements.txt 2. Open your Cursor MCP settings configuration file and register mysql-mcp under mcpServers: json { "mcpServers": { "mysql-mcp": { "command": "python", "args": ["/path/to/mysql-mcp/main.py"], "env": { "MYSQL_HOST": "localhost", "MYSQL_PORT": "3306", "MYSQL_USERNAME": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database", "MYSQL_SECURITY_MODE": "readonly", "MYSQL_ALLOWED_SCHEMAS": "*", "MYSQL_ENABLE_QUERY_LOG": "false" } } } } 3. Replace /path/to/mysql-mcp/main.py with your absolute local path and set your database connection credentials. 4. Restart Cursor to load the server and its database tools.Part of MCP Servers
MySQL MCP is a Model Context Protocol server that connects AI assistants like Cursor to MySQL databases. It enables assistants to discover schemas, inspect table structures, execute SQL statements within defined safety boundaries, and export documentation in formats such as Markdown, JSON, and raw SQL.
To install MySQL MCP, clone the repository locally and run pip install -r requirements.txt. Then, configure your MCP client, such as Cursor, by adding the server configuration with python pointing to main.py and defining database environment variables like MYSQL_HOST, MYSQL_PORT, MYSQL_USERNAME, and MYSQL_PASSWORD.
MySQL MCP supports three security modes configured via the MYSQL_SECURITY_MODE environment variable. Readonly mode restricts execution to queries like SELECT and DESCRIBE. Limited write mode permits INSERT and UPDATE operations while blocking DELETE and DROP commands. Full access mode allows arbitrary SQL operations for administrative tasks.
MySQL MCP is tailored for integration with Cursor, but it operates over the standard Model Context Protocol. Any MCP client supporting standard local process execution with custom environment variables can launch the server using Python and communicate via MCP tools.
Yes, MySQL MCP is open source and licensed under the permissive MIT License. Users are free to use, modify, distribute, and integrate the code into commercial or personal development workflows as long as the original copyright notice is retained.