mysql-mcp

mysql-mcp is a skill for Claude Code, Codex from Kurok1/mcp-server-mysql. It costs 187 tokens per session (2,674 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 187 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,674 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.00187 $0.02674
Opus 5 $0.00093 $0.01337
Sonnet 5 $0.00037 $0.00535
Haiku 4.5 $0.00019 $0.00267

Measured 12d ago against content hash 2ce2fac770e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, 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 12d 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 · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 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 的会话。动手前先确认当前工具列表里确实存在 mysql_querymysql_* 工具(客户端里通常带 mcp__<server名>__ 前缀,按后缀识别)。如果没有这些工具:本 skill 不适用,不要凭本文档虚构调用它们——按常规方式完成数据库任务(如本地 mysql CLI),或建议用户按仓库 README 配置连接本 MCP 后再来。

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

心智模型

  • 默认只读、白名单默认全拒。能执行什么语句类型(allowed_statements)、能碰哪些表(table_whitelist)完全由服务端配置决定,会话内无法更改。
  • DENIED 是边界,不是故障。收到 DENIED [规则名]: 原因 时,按下文对照表调整做法;同一条语句换个写法重试大概率还是拒(校验基于语义解析,注释、大小写、版本化注释 /*!...*/ 都藏不住东西)。
  • fail-closed。极个别 MySQL 边缘语法解析器不认时也会被拒(parse_error),这时换等价写法,而不是反复重试原句。
  • 需要放宽边界(加白名单、开写权限、调行数上限)时,如实告诉用户去改服务端 config.yaml 并重启 MCP,不要在 SQL 层想办法。

工具选择

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

硬规则(违反必被拒)

  1. 一次一条语句mysql_query / mysql_execute 只接受单语句;多条语句唯一的入口是 mysql_script
  2. 读写分道。写语句走 mysql_query 会被 wrong_tool 拒,反之亦然。选工具本身就是意图声明。
  3. UPDATE / DELETE 必须带 WHEREblock_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 里涉及的每一张表都会被逐一校验,任何一张不在白名单整条拒。

推荐工作流

探索陌生库

mysql_list_tables(只显示白名单内的表,这就是你的全部可用面),再对目标表 mysql_describe_table,然后小步查询。不要跳过这两步直接猜表名——猜错的每一次都是 table_whitelist 拒绝。

读查询

  • 返回行数有硬上限(默认 1000),超限会截断并标注。统计问题用 COUNT / GROUP BY 等聚合,不要拉全表数行数。
  • 探索性查询主动带 LIMIT,既快又省上下文。
  • 查询有超时(默认 30s),大查询先用 mysql_explain 看看代价。

Read the full file on GitHub · 117 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. 12d 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 23d ago), licensed Apache-2.0. It adds 187 tokens to every session and 2,674 once invoked, about $0.0009 per session on Opus 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

Other skills, from other repositories

create-pr

Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for Prisma 8. Use when the user wants to create a pull request, open a PR, or submit changes for review.

prisma/orm · 48 tokens

schema-exploration

Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database. Use when the user asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.

langchain-ai/deepagents · 57 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

nornicdb-cypher-queries

Pick fast, predictable Cypher query shapes in NornicDB — point lookups, batch retrieval, pagination, search, traversal, batched UNWIND/MERGE writes, cleanup, multi-tenant isolation. Use when writing or reviewing Cypher whose latency or throughput matters; maps user intent to the executor's hot-path query templates.

orneryd/NornicDB · 79 tokens

supabase

Supabase / PostgREST Row-Level-Security playbook — pull the anon (or leaked servicerole) key out of the frontend JS, map tables from the auto-generated OpenAPI spec, test anonymous RLS READ disclosures (PII/secret leaks), and anonymous RLS WRITE abuse (insert/update/delete — e.g. forging…

PentesterFlow/agent · 120 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens