Fail-closed, read-only PostgreSQL and MongoDB access for AI agents over MCP.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
MCP
Read-only PostgreSQL & MongoDB access for coding agents.
Debug with real database context, without exposing write tools—even when your existing credentials allow writes. SafeSelect puts local, project-scoped policy between your agent and your data.
Get started → · Website · Compare approaches · DBeaver → Codex guide
Discover structure, inspect bounded rows, explain queries, and diagnose connectivity—without giving the agent write-capable tools or database credentials. Start with development data or a sanitized replica, then review the policy and effective database permissions before connecting to a more sensitive environment.
[!NOTE] SafeSelect is a safety boundary for agent access, not a replacement for database permissions. Use least-privilege database users when you can; SafeSelect still constrains overpowered credentials when agents connect through it.
Current backend support: PostgreSQL and MongoDB.
SafeSelect is intentionally narrower than general-purpose database MCP servers. It is not a tool builder, SQL workbench, or remote database gateway. It is a local safety boundary for agents that need database visibility, not database power.
| SafeSelect prioritizes | What this means |
|---|---|
| Local stdio transport | No network listener or open MCP port |
| Read-only tools | Agents do not receive write-capable database tools |
| Credential-independent safety | Even DBA credentials are constrained to SafeSelect's read-only tool surface |
| Fail-closed enforcement | Policy violations terminate the process |
| Secret isolation | Passwords stay in Keychain or environment variables |
| Project-scoped policy | Each repository defines its own allowed data surface |
| Embedded sidecar | One installed binary reaches JDBC and MongoDB drivers behind Rust policy |
The combination matters: PostgreSQL and MongoDB inspection, a fixed database read surface, local stdio, project policy, connection import and reproducible security evidence. Read-only modes and layered controls also exist in other projects; they are not exclusive to SafeSelect.
See the dated comparison for DBHub, MongoDB MCP Server, Postgres MCP Pro and SchemaBrain—including when each is a better fit.
Agents can look, but they cannot mutate through SafeSelect's database tools. This boundary does not cover a shell, another MCP server or direct credentials also available to the agent. Use least-privilege database users and review the threat model and limits.
| Backend | Status | Tools |
|---|---|---|
| PostgreSQL | Supported | Discovery, indexes/statistics, select, and explain |
| MongoDB | Supported | Discovery, find, aggregation, distinct/count, explain, profiling, schema inference, and anonymized fixtures |
The agent talks to SafeSelect through MCP stdio. SafeSelect enforces policy in Rust, stores secrets outside project files, and reaches databases through an embedded Java sidecar: JDBC for SQL backends and the MongoDB driver for MongoDB. The Rust to Java channel is JSON-lines over stdin/stdout: no sockets, no open ports.
Install SafeSelect from Homebrew, import an SSH-backed DBeaver connection,
keep the password in macOS Keychain, install the OpenCode integration, and see
the agent read a paid order while its DELETE attempt is rejected. Focused
agent and backend clips remain in the complete demo gallery.
Install SafeSelect with one of the following methods:
Download a platform-specific, prebuilt binary for macOS or glibc-based Linux
from the latest GitHub release.
The verified installer selects the matching macOS or glibc Linux architecture,
checks the published SHA-256 digest, and installs to ~/.local/bin:
Set PREFIX to choose another installation directory. SafeSelect still needs
a Java 17+ runtime at execution time.
After installing the binary, configure a project database and its MCP entry:
SafeSelect uses any available Java 17+ runtime rather than requiring a specific
package-manager formula. If Java is missing or too old, install or select a
Java 17+ runtime before running database commands. On macOS with Homebrew, you
can install one with brew install openjdk@17.
The generated MCP name defaults to safeselect-<project>-<environment>.
The generated MCP entry is a stdio server scoped to one project and environment:
SafeSelect uses each client's official MCP configuration contract, pins the
absolute repository path, and defaults to user scope. Add --local for a
project-scoped entry where the client supports it. See
AI agent integration for exact paths, scopes, and manual
configuration.
Clients that support MCP prompts can invoke read_only_database_debugging for a
safe investigation checklist. Clients can also read
safeselect://guide/read-only-database-debugging for the same static workflow
and boundary notes. Neither capability exposes database data, credentials, or
write access; use the database tools below for discovery and bounded reads.
Agents should use SafeSelect in this order:
database_infolist_tables then describe_table; inspect list_table_indexes or bounded statistics when useful for SQLlist_databases, list_collections, then discover_document_schema for NoSQLselect / explain, or the bounded MongoDB read tool that matches the taskcheck, connect, or reconnect when connectivity is staleAgents must discover relation or collection structure before querying unfamiliar data and use each discovery response's next_suggestion instead of guessing column or field names. SQL descriptions are catalog metadata; MongoDB schemas are inferred from a bounded, non-exhaustive sample.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/safeselect-mcp)<a href="https://allmcps.com/mcp/safeselect-mcp"><img src="https://allmcps.com/api/badge/safeselect-mcp?style=directory" alt="SafeSelect MCP on AllMCPs" /></a>