mysql_mcp_server
mcp_mysql_server
소개
mcp_mysql_server_pro는 MySQL CRUD 작업에만 사용되는 것이 아니라 데이터베이스 이상 분석 기능도 포함하고 있으며 개발자가 사용자 정의 도구를 사용하여 쉽게 확장할 수 있도록 해줍니다.
STDIO 및 SSE 모드를 모두 지원합니다
";"로 구분된 여러 SQL 실행을 지원합니다.
테이블 주석을 기반으로 데이터베이스 테이블 이름 및 필드 쿼리를 지원합니다.
SQL 실행 계획 분석을 지원합니다
중국어 필드를 병음으로 변환 지원
테이블 잠금 분석 지원
데이터베이스 상태 분석 지원
읽기 전용, 작성자, 관리자의 세 가지 역할로 권한 제어를 지원합니다.
지엑스피1
즉각적인 템플릿 호출을 지원합니다.
Related MCP server: MySQL MCP Server Pro
도구 목록
도구 이름 | 설명 |
실행_sql | 권한 구성에 따라 ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE", "CREATE", "ALTER", "DROP", "TRUNCATE"] 명령을 실행할 수 있는 SQL 실행 도구 |
중국어 이니셜 받기 | 중국어 필드 이름을 병음 이니셜로 변환 |
get_db_health_running | MySQL 상태(연결 상태, 트랜잭션 상태, 실행 상태, 잠금 상태 감지)를 분석합니다. |
get_table_desc | 다중 테이블 쿼리를 지원하여 테이블 이름을 기반으로 데이터베이스에서 테이블 구조를 검색합니다. |
테이블 인덱스 가져오기 | 다중 테이블 쿼리를 지원하여 테이블 이름을 기반으로 데이터베이스에서 테이블 인덱스를 검색합니다. |
테이블 잠금을 얻으세요 | 현재 MySQL 서버에 행 수준 잠금 또는 테이블 수준 잠금이 있는지 확인하세요. |
테이블 이름 가져오기 | 테이블 주석 및 설명을 기반으로 데이터베이스에서 테이블 이름 검색 |
get_db_health_index_usage | 중복 인덱스 상황, 성능이 좋지 않은 인덱스 상황, 쿼리 시간이 30초를 초과하는 상위 5개의 사용되지 않는 인덱스 상황을 포함하여 현재 연결된 MySQL 데이터베이스의 인덱스 사용량을 가져옵니다. |
프롬프트 목록
프롬프트 이름 | 설명 |
분석-MySQL-프롬프트 | 이는 MySQL 관련 문제를 분석하기 위한 프롬프트입니다. |
쿼리-테이블-데이터-프롬프트 | 도구를 사용하여 테이블 데이터를 쿼리하기 위한 프롬프트입니다. 설명이 비어 있으면 MySQL 데이터베이스 쿼리 도우미로 초기화됩니다. |
사용 지침
SSE 모드
uv를 사용하여 서비스를 시작하세요
커서, 클라인 등의 다음 콘텐츠를 mcp 클라이언트 도구에 추가합니다.
mcp json은 다음과 같습니다.
{
"mcpServers": {
"operateMysql": {
"name": "operateMysql",
"description": "",
"isActive": true,
"baseUrl": "http://localhost:9000/sse"
}
}
}.env 파일 내용을 수정하여 데이터베이스 세부 정보로 데이터베이스 연결 정보를 업데이트합니다.
# MySQL Database Configuration
MYSQL_HOST=192.168.xxx.xxx
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=root
MYSQL_DATABASE=a_llm
MYSQL_ROLE=readonly # Optional, default is 'readonly'. Available values: readonly, writer, admin시작 명령:
# Download dependencies
uv sync
# Start
uv run server.pySTDIO 모드
커서, 클라인 등의 다음 콘텐츠를 mcp 클라이언트 도구에 추가합니다.
mcp json은 다음과 같습니다.
{
"mcpServers": {
"operateMysql": {
"isActive": true,
"name": "operateMysql",
"command": "uv",
"args": [
"--directory",
"G:\\python\\mysql_mcp\\src", # Replace this with your project path
"run",
"server.py",
"--stdio"
],
"env": {
"MYSQL_HOST": "192.168.xxx.xxx",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "root",
"MYSQL_DATABASE": "a_llm",
"MYSQL_ROLE": "readonly" # Optional, default is 'readonly'. Available values: readonly, writer, admin
}
}
}
} 사용자 정의 도구 확장
handles 패키지에 새로운 도구 클래스를 추가하고 BaseHandler에서 상속하고 get_tool_description 및 run_tool 메서드를 구현합니다.
서버에서 사용할 수 있도록 init .py에 새 도구를 가져옵니다.
예시
새 테이블을 만들고 데이터를 삽입하고, 다음과 같이 형식을 지정합니다.
# Task
Create an organizational structure table with the following structure: department name, department number, parent department, is valid.
# Requirements
- Table name: t_admin_rms_zzjg
- Field requirements: string type uses 'varchar(255)', integer type uses 'int', float type uses 'float', date and time type uses 'datetime', boolean type uses 'boolean', text type uses 'text', large text type uses 'longtext', large integer type uses 'bigint', large float type uses 'double'
- Table header needs to include primary key field, serial number XH varchar(255)
- Table must include these fixed fields at the end: creator-CJR varchar(50), creation time-CJSJ datetime, modifier-XGR varchar(50), modification time-XGSJ datetime
- Field naming should use tool return content
- Common fields need indexes
- Each field needs comments, table needs comment
- Generate 5 real data records after creation테이블 주석을 기반으로 데이터를 쿼리하려면 다음과 같이 요청합니다.
Query Zhang San's data from the user information table느린 SQL을 분석하려면 다음과 같이 프롬프트합니다.
select * from t_jcsjzx_hjkq_cd_xsz_sk xsz
left join t_jcsjzx_hjkq_jcd jcd on jcd.cddm = xsz.cddm
Based on current index situation, review execution plan and provide optimization suggestions in markdown format, including table index status, execution details, and optimization recommendationsSQL 교착 상태 문제를 분석하고 다음과 같이 묻습니다.
update t_admin_rms_zzjg set sfyx = '0' where xh = '1' is stuck, please analyze the cause다음과 같이 건강 상태 프롬프트를 분석하세요.
Check the current health status of MySQLAvailable Tools
5 toolsexecute_sqlC
在MySQL5.6s数据库上执行SQL
Inputs: query (required).
get_chinese_initialsB
创建表结构时,将中文字段名转换为拼音首字母字段
Inputs: text (required).
get_table_descC
根据表名搜索数据库中对应的表结构,支持多表查询
Inputs: text (required).
get_table_indexC
根据表名搜索数据库中对应的表索引,支持多表查询
Inputs: text (required).
get_table_nameB
根据表中文名搜索数据库中对应的表名
Inputs: text (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
The tools have distinct primary purposes (SQL execution, field name conversion, table structure/index/name retrieval), but there is some overlap between get_table_desc, get_table_index, and get_table_name as they all involve table metadata retrieval, which could cause confusion about which to use for specific queries. Descriptions help clarify, but the boundaries are not perfectly clear.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., execute_sql, get_table_desc), with no deviations in style or convention. This predictability makes it easy for agents to understand and navigate the tool set.
With 5 tools, the count is reasonable and well-scoped for a MySQL server, covering core operations like SQL execution and table metadata access. It is slightly lean but not insufficient, as it avoids bloat while providing essential functionality.
The tool set is severely incomplete for a MySQL database server. It lacks basic CRUD operations (e.g., create_table, update_data, delete_table), data manipulation beyond raw SQL, and lifecycle management tools, leaving significant gaps that will hinder agent workflows and cause failures in typical database interactions.
Maintenance
Related MCP Connectors
SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Your Supabase account in natural language: run SQL, apply migrations, manage tables, storage, edge f
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA universal SQLite database management tool that enables SQL query execution through MCP protocol. Supports SELECT/INSERT/UPDATE/DELETE/CREATE operations with built-in SQL injection protection across stdio, SSE, and streamable-http communication modes.MIT
- AlicenseBqualityDmaintenanceProvides comprehensive MySQL database operations including CRUD, performance optimization, health analysis, and anomaly detection. Supports multiple connection modes, OAuth2.0 authentication, and role-based permissions for database management through natural language.91MIT
- AlicenseNot gradedqualityBmaintenanceMulti-database management tool and MCP server supporting MySQL, PostgreSQL, SQLite, and Dameng DM8, enabling AI assistants to query and manage databases via stdio or HTTP.MIT
- FlicenseNot gradedqualityDmaintenanceEnables SQL queries, schema exploration, and Oracle sequence management across multiple databases including Oracle, OceanBase, and DolphinDB. Supports multiple environments with secure password handling.-
Appeared in Searches
- Developing and redeveloping web frontend and Python backend projects, including frontend-backend integration and debugging
- Using Laravel Helper Functions and Resolving MySQL Table Query Errors
- A platform for managing code repositories and DevOps workflows
- Frontend Development Tool for Detecting Errors
- Searching for Reddit discussions about server-sent events (SSE)