DB MCP Server
io.github.stucchi由 GitHub 账号 stucchi 发布v1.2.1更新于 Oct 24, 2026
Database MCP server for MySQL, PostgreSQL, MongoDB, and SQLite with SSH tunneling support.
概览
本地 MCP 服务器,让助手查询 MySQL、PostgreSQL、MongoDB 或 SQLite 数据库,并在读写模式下修改数据,可选经 SSH 隧道连接。
- 可以做什么
- 在 MySQL、PostgreSQL 和 SQLite 上执行只读 SQL 查询并查看结果,或在 MongoDB 集合中查找文档并运行聚合管道(只读模式下阻止 $out/$merge)。列出表或集合,并描述表结构或集合统计信息。显示连接状态与信息。启用读写模式后可执行 INSERT、UPDATE、DELETE 等写入 SQL。MySQL 和 PostgreSQL 可经 SSH 堡垒机连接,远程 SQLite 文件会先通过 SFTP 下载再查询。
- 适用场景
- 适合让助手探查数据库结构、基于实时数据回答问题,或在不另开客户端的情况下做受控的数据修改。适用于本地桌面环境,包括只能通过堡垒机访问的数据库。
- 运行要求
- 以 Python 包形式通过 uvx 在本地运行,需要 Python/uv 运行环境。每个实例连接一个数据库。需设置 DB_TYPE 和 DB_DATABASE,并按需设置 DB_HOST、DB_PORT、DB_USER;MySQL 和 PostgreSQL 需要 DB_PASSWORD,MongoDB 需要 DB_URL,SQLite 需要 DB_PATH。使用 SSH 隧道需设置 SSH_HOST 并提供 SSH_KEY 或 SSH_PASSWORD。需要能访问数据库或堡垒机的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 DB MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
db-mcp-server
MCP server for MySQL, PostgreSQL, MongoDB, and SQLite databases. One instance per database, no Docker required.
Installation
Configuration
Configure via environment variables. Each instance connects to a single database.
MySQL
PostgreSQL
MongoDB
SQLite
SSH Tunnel (MySQL / PostgreSQL)
Optionally connect through an SSH bastion host. Set SSH_HOST to activate.
For SQLite over SSH, the remote .db file is downloaded via SFTP before querying. In read-write mode, changes are uploaded back on shutdown.
At least one of SSH_KEY or SSH_PASSWORD is required when SSH_HOST is set. SSH tunneling is not supported for MongoDB.
Usage in .mcp.json
SQLite (local)
SQLite over SSH
With SSH tunnel
For multiple databases, add multiple instances:
Tools
MySQL
- query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
- execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires
DB_MODE=read-write - describe — Describe table structure
- list_tables — List all tables
- status — Show connection info
PostgreSQL
- query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
- execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires
DB_MODE=read-write - describe — Describe table structure (column info from information_schema)
- list_tables — List all tables in the public schema
- status — Show connection info
SQLite
- query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
- execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires
DB_MODE=read-write - describe — Describe table structure (PRAGMA table_info)
- list_tables — List all tables
- status — Show connection info
MongoDB
- query — Find documents in a collection
- describe — Collection stats ($collStats)
- list_collections — List all collections
- aggregate — Execute aggregation pipelines ($out/$merge blocked on read-only)
- status — Show connection info
License
MIT
来源:README.md,提交 c45f307
工具
0版本历史
1- v1.2.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分