Skip to main content
Glama
wenb1n-dev

mysql_mcp_server

by wenb1n-dev

간체 중국어영어

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.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

Available Tools

5 tools
execute_sqlC

在MySQL5.6s数据库上执行SQL

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes要执行的SQL语句

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool executes SQL on MySQL5.6, but doesn't disclose critical behavioral traits: whether it's read-only or can modify data, authentication requirements, transaction handling, error behavior, result format, or any rate limits. '执行SQL' implies both read and write operations are possible, but this isn't clarified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that directly states the tool's purpose without any wasted words. It's front-loaded with the core functionality and includes the database specification. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a SQL execution tool with no annotations and no output schema, the description is incomplete. It doesn't address critical context: what types of SQL are supported, whether it's for read-only queries or data modification, what the return format looks like, error handling, or security implications. The agent lacks sufficient information to use this tool safely and effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'query' documented as '要执行的SQL语句' (SQL statement to execute). The description adds no additional parameter semantics beyond what the schema provides. The baseline score of 3 is appropriate when the schema already fully documents parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('执行SQL' - execute SQL) and specifies the target resource ('在MySQL5.6s数据库上' - on MySQL5.6 database). It distinguishes from sibling tools that focus on metadata retrieval (get_table_name, get_table_desc, etc.) rather than SQL execution. However, it doesn't explicitly differentiate from potential non-sibling SQL execution tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate, what types of SQL statements it supports (SELECT, INSERT, UPDATE, DDL, etc.), or any prerequisites or limitations. The agent must infer usage from the purpose alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_chinese_initialsC

创建表结构时,将中文字段名转换为拼音首字母字段

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes要获取拼音首字母的汉字文本,以“,”分隔

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool's function but lacks details on behavioral traits such as error handling (e.g., for non-Chinese text), performance considerations, or output format. The description does not contradict annotations, but it fails to provide sufficient context for safe and effective use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. There is no wasted verbiage, and it efficiently communicates the core function. However, it could be slightly improved by structuring it to include usage context more explicitly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of text conversion and the lack of annotations and output schema, the description is incomplete. It does not explain what the tool returns (e.g., a string of initials, a list, or an error message), nor does it address edge cases or dependencies. For a tool with no structured output documentation, this leaves significant gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'text' parameter documented as 'Chinese text to get pinyin initials, separated by commas.' The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: converting Chinese field names to pinyin initials during table structure creation. It specifies the verb ('convert') and resource ('Chinese field names'), though it doesn't explicitly differentiate from sibling tools like get_table_desc or get_table_name, which appear to be related to table metadata but serve different functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance, only mentioning 'when creating table structures.' It does not specify when to use this tool versus alternatives (e.g., whether it's for database design, data migration, or other contexts), nor does it mention prerequisites or exclusions. This leaves the agent with little context for appropriate invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_table_descC

根据表名搜索数据库中对应的表结构,支持多表查询

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes要搜索的表名

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches for table structures and supports multi-table queries, but lacks details on permissions, rate limits, error handling, or output format. For a database query tool with zero annotation coverage, this is a significant gap in transparency about how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that conveys the core functionality without unnecessary words. It's front-loaded with the main purpose and includes an additional feature (multi-table query support). However, it could be slightly more structured by separating key points, but overall it's concise and to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a database query tool with no annotations and no output schema, the description is incomplete. It doesn't explain what '表结构' (table structures) includes (e.g., columns, data types, constraints), how results are returned, or any limitations. For a tool that likely returns detailed metadata, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'text' documented as '要搜索的表名' (table name to search). The description adds minimal value beyond this, only implying that multiple table names might be supported via '多表查询' (multi-table queries), but doesn't specify syntax or format. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: searching for table structures in a database by table name, with support for multi-table queries. It specifies the verb ('搜索' - search) and resource ('表结构' - table structures), making the function understandable. However, it doesn't explicitly differentiate from sibling tools like get_table_name or get_table_index, which likely serve related but distinct purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions support for multi-table queries but doesn't clarify scenarios where this is preferable over other tools like get_table_name (which might retrieve table names without structures) or execute_sql (which could query data directly). There's no mention of prerequisites, limitations, or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_table_indexC

根据表名搜索数据库中对应的表索引,支持多表查询

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes要搜索的表名

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches for table indexes and supports multi-table queries, but lacks details on permissions, rate limits, error handling, or what '多表查询' entails (e.g., how inputs are processed). This is insufficient for a tool that interacts with a database, leaving behavioral traits unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that conveys the core functionality without unnecessary details. It is front-loaded with the main purpose, though it could be slightly more structured to separate capabilities from constraints. Overall, it earns its place concisely.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of database operations, lack of annotations, and no output schema, the description is incomplete. It does not explain what the tool returns (e.g., index details, error formats), behavioral aspects like side effects, or how '多表查询' works. This leaves significant gaps for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'text' documented as '要搜索的表名' (table name to search). The description adds minimal value beyond this, only implying that multiple table names might be supported ('多表查询'), but without specifying format or syntax. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '根据表名搜索数据库中对应的表索引,支持多表查询' (search for table indexes in a database based on table names, supporting multi-table queries). It specifies the verb '搜索' (search) and resource '表索引' (table indexes), though it doesn't explicitly differentiate from sibling tools like get_table_desc or get_table_name, which might retrieve different metadata.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions '支持多表查询' (supports multi-table queries), which hints at a capability, but does not specify scenarios, prerequisites, or exclusions compared to siblings such as execute_sql or get_table_desc. This leaves the agent without clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_table_nameB

根据表中文名搜索数据库中对应的表名

ParametersJSON Schema
NameRequiredDescriptionDefault
textYes要搜索的表中文名

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions searching but doesn't describe how the search works (e.g., exact match, partial match, case sensitivity), what happens if no match is found (e.g., returns null, error), or any performance considerations like rate limits. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's function without unnecessary words. It is front-loaded with the core purpose and efficiently conveys the essential information, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a simple search with one parameter) and the lack of annotations and output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavior, error handling, and output format. For a tool with no structured metadata beyond the input schema, it should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'text' documented as '要搜索的表中文名' (Chinese table name to search for). The description adds no additional semantic details beyond what the schema provides, such as examples or constraints on the input format. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '根据表中文名搜索数据库中对应的表名' (search for corresponding table names in the database based on Chinese table names). It specifies the verb '搜索' (search) and resource '表名' (table names) with the input constraint '表中文名' (Chinese table names). However, it doesn't explicitly differentiate from sibling tools like 'get_table_desc' or 'get_table_index', which likely retrieve different metadata about tables.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools such as 'get_table_desc' (which might retrieve table descriptions) or 'get_table_index' (which might retrieve table indexes), nor does it specify prerequisites like database connectivity or access permissions. The usage context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedexecute_sql
    • First observedget_chinese_initials
    • First observedget_table_desc
    • First observedget_table_index
    • First observedget_table_name

TDQS

B3.1/5.0
Disambiguation3/5

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.

Naming Consistency5/5

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.

Tool Count4/5

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.

Completeness2/5

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

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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
  • A
    license
    B
    quality
    D
    maintenance
    Provides 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.
    9
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Multi-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
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables SQL queries, schema exploration, and Oracle sequence management across multiple databases including Oracle, OceanBase, and DolphinDB. Supports multiple environments with secure password handling.
    -

Latest Blog Posts

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