MySQL Ops MCP

io.github.GT-dinuo由 GitHub 账号 GT-dinuo 发布v1.0.0更新于 Oct 24, 2026

MySQL MCP server: browse schema, query, CRUD. Delete/drop gated by user approval.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

本地 MCP 服务器,让 AI 助手浏览 MySQL 库表结构、执行 SELECT 查询和增删改操作,DELETE 与 DROP 需用户确认。

可以做什么
  • 列出数据库和数据表,查看表的字段与类型
  • 获取表的完整信息,包括索引、DDL 和统计信息
  • 对任意数据库执行 SELECT 查询
  • 创建表、插入和更新数据,每个工具只接受对应的 SQL 语句
  • 删除数据或删除表,每次都需要客户端确认
  • 通过通用 execute_sql 工具执行任意自定义 SQL
适用场景
适合在 Claude Code、Cursor、Codex 等桌面客户端中用自然语言探索和修改 MySQL 数据库,例如查看表结构、编写查询或做少量数据变更。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js 18 或更高版本。需要可访问的 MySQL 服务器和凭据,通过环境变量 DB_HOST、DB_PORT、DB_USER、DB_PASSWORD、DB_DATABASE 提供;这些均为可选,默认 localhost、3306、root 且无默认数据库。
安装前请注意
服务器需要 MySQL 密码(DB_PASSWORD),该密码以明文写在客户端配置文件中,务必不要提交到版本库。具备写入能力:create_table、insert、update、delete_data、drop_table 和 execute_sql 都会改动数据,其中 execute_sql 可执行任意 SQL,不受按工具校验语句类型的限制。删除与删表的确认依赖客户端执行工具调用确认。建议使用最小权限账号而非 root。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MySQL Ops MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

MySQL Ops MCP

English | 简体中文

[npm version] [License: MIT] [Node.js] [MCP] [GitHub stars]

A MySQL database MCP Server. Let AI tools like Claude Code / Cursor / Codex talk to your MySQL databases in natural language — browse databases and tables, inspect schemas, run queries, and perform CRUD operations, with destructive operations (DELETE / DROP) gated behind explicit user approval.

Features

  • 🗄️ Schema browsing: list databases, list tables, describe table structure, full table info (indexes, DDL, stats)
  • 🔍 Queries: run SELECT queries against any database
  • ✏️ CRUD: create tables, insert, update — with SQL-statement validation per tool
  • 🔐 Approval-gated destructive ops: delete_data and drop_table always require explicit user confirmation in the client
  • 🔌 Zero install: runs via npx, configured entirely through environment variables

Installation

Requires Node.js 18+. No clone or build needed — npx fetches and runs the published npm package on first use (see the config below).

To build from source instead (e.g. for development):

bash
git clone https://github.com/GT-dinuo/mysql-ops-mcp.gitcd mysql-ops-mcpnpm installnpm run build

Build output goes to dist/; the entry point is dist/index.js.

Configuration

In each project where you want to use this tool, create (or append to) .mcp.json:

json
{  "mcpServers": {    "mysql": {      "command": "npx",      "args": ["-y", "mysql-ops-mcp"],      "env": {        "DB_HOST": "localhost",        "DB_PORT": "3306",        "DB_USER": "root",        "DB_PASSWORD": "your_password",        "DB_DATABASE": "your_database"      }    }  }}

If you built from source, point the command at the local build instead: "command": "node", "args": ["/absolute/path/to/mysql-ops-mcp/dist/index.js"].

Environment Variables

VariableRequiredDescription
DB_HOSTNoMySQL host, default localhost
DB_PORTNoMySQL port, default 3306
DB_USERNoMySQL user, default root
DB_PASSWORDNoMySQL password
DB_DATABASENoDefault database; if omitted, pass database per tool call

Usage

Once configured, just ask in natural language in your AI tool:

List all databasesShow the structure of the users tableQuery the 10 most recent ordersGet full info for the users table — indexes and DDL includedInsert a test record into the users tableDelete the test record you just inserted   ← the client will ask for your approval first

Destructive operations (delete_data, drop_table) are always confirmed by the MCP client before execution — nothing irreversible happens silently.

Tool List

ToolDescription
list_databasesList all databases
list_tablesList tables in a database
describe_tableShow table columns and types
get_table_infoFull table details: columns, indexes, DDL, stats
queryRun a SELECT query
create_tableCreate a table (CREATE TABLE only)
insertInsert rows (INSERT only)
updateUpdate rows (UPDATE only)
delete_dataDelete rows — requires user approval
drop_tableDrop a table — requires user approval
execute_sqlRun any custom SQL statement

Security

  1. Destructive operations require approval: delete_data and drop_table are gated by the MCP client's tool-call confirmation — approve or reject each one.
  2. Statement validation: each write tool only accepts its own SQL verb (e.g. query rejects anything but SELECT).
  3. Use a least-privilege account: don't connect as root in production — create a MySQL user scoped to the databases the AI may touch.
  4. Never commit credentials: .env / .mcp.json with real passwords must stay out of version control (.gitignore already covers .env).

Testing the Connection

After configuring .env (copy from env.example), you can verify connectivity before wiring up the client:

bash
cp env.example .env   # fill in real credentialsnpm run test-connection

Development

bash
npm run dev    # watch mode, recompiles on changenpm run build  # build to dist/npm start      # run the built Server

License

MIT © 2026 mysql-ops-mcp

来源:README.md,提交 295b862

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分