Skip to main content
Glama

mysql_mcp_server

by wenb1n-dev

mcp_mysql_server

소개

mcp_mysql_server_pro는 MySQL CRUD 작업에만 사용되는 것이 아니라 데이터베이스 이상 분석 기능도 포함하고 있으며 개발자가 사용자 정의 도구를 사용하여 쉽게 확장할 수 있도록 해줍니다.

  • STDIO 및 SSE 모드를 모두 지원합니다
  • ";"로 구분된 여러 SQL 실행을 지원합니다.
  • 테이블 주석을 기반으로 데이터베이스 테이블 이름 및 필드 쿼리를 지원합니다.
  • SQL 실행 계획 분석을 지원합니다
  • 중국어 필드를 병음으로 변환 지원
  • 테이블 잠금 분석 지원
  • 데이터베이스 상태 분석 지원
  • 읽기 전용, 작성자, 관리자의 세 가지 역할로 권한 제어를 지원합니다.지엑스피1
  • 즉각적인 템플릿 호출을 지원합니다.

도구 목록

도구 이름설명
실행_sql권한 구성에 따라 ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE", "CREATE", "ALTER", "DROP", "TRUNCATE"] 명령을 실행할 수 있는 SQL 실행 도구
중국어 이니셜 받기중국어 필드 이름을 병음 이니셜로 변환
get_db_health_runningMySQL 상태(연결 상태, 트랜잭션 상태, 실행 상태, 잠금 상태 감지)를 분석합니다.
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.py

STDIO 모드

커서, 클라인 등의 다음 콘텐츠를 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 } } } }

사용자 정의 도구 확장

  1. handles 패키지에 새로운 도구 클래스를 추가하고 BaseHandler에서 상속하고 get_tool_description 및 run_tool 메서드를 구현합니다.
  2. 서버에서 사용할 수 있도록 init .py에 새 도구를 가져옵니다.

예시

  1. 새 테이블을 만들고 데이터를 삽입하고, 다음과 같이 형식을 지정합니다.
# 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
  1. 테이블 주석을 기반으로 데이터를 쿼리하려면 다음과 같이 요청합니다.
Query Zhang San's data from the user information table
  1. 느린 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 recommendations
  1. SQL 교착 상태 문제를 분석하고 다음과 같이 묻습니다.
update t_admin_rms_zzjg set sfyx = '0' where xh = '1' is stuck, please analyze the cause
  1. 다음과 같이 건강 상태 프롬프트를 분석하세요.
Check the current health status of MySQL

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

STDIO 모드 및 SSE 모드에 대한 지원 추가 ";"로 구분된 여러 SQL 실행에 대한 지원 추가 테이블 주석을 기반으로 데이터베이스 테이블 이름 및 필드를 쿼리하는 기능 추가 SQL 실행 계획 분석 추가 중국어 필드를 병음으로 변환 추가

  1. 소개
    1. 도구 목록
      1. 프롬프트 목록
        1. 사용 지침
          1. SSE 모드
          2. STDIO 모드
        2. 사용자 정의 도구 확장
          1. 예시

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              Facilitates interaction with Microsoft SQL Server Express, supporting database operations such as querying, table management, and schema inspection via natural language MCP commands.
              Last updated -
              1
              Python
              MIT License
            • -
              security
              F
              license
              -
              quality
              A server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.
              Last updated -
              Python
            • -
              security
              F
              license
              -
              quality
              A natural language interface that allows Claude to execute SQL queries on your local MySQL databases, enabling database interaction using natural language.
              Last updated -
              2
              Python
              • Linux
              • Apple
            • -
              security
              F
              license
              -
              quality
              Enables secure interaction with MySQL databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
              Last updated -
              Python
              • Linux
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/wenb1n-dev/mysql_mcp_server_pro'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server