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.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

一个本地 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 上使用预编译二进制文件。
安装前请注意
只读边界仅覆盖其数据库工具;代理的 shell、其他 MCP 服务器和直接凭据不在其中,因此应使用最小权限的数据库用户和开发或脱敏数据。诊断和检查可能打开 SSH 隧道并连接数据库,MongoDB 结构推断会抽样文档。不要把机密放入项目文件或聊天中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 SafeSelect MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

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:

bash
brew install antonillos/tap/safeselect

For Linux, prebuilt binaries, asdf, Java setup or source builds, follow the installation guide.

2. Import a connection

Choose the source you already use:

Connection sourceCommand
DBeaver exportsafeselect import-dbeaver ~/Downloads/dbeaver-export.zip
PostgreSQL in Docker Composesafeselect import-compose
MongoDB Compasssafeselect import-compass --path "$HOME/.config/MongoDB Compass"

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

bash
# Verify connectivity; this can open SSH tunnels and contact databases.safeselect check
# Replace codex with opencode, or choose another supported client below.safeselect agent install codexsafeselect agent status

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.

What is checkedInspect the evidence
SQL writes, stacked statements and side-effecting functionsPostgreSQL security tests
MongoDB write stages, server-side JavaScript and access boundariesMongoDB security tests
Malformed MCP requests, policy rejection and shutdown behaviorMCP regression tests
Rust and Java complexity with test coverageCRAP report and CI artifacts
Commit signatures and message formatCommit Policy

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

I want to…Start here
Install, update or uninstallInstallation guide
Set up my coding agentAI agent integration
Import an SSH-backed DBeaver connectionDBeaver → Codex walkthrough
Watch examplesDemo gallery · Visual command gallery
Find a command or MCP toolCLI reference · MCP tools
Configure policy, environments or passwordsConfiguration
Understand the security boundaryThreat model and limits · Architecture
Inspect quality checks and security testsCI and CRAP report · Security test suite
Find packages and directory listingsDistribution
Build or contributeContributing · Changelog

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
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

5
  1. v0.8.0Oct 18, 2026
  2. v0.7.12Oct 8, 2026
  3. v0.7.11Oct 6, 2026
  4. v0.7.10Oct 6, 2026
  5. v0.7.9Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分