
Database Mcp Mysql
io.github.arifulislamat由 GitHub 账号 arifulislamat 发布v0.5.0更新于 Oct 24, 2026
MCP server for MySQL. Read-only by default, row caps, statement timeouts, secrets never logged.
概览
面向 MySQL 的本地 MCP 服务器,为 AI 助手提供两个受保护的工具来执行 SQL 和查看表结构,默认只读。
- 可以做什么
- 通过 execute_sql 对已配置的 MySQL 数据库执行 SQL 语句,默认启用只读模式、行数上限和语句超时。通过 search_objects 探索表结构:不带参数调用可列出表,传入表名可获取列、索引和外键。连接信息在启动时通过命令行参数、YAML 配置文件或环境变量设置,从不通过工具调用传入。
- 适用场景
- 适合助手需要在桌面上查询或探索 MySQL 数据库的场景,例如回答数据问题或查看表结构,并且希望使用只有两个工具、带有保守防护的轻量接口,而不是宽泛的数据库访问权限。
- 运行要求
- 以本地进程通过 stdio 运行;可通过 npm、PyPI(uvx)或 Rust 二进制安装。需要 MYSQL_HOST、MYSQL_DATABASE 和 MYSQL_USER,以及 MYSQL_PASSWORD 或挂载的密码文件。需要能访问 MySQL 主机的网络。仅限桌面端。
安装
在 SourceWeft 中
- 打开 控制台中的 Database Mcp Mysql,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
database-mcp
[CI] [License: MIT] [npm] [PyPI] [crates.io] [Node >= 22]
MCP servers that give AI clients safe, structured access to SQL databases.
One installable package per database engine, in TypeScript (npm), Python
(PyPI), and Rust (crates.io). Every package exposes the same minimal
two-tool surface, execute_sql and search_objects, with guardrails on by
default: read-only mode, row caps, and statement timeouts.
Packages
All three lines are published and pass the same language-agnostic conformance suite against real databases in CI, so behavior is identical regardless of language. Every engine is also listed on the MCP Registry with all three install options: npm, PyPI, and cargo.
Rust crates are named database-mcp-rs-<engine> because the plain names are
taken on crates.io; the command each one installs is still
database-mcp-<engine>. Go is planned.
Design principles
- Two tools, no more. A tiny tool surface keeps the model's context window
clean.
search_objectsprogressively discloses schema: call it with no arguments to list tables, with a table name to get columns, indexes, and foreign keys. - Safe by default. Read-only mode is enforced in two layers: a conservative SQL guard, plus a session-level read-only setting in the database itself. Rows are capped (default 1000) and statements time out (default 30s).
- Configured at launch, never via chat. Connection details come from flags, a YAML config file, or environment variables. Credentials are never accepted through a tool call.
- Secrets never appear in logs. Passwords live in non-printable secret types, DSNs are sanitized before logging, and a redaction filter guards the log boundary.
Quick start
Pick your engine's package; each README has the full config surface. SQLite via npm:
Or via PyPI: use "command": "uvx" and
"args": ["database-mcp-sqlite", "--dsn", "/absolute/path/to/database.db"].
Or as a native binary, with no Node or Python runtime: run
cargo install database-mcp-rs-sqlite, then use
"command": "database-mcp-sqlite" with the same args minus the package
name.
Flags, environment variables, and YAML config are identical across all three lines.
Networked engines take credentials from the environment (MYSQL_*,
MARIADB_*, POSTGRES_*/DATABASE_URL, LIBSQL_URL/LIBSQL_AUTH_TOKEN),
*_FILE mounted secrets, or a YAML file via --config. Never from a chat
prompt.
Contributing
See CONTRIBUTING.md. The short version: the conformance
suite is the definition of done. A change is mergeable only when
conformance/run.mjs passes against every affected server.
License
来源:README.md,提交 775af94
工具
0版本历史
2- v0.5.0最新Oct 17, 2026
- v0.4.2Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分