# SafeSelect MCP [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/antonillos/safeselect  
**GitHub Stars:** 0  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/safeselect-mcp

## Description
Fail-closed, read-only PostgreSQL and MongoDB access for AI agents over MCP.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/antonillos/safeselect), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
brew install antonillos/tap/safeselect
```

2. Add to your MCP client:

```sh
safeselect agent install codex
```

## Documentation

## What SafeSelect MCP does

SafeSelect MCP gives coding agents a constrained, read-only view of PostgreSQL and MongoDB databases through MCP. Its database tools are intended for debugging, schema inspection, query investigation, and targeted data reads. PostgreSQL support includes catalog-oriented discovery such as listing tables and describing table metadata. MongoDB support includes listing databases and collections, with schema inference available by sampling documents.

The server keeps database access local: agents connect through MCP stdio rather than to an MCP network listener. Its read-only tool boundary remains in place even if the configured database account has write privileges. That boundary applies to SafeSelect's database tools only; an agent's shell, other MCP servers, and separately exposed credentials are outside it.

## How it works

SafeSelect validates requests against project policy before sending them to the database. Policies can define project-specific access rules, row limits, and timeouts. Reads are bounded, and query text is hashed for audit records. Ordinary policy violations return errors, while serious security attempts and internal validation or audit failures stop the server.

The security test suites use disposable PostgreSQL and MongoDB fixtures. They exercise SQL writes, stacked statements, side-effecting functions, MongoDB write stages, server-side JavaScript, malformed MCP requests, and access boundaries, then compare rejected-operation results with a database baseline.

## Setup and configuration

A Java 17 or newer runtime is required for database commands. On macOS, install the command-line application with Homebrew:

```bash
brew install antonillos/tap/safeselect
```

Connections can be imported from several existing sources:

- `safeselect import-dbeaver ~/Downloads/dbeaver-export.zip`
- `safeselect import-compose`
- `safeselect import-compass --path "$HOME/.config/MongoDB Compass"`

Passwords can remain in macOS Keychain or environment variables instead of project files or agent conversations. Imported DBeaver connections can include SSH-backed configurations. Interactive import supports cancellation and saves the batch only after final confirmation.

Use `safeselect check` to verify connectivity; this may open SSH tunnels and contact the database. Install the MCP configuration for a client with `safeselect agent install <client>`, then inspect it with `safeselect agent status`. The `--environment <name>` option selects a database environment, and `--local` requests project scope where supported. `safeselect doctor --environment <name>` provides the next diagnostic step when setup fails.

## Tools and capabilities

- Exposes read-only PostgreSQL database access.
- Exposes read-only MongoDB database access.
- Discovers tables, collections, indexes, and database metadata.
- Supports targeted row and document reads with bounded results.
- Applies access policies, read limits, and timeouts before execution.
- Imports connections from DBeaver, Docker Compose, and MongoDB Compass.

## Limitations and notes

SafeSelect does not make an agent's other capabilities read-only. Shell commands, other MCP servers, and direct database credentials remain outside its database boundary. Least-privilege database accounts are recommended, along with development data or a sanitized replica.

MongoDB schema inference samples documents, so using that feature reads data. Connectivity checks and diagnostics also contact the configured database. The local stdio design means SafeSelect does not provide an MCP network listener.

Built-in agent installation supports OpenAI Codex, OpenCode, Claude Code, Cursor, Windsurf, GitHub Copilot, and Gemini CLI. Codex and OpenCode also receive four portable workflow skills. After updating SafeSelect, run `safeselect agent upgrade <client>` and reload the client.

_Full upstream README: https://allmcps.com/mcp/safeselect-mcp/readme_

