- Home
- MCP servers
- MySQL
MySQL
- python
5
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"gcluowenqiang-mysql-mcp": {
"command": "python",
"args": [
"F:/path/to/mysql-mcp/main.py"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_DATABASE": "your_database",
"MYSQL_PASSWORD": "your_password",
"MYSQL_USERNAME": "your_username",
"MYSQL_MAX_RETRIES": "3",
"MYSQL_QUERY_TIMEOUT": "60",
"MYSQL_SECURITY_MODE": "readonly",
"MYSQL_ALLOWED_SCHEMAS": "*",
"MYSQL_CONNECT_TIMEOUT": "30",
"MYSQL_MAX_RESULT_ROWS": "1000",
"MYSQL_ENABLE_QUERY_LOG": "false"
}
}
}
}You run a MySQL MCP server that integrates with Cursor to query table structures, generate documentation in multiple formats, and safely execute SQL across SQL modes. This server helps you inspect databases, document schemas, and perform read or write operations under controlled security levels.
How to use
You interact with the MCP server through your Cursor client by issuing commands that target the MySQL MCP server. The server exposes a protected surface for reading table structures, generating documentation, and executing SQL based on the configured safety mode.
Common workflows you can perform include: getting current security configuration, listing accessible databases and tables, describing a table structure, running read-only queries, generating Markdown/JSON/SQL documentation for tables, and creating a database overview. You can also fetch cached results for repeated queries to improve performance.
How to install
{
"mcpServers": {
"mysql_mcp": {
"command": "python",
"args": ["F:/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"
}
}
}
}
Additional sections
Prerequisites you need before starting include having Python installed on your system and access to the database you want to manage. You will install dependencies, configure the MCP server, and then run the server with the specified Python command.
Security considerations: start in readonly mode for production environments to minimize risk. Use limited_write for scenarios that require data entry with protections on structural changes, and only enable full_access in trusted environments. Always minimize database user permissions and ensure connections use secure channels.
Troubleshooting tips: verify that the environment variables are correctly set, check the connection parameters, and confirm the MCP command is reachable. If SQL operations are rejected, review the current security mode. If the server cannot connect, inspect timeout and retry settings.
Usage notes: the MCP server relies on a local Python process started via a real path to the main script. Keep the path consistent and ensure the script is executable by the user running the MCP process.
Tools and capabilities overview
The MySQL MCP server provides a set of tools to manage and document your database, including creating connections, listing schemas, describing tables, and generating documentation in multiple formats.
Available tools
test_connection
Test the database connection to ensure MCP can reach MySQL with the provided credentials.
get_security_info
Retrieve the current security configuration including mode and allowed schemas.
list_tables
List all tables in a specified database, or all accessible databases if none is provided.
describe_table
Describe the detailed structure of a specified table, optionally within a specific database.
generate_table_doc
Generate documentation for a table in Markdown, JSON, or SQL format.
generate_database_overview
Create an overview document for the entire database, summarizing schemas, tables, and relationships.
execute_query
Execute a SQL statement respecting the current security mode and return results.
list_schemas
List all available databases or schemas that the MCP can access.