
SafeSelect MCP
io.github.antonillosPublished by GitHub account antonillosv0.8.0Updated Oct 25, 2026
Fail-closed, read-only PostgreSQL and MongoDB access for AI agents over MCP.
Overview
A local MCP server that gives coding agents fail-closed, read-only access to PostgreSQL and MongoDB for debugging, schema inspection and query-plan review.
- What you can do
- Discover tables, collections and indexes, and inspect schemas and query plans in PostgreSQL and MongoDB through read-only tools with bounded results and timeouts. Import existing connections from DBeaver, Docker Compose or MongoDB Compass, including SSH-backed ones. Keep credentials in the macOS Keychain or environment variables instead of the chat. Install and check the server for supported coding agents such as Codex, OpenCode, Claude Code, Cursor, Windsurf, GitHub Copilot and Gemini CLI.
- When to use it
- Use it when a coding agent needs real database context to investigate a bug, understand a schema or review a query plan, and you want to avoid exposing write tools. It suits teams that already have connection definitions in DBeaver, Docker Compose or Compass.
- Requirements
- Runs locally over stdio with no network listener. Needs a PostgreSQL or MongoDB connection and a Java 17+ runtime for database commands. Passwords are kept in the macOS Keychain or environment variables. Installation is via Homebrew on macOS or prebuilt binaries on Linux.
Installation
In SourceWeft
- Open SafeSelect MCP in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
[Image] 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.
Source: README.md at commit 98d4984
Tools
0Version history
5- v0.8.0LatestOct 18, 2026
- v0.7.12Oct 8, 2026
- v0.7.11Oct 6, 2026
- v0.7.10Oct 6, 2026
- v0.7.9Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts