mysql-mcp

mysql-mcp is a skill for Claude Code, Codex from Kurok1/mcp-server-mysql. It costs 80 tokens per session (3,132 once invoked), scanned A, original, Apache-2.0.

A guarded set of tools for querying and changing MySQL databases, when the session has the required MySQL connection.

In plain words
What is it for?
Use it to inspect tables, run queries, execute approved data changes, run multi-step scripts, examine query plans, and view execution statistics.
Why use it?
It provides controlled database access with checks on SQL statements, tables, and read or write permissions, reducing accidental or unauthorized changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect tables, run queries, execute approved data changes, run multi-step scripts, examine query plans, and view execution statistics.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kurok1/mcp-server-mysql/mysql-mcp
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Kurok1/mcp-server-mysql --skill mysql-mcp
Clone the repo
git clone --depth 1 https://github.com/Kurok1/mcp-server-mysql

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mysql-mcp

README.md
[![agentmods](https://agentmods.dev/badge/skills/kurok1/mcp-server-mysql/mysql-mcp/github.svg)](https://agentmods.dev/skills/kurok1/mcp-server-mysql/mysql-mcp)
Your own site
<a href="https://agentmods.dev/skills/kurok1/mcp-server-mysql/mysql-mcp"><img src="https://agentmods.dev/badge/skills/kurok1/mcp-server-mysql/mysql-mcp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mysql-mcp

Your own site · 80×15
<a href="https://agentmods.dev/skills/kurok1/mcp-server-mysql/mysql-mcp"><img src="https://agentmods.dev/badge/skills/kurok1/mcp-server-mysql/mysql-mcp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,132 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00080 $0.03132
Opus 5.5 $0.00032 $0.01253
Sonnet 5.5 $0.00016 $0.00626
Haiku 4.5 $0.00008 $0.00313

Measured 1mo ago against content hash f779a6d09dda, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

mysql-mcp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mysql-mcp/SKILL.md · 130 lines

How it starts

The opening of the file, as written. The whole thing — 130 lines — stays where its author put it; the contents beside it link to each section on GitHub.

使用 mcp-server-mysql 查询与操作 MySQL

前置检查

本 skill 只适用于已连接 mcp-server-mysql 的会话。动手前先确认当前工具列表里确实存在 list_profile 和 mysql_query 等工具(客户端里通常带 mcp__<server名>__ 前缀,按后缀识别)。工具不存在时按常规方式完成数据库任务,或引导用户按仓库 README 配置连接。

这个 MCP server 是安全优先设计:每条 SQL 先过工业级 AST 解析校验(解析失败一律拒绝),读语句包在只读事务里执行,驱动层禁多语句。理解它的边界,你就能高效使用它;试图绕过只会浪费轮次。

心智模型

  • 一次操作绑定一个 profile。profile 是服务端配置的独立连接,拥有自己的默认库、连接池、安全规则、审计及统计。所有 mysql_* 工具都必填 profile;list_profile 无参数,返回按名称排序的 {profiles: [{name, description}]},只描述配置,不代表连接健康检查通过。
  • 默认只读、白名单默认全拒。能执行什么语句类型(allowed_statements)、能碰哪些表(table_whitelist)由所选 profile 的服务端配置决定,会话内无法更改。
  • DENIED 是边界,不是故障。收到 DENIED [规则名]: 原因 时,按下文对照表调整做法;同一条语句换个写法重试大概率还是拒(校验基于语义解析,注释、大小写、版本化注释 /*!...*/ 都藏不住东西)。
  • fail-closed。极个别 MySQL 边缘语法解析器不认时也会被拒(parse_error),这时换等价写法,而不是反复重试原句。
  • 需要放宽边界(加白名单、开写权限、调行数上限)时,如实告诉用户去改服务端 config.yaml 并重启 MCP,不要在 SQL 层想办法。

工具选择

任务 工具
发现可用连接名称与用途 list_profile
单条读查询(SELECT / SHOW / DESCRIBE / EXPLAIN) mysql_query
单条写语句(INSERT / UPDATE / DELETE / DDL,需服务端开启) mysql_execute
多条语句原子执行(全成或全回滚) mysql_script
看有哪些表可用 mysql_list_tables
看某张表的列结构 mysql_describe_table
分析单条 SELECT 的执行计划 mysql_explain
指定 profile 的执行统计(哪条最慢、拒了几条) mysql_stats

硬规则(违反必被拒)

  1. 一次一条语句。mysql_query / mysql_execute 只接受单语句;多条语句唯一的入口是 mysql_script。
  2. 读写分道。写语句走 mysql_query 会被 wrong_tool 拒,反之亦然。选工具本身就是意图声明。
  3. UPDATE / DELETE 必须带 WHERE(block_unfiltered_writes 默认开启)。这是防误操作护栏:若用户确实要全表操作,先向用户确认,再用能表达真实意图的条件(如主键范围)执行,不要默默加 WHERE 1=1 规避。
  4. 脚本内禁 DDL。MySQL 的 DDL 会隐式提交事务,破坏"全成或全回滚"承诺,所以 mysql_script 无条件拒 DDL——即使服务端开了 ddl 权限。DDL 单独用 mysql_execute 执行。
  5. 这些语句在任何工具里都不可用:SET、USE、GRANT、CALL、LOAD DATA、LOCK TABLES、BEGIN / COMMIT / ROLLBACK 等事务控制。跨库查询用 库名.表名 限定,不要 USE;需要事务用 mysql_script,不要手写 BEGIN/COMMIT。
  6. SELECT ... INTO OUTFILE / LOAD_FILE() 被永久禁止,没有开关,不要尝试。
  7. 只能访问白名单内的表。JOIN、子查询、CTE、INSERT ... SELECT 里涉及的每一张表都会被逐一校验,任何一张不在白名单整条拒。

Read the full file on GitHub · 130 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +13 lines · -107 tokens per session f779a6d09dda
  2. 2mo ago First seen · 117 lines · 187 tokens per session scan A 2ce2fac770e3

Subscribe to this mod's changes

mysql-mcp is a skill published in the GitHub repository Kurok1/mcp-server-mysql (2 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 80 tokens to every session and 3,132 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

mysql-mcp compared with skills from other repositories

mysql-mcp next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
mysql-mcpKurok1/mcp-server-mysqlSkill21mo agoApache-2.0A80Claude Code, Codex
create-prprisma/ormSkill48kyesterdayApache-2.0A48Claude Code, Codex
schema-explorationlangchain-ai/deepagentsSkill31ktodayMITA57Claude Code, Codex
atlas-mssqlariga/atlasSkill8.8k2d agoApache-2.0A163Claude Code
ha-data-storesshiwenwen/hope-agentSkill1.9kyesterdayMITA115Claude Code, Codex
nornicdb-cypher-queriesorneryd/NornicDBSkill924todayMITA79Claude Code, Codex
volcengine-rds-postgresqlbytedance/agentkit-samplesSkill484yesterdayApache-2.0A63Claude Code, Codex