mcp_mysql_server_pro logo

mcp_mysql_server_pro

by wenb1n-dev

mcp_mysql_server_pro extends MySQL CRUD operations with database anomaly analysis and custom tool extensions. It supports STDIO and SSE modes, multiple SQL execution, and permission control.

View on GitHub

Last updated: N/A

What is mcp_mysql_server_pro?

mcp_mysql_server_pro is a server designed to enhance MySQL interaction by providing not only standard CRUD operations but also advanced features like database anomaly analysis and the ability to extend functionality with custom tools. It aims to simplify database management and analysis for developers.

How to use mcp_mysql_server_pro?

The server can be used in either SSE or STDIO mode. For SSE mode, configure the mcp client tool with the server's base URL and update the .env file with your MySQL database details. For STDIO mode, configure the mcp client tool with the command and arguments to run the server.py script, also setting the necessary environment variables for database connection. Custom tools can be added by creating new handler classes and importing them into the server.

Key features of mcp_mysql_server_pro

  • Supports both STDIO and SSE modes

  • Supports multiple SQL execution separated by ';'

  • Supports querying database table names and fields based on table comments

  • Supports SQL execution plan analysis

  • Supports Chinese field to pinyin conversion

  • Supports table lock analysis

  • Supports permission control with readonly, writer, and admin roles

Use cases of mcp_mysql_server_pro

  • Creating new tables and inserting data based on natural language prompts

  • Querying data based on table comments

  • Analyzing slow SQL queries and providing optimization suggestions

  • Analyzing SQL deadlock issues

  • Performing standard CRUD operations with role-based access control

FAQ from mcp_mysql_server_pro

How do I configure the server for SSE mode?

Add the server configuration to your mcp client tool's JSON configuration, specifying the base URL. Also, update the .env file with your MySQL connection details.

How do I configure the server for STDIO mode?

Add the server configuration to your mcp client tool's JSON configuration, specifying the command and arguments to run the server.py script. Set the MySQL connection details as environment variables.

How do I add a custom tool?

Create a new tool class in the handles package, inherit from BaseHandler, implement the get_tool_description and run_tool methods, and import the new tool in init.py.

What are the available roles and their permissions?

The available roles are readonly, writer, and admin. Readonly has SELECT, SHOW, DESCRIBE, and EXPLAIN permissions. Writer has the same permissions as readonly, plus INSERT, UPDATE, and DELETE. Admin has all permissions, including CREATE, ALTER, DROP, and TRUNCATE.

What kind of anomaly analysis is supported?

The server supports SQL execution plan analysis and table lock analysis to help identify and resolve performance issues.