
SafeSelect MCP
io.github.antonillos由 GitHub 帳號 antonillos 發布v0.9.0更新於 Nov 7, 2026
Fail-closed, read-only PostgreSQL and MongoDB access for AI agents over MCP.
概覽
一個本機 MCP 伺服器,為編碼代理提供失敗即關閉、唯讀的 PostgreSQL 與 MongoDB 存取,用於除錯、檢視結構與查詢計畫。
- 可以做什麼
- 透過唯讀工具探索 PostgreSQL 與 MongoDB 的資料表、集合與索引,檢視結構與查詢計畫,結果有列數限制與逾時。從 DBeaver、Docker Compose 或 MongoDB Compass 匯入現有連線,包括透過 SSH 的連線。憑證保存在 macOS 鑰匙圈或環境變數中,而不是聊天裡。為 Codex、OpenCode、Claude Code、Cursor、Windsurf、GitHub Copilot 與 Gemini CLI 等編碼代理安裝並檢查伺服器。
- 適用情境
- 當編碼代理需要真實資料庫脈絡來排查缺陷、理解結構或審查查詢計畫,而且你不想暴露寫入工具時使用。適合已在 DBeaver、Docker Compose 或 Compass 中保存連線定義的團隊。
- 執行需求
- 透過 stdio 在本機執行,沒有網路監聽埠。需要 PostgreSQL 或 MongoDB 連線,以及用於資料庫指令的 Java 17+ 執行環境。密碼保存在 macOS 鑰匙圈或環境變數中。macOS 上透過 Homebrew 安裝,Linux 上使用預先建置的二進位檔。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 SafeSelect MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[圖片] SafeSelect
Read-only PostgreSQL & MongoDB access for coding agents.
Debug with real database context, without exposing write tools.
Import your existing connections. Keep credentials out of the chat.
Get started → · Demo · Agents · Security & quality · Docs · Website
[CI] [CRAP warnings] [License: MIT]
Why SafeSelect?
Give your coding agent the database context it needs to investigate a bug, understand a schema or inspect a query plan. SafeSelect exposes read-only tools for PostgreSQL and MongoDB, with local policy and bounded results.
- Debug with database context. Discover tables, collections and indexes before reading the rows or documents relevant to your task.
- Start with connections you already have. Import from DBeaver, Docker Compose or MongoDB Compass, including SSH-backed connections.
- Keep control of access. Set project-specific access rules, row limits and timeouts. Passwords stay in macOS Keychain or environment variables.
- Run locally. The agent connects over MCP stdio, with no MCP network listener. SafeSelect enforces its read-only tool surface even when the configured database credentials allow writes.
[!IMPORTANT] SafeSelect's read-only boundary covers its database tools. An agent's shell, other MCP servers and direct credentials remain outside that boundary. Use least-privilege database users and start with development data or a sanitized replica. See the threat model and limits.
See it in action
[SafeSelect onboarding: Homebrew, DBeaver SSH import, Keychain and OpenCode]
From Homebrew to a connected agent: import a DBeaver connection, keep its password in Keychain, and let OpenCode inspect an order through read-only tools. See the demo gallery for more clients, MongoDB and Linux onboarding.
Quick Start
Run setup from your repository root. You need a PostgreSQL or MongoDB connection and a Java 17+ runtime for database commands.
1. Install
On macOS with Homebrew:
For Linux, prebuilt binaries, asdf, Java setup or source builds, follow the installation guide.
2. Import a connection
Choose the source you already use:
Use your actual export or Compass directory, then follow the importer's driver and password setup steps. Keep secrets out of project files and chat. For a complete SSH-backed example, follow the DBeaver → Codex walkthrough.
3. Connect your agent
If you have multiple environments, add --environment <name> to both check
and agent install to select the intended database. Without it, check tests
all environments; installation only infers a target when there is exactly one.
Open or restart your agent and approve the MCP server if prompted. Installation
uses user scope by default; add --local for project scope where supported.
See client setup and scopes.
4. Try it
Ask your agent:
Use SafeSelect to identify the connected backend. For PostgreSQL, list tables and describe one using catalog metadata. For MongoDB, list databases and collections only. Stop before reading rows or sampling documents.
Success: the agent reports the database identity and available tables or collections without needing a database password in the conversation. Then ask it to investigate a specific issue with a small, targeted read. MongoDB schema inference samples documents, so include that step only when you are ready to read data.
Need help? Run safeselect doctor --environment <name> and follow its next
step. Diagnostics can contact the database. See the
connection diagnostics or
agent recovery guide.
Supported agents
OpenAI Codex · OpenCode · Claude Code · Cursor · Windsurf · GitHub Copilot · Gemini CLI
SafeSelect works with MCP clients over stdio. Built-in installation handles the
clients above; the integration guide covers configuration,
scopes and manual setup. Codex and OpenCode also receive four portable workflow
skills. After updating SafeSelect, run safeselect agent upgrade <client> and
reload your client.
Security and quality evidence
SafeSelect validates requests against project policy before database execution. Ordinary policy rejections return an error; serious security attempts and internal validation or audit failures stop the server. Result limits and timeouts bound reads, and query text is hashed for audit records.
The database security suites run against disposable PostgreSQL and MongoDB fixtures. Rejection cases check the expected error and compare the resulting database state with a baseline, so a rejected response alone is not enough to pass.
See how to verify a CI execution for results tied to a specific commit. Test source describes the checks; a successful matching run provides execution evidence. Pending or skipped suites are unverified, and badges can refer to a different revision.
Read the threat model and limits, the security model, or the architecture for the scope of these controls. For alternatives and tradeoffs, see the database MCP comparison.
Documentation
Feedback and contributions
Have a setup problem or a feature request? Open an issue. For setup feedback, include your client, OS and the step that failed; leave out credentials, connection exports and database contents. Report security vulnerabilities through the security policy.
Contributions are welcome—see Contributing to get started.
License
MIT.
來源:README.md,提交 98d4984
工具
0版本歷史
5- v0.8.0Oct 18, 2026
- v0.7.12Oct 8, 2026
- v0.7.11Oct 6, 2026
- v0.7.10Oct 6, 2026
- v0.7.9Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分