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 分