Back to MCP Directory
MySQL MCP Server Pro
Model Context Protocol moderate risk

MySQL MCP Server Pro

MySQL MCP Server Pro provides a suite of tools for interacting with MySQL databases, including SQL execution, health analysis, and schema exploration, with role-based access control.

Connections & Capabilities

Connects To

GitHubMySQL

Capabilities

readwriteexecadmin

Quickstart

Install

pip install mysql_mcp_server_pro

Config

{
	"mcpServers": {
		"mysql": {
			"command": "uvx",
			"args": [
				"--from",
				"mysql_mcp_server_pro",
				"mysql_mcp_server_pro",
				"--mode",
				"stdio"
			],
			"env": {
				"MYSQL_HOST": "192.168.x.xxx",
				"MYSQL_PORT": "3306",
				"MYSQL_USER": "root",
				"MYSQL_PASSWORD": "root",
				"MYSQL_DATABASE": "a_llm",
				"MYSQL_ROLE": "admin"
			}
		}
	}
}

Exposed MCP Tools (10)

high
execute_sql

Executes SQL queries against the MySQL database, subject to role-based permissions.

Can modify or delete data depending on the SQL command and user role.

safe
get_chinese_initials

Converts Chinese field names to pinyin initials.

Read-only operation, no side effects.

safe
get_db_health_running

Analyzes MySQL health status, including connection, transaction, and lock status.

Read-only operation, retrieves database status information.

safe
get_table_desc

Retrieves table structures based on table names.

Read-only operation, retrieves table metadata.

safe
get_table_index

Retrieves table indexes based on table names.

Read-only operation, retrieves table index information.

safe
get_table_lock

Checks for row-level or table-level locks in the MySQL server.

Read-only operation, retrieves lock information.

safe
get_table_name

Searches for table names based on table comments and descriptions.

Read-only operation, searches table metadata.

safe
get_db_health_index_usage

Gets the index usage of the MySQL database, including redundant and unused indexes.

Read-only operation, retrieves index usage statistics.

safe
optimize_sql

Provides expert optimization suggestions based on MySQL execution plans and table information.

Read-only operation, analyzes SQL and provides suggestions.

moderate
use_prompt_queryTableData

Uses built-in prompts to construct a chain call of tools for querying table data.

Depends on the prompt and tools invoked, could potentially lead to data modification.

Safety Assessment

This server offers a balance of functionality and security. It's safe for read-only operations and database analysis when configured with appropriate roles. However, caution is advised when granting write or admin privileges, and input validation is crucial to prevent SQL injection attacks.

  • Role-based access control (readonly, writer, admin) limits potential damage.
  • Supports OAuth2.0 for authentication.
  • Includes tools for analyzing database health and performance.
  • Provides SQL execution plan analysis for optimization.
  • Direct SQL execution can be risky if not properly validated.
  • Improper configuration of roles could lead to unintended data modification.
  • Access to database credentials via environment variables.
  • Potential for SQL injection if inputs are not sanitized.