
Universal Db Mcp
io.github.Fashad-Ahmed由 GitHub 帳號 Fashad-Ahmed 發布v1.1.2更新於 Oct 24, 2026
Security-first MCP server for PostgreSQL, SQLite, MySQL, DuckDB with SQL injection prevention.
概覽
在本機執行、預設唯讀的 MCP 伺服器,讓助理檢視資料表結構並對 PostgreSQL、MySQL、SQLite 與 DuckDB 執行受防護的 SQL。
- 可以做什麼
- 對已設定的資料庫執行 SQL 查詢,預設唯讀,具備注入偵測與列數上限,也可選擇僅試執行或查看執行計畫而不實際執行。檢視資料表與欄位結構,列出已設定的資料庫並檢查連線狀態與版本。查看最近 100 筆已執行查詢,並擷取結構快照以比對結構變動。查詢本機 SQLite 檔案與行程內 DuckDB,包括記憶體中的分析。
- 適用情境
- 適合讓助理以自然語言探索或查詢關聯式與分析型資料庫,尤其是無需架設伺服器的本機 SQLite 或 DuckDB 檔案,同時預設阻擋寫入。
- 執行需求
- 以 Python 套件在本機執行(uvx 或 pip)。至少需要一項連線設定:POSTGRES_URI、MYSQL_URI、SQLITE_PATH 或 DUCKDB_PATH。選用設定包括 ALLOW_DESTRUCTIVE、MAX_RESULT_ROWS 與唯讀開關。僅連線遠端 PostgreSQL 或 MySQL 時需要網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Universal Db Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Universal Database MCP Server
The security-first, Python-native MCP server for database access from AI agents.
[CI] [PyPI] [Python 3.10+] [FastMCP] [License: MIT]
[Demo: schema discovery, a real query, a blocked DROP, and dry-run mode]
Why This Exists
Most database MCP servers give AI agents raw SQL access and hope for the best. This server assumes the LLM is untrusted input and applies 8 layers of injection prevention before any query reaches your database — including blocking UNION attacks, stacked statements, time-based injection, and comment bypasses.
Supports: PostgreSQL · SQLite · MySQL · DuckDB (columnar analytics)
Zero Setup: Works on Your Laptop Right Now
No Docker. No cloud account. No database server to install. DuckDB and SQLite run in-process:
Add to Claude Code in ~/.claude/mcp_servers.json, or to Claude Desktop in
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) /
%APPDATA%\Claude\claude_desktop_config.json (Windows):
Restart Claude Desktop / Claude Code after saving — that's it.
That's it. Claude Code discovers the tools automatically.
More client configs (Claude Desktop, Cursor, Windsurf, Docker) in
examples/.
Security Model: 8 Layers
Read-only by default. Defense-in-depth. Every query validated before it touches the driver.
Full threat model: docs/SECURITY.md
DuckDB: Analytics Without Infrastructure
DuckDB runs in-process (no server) and reads Parquet, CSV, JSON natively. Connect AI agents to your analytics data without spinning up a warehouse:
Then in Claude Code:
Natural Language → SQL
No separate NL-to-SQL tool needed — Claude already does this. Give it the
schema tool and ask in plain English:
Pair with dry_run: true (DRYRUN=true) while prototyping — Claude gets the
query plan back without anything executing.
Docker
See examples/docker_mcp_config.json for
wiring this into an MCP client.
All Databases
MCP Tools
v1.1.0: dry-run mode (DRYRUN=true), table allowlists (WHITELISTED_TABLES), query
complexity warnings, structured audit logs, and a --check CLI flag for connectivity
validation. See CHANGELOG.md.
Configuration
Secure Database Users
Always use a dedicated read-only account. Never give the MCP server credentials that can modify data.
PostgreSQL:
MySQL:
Development
Architecture
vs. Google MCP Toolbox
Different tools for different jobs. Use this when you want Python-native, local-first, security-hardened access without cloud dependencies.
License
MIT — LICENSE
Security Notice: This server provides AI agents with database access. Always
use read-only credentials, review docs/SECURITY.md before
production deployment, and never commit .env files.
來源:README.md,提交 7581347
工具
0版本歷史
1- v1.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。