test_connectionLABSCO SUMMARY
Decide how much SQL the agent may run before you connect it.
The three modes are the distinguishing feature: readonly by default, limited_write for data entry that must not touch schema, full_access only where you actually mean it. The documentation generators are the second reason to keep it around, because a table or a whole database gets written up in Markdown on request.
What it is
A MySQL server designed for Cursor. It reads table structure, runs SQL under one of three security modes, and generates Markdown, JSON or SQL documentation for a table or for a whole database. Query results are cached automatically.
What you get
- The connection tested and the active security configuration reported (test_connection, get_security_info)
- Accessible databases and their tables listed (list_schemas, list_tables), and one table's structure described in detail (describe_table)
- SQL executed at whatever level the security mode allows (execute_query)
- Markdown, JSON or SQL documentation generated for a table (generate_table_doc), and an overview document for an entire database (generate_database_overview)
- Three security modes: readonly, the default, allowing only SELECT, SHOW, DESCRIBE and EXPLAIN; limited_write, adding INSERT and UPDATE while blocking DELETE, DROP, CREATE and ALTER; and full_access, allowing everything
- Query result caching, so a repeated question does not become a repeated round trip
Requirements
Python with requirements.txt installed, and the host, port, username, password and database in the client config. MYSQL_ALLOWED_SCHEMAS limits which databases are reachable, taking * for everything the user can see, auto to discover them, or a comma-separated list. Results are capped at 1,000 rows by default, and that cap is itself configurable.
Setup effort
Build from source
USE CASES
Letting an analyst ask questions without risk
Leave the security mode at readonly and only SELECT, SHOW, DESCRIBE and EXPLAIN get through. The guarantee is enforced at the server rather than requested in a prompt.
Understanding a database nobody documented
List the tables, describe the ones that matter, then generate an overview document for the whole database in Markdown, which is the artefact that outlives the conversation.
Writing up one table for a spec
Generate the table's documentation in Markdown, JSON or SQL depending on where it is going, instead of transcribing a DESCRIBE by hand.
Allowing data entry but not schema changes
Set limited_write and INSERT and UPDATE are permitted while DELETE, DROP, CREATE and ALTER are refused, which fits the case where an agent maintains rows in a table it must not restructure.
Confirming what it can reach before you trust it
Test the connection and read the active security configuration back, and use MYSQL_ALLOWED_SCHEMAS to keep it to the databases you meant rather than everything the user account can see.
8 tools
Listed in project docs. Your client may show a different list.
get_security_infolist_tablesdescribe_tablegenerate_table_docgenerate_database_overviewexecute_querylist_schemasBEFORE YOU INSTALL
What to know first
Tools you get
8 tools named in the project's documentation.
Requires
- MYSQL_PASSWORD in your environment
- MYSQL_USERNAME in your environment
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
You clone and build this one yourself.
Server setup
git clone https://github.com/Gcluowenqiang/Mysql-mcp
cd Mysql-mcp
pip install -r requirements.txtMCP Clients
Cursor
{
"mcpServers": {
"mysql-mcp": {
"command": "python",
"args": [
"<YOUR_PATH_TO_MYSQL_MCP>/main.py"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USERNAME": "<YOUR_MYSQL_USERNAME>",
"MYSQL_PASSWORD": "<YOUR_MYSQL_PASSWORD>",
"MYSQL_DATABASE": "<YOUR_MYSQL_DATABASE>",
"MYSQL_SECURITY_MODE": "readonly",
"MYSQL_ALLOWED_SCHEMAS": "*",
"MYSQL_ENABLE_QUERY_LOG": "false"
}
}
}
}