# DBeast PostgreSQL MCP

Hooks an AI assistant up to PostgreSQL for schema browsing, read-only queries, security and performance audits.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 9
- Author: snss10
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/snss10/DBeast
- Updated: 2026-08-10
- HTML: https://affpapa.org/en/nevibecode/mcp/dbeast-postgresql-mcp

## What it does

DBeast is a local stdio MCP server written in Python. Your editor or desktop assistant spawns it as a child process, and the connection details arrive as environment variables: `DATABASE_URL`, `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`. There is no HTTP endpoint to host, so nothing new lands in your infrastructure.

Rather than one wide-open `execute_sql`, it ships 21 tools grouped into ten areas. `get_schema` and `dependency_analysis` map tables, columns and relationships; `execute_query` handles reads with a row cap applied for you; `analyze_query` and `query_optimizer` cover plans and index suggestions; `analyze_impact` previews what a write would touch; `security_audit` and `sensitive_data_scan` look at roles and likely PII; `maintenance_analysis`, `data_quality_report` and `replication_status` fill in the rest.

You need Python 3.11+ and PostgreSQL 12+. Two install routes exist: from source with `pip install -e .`, or the image `ghcr.io/snss10/dbeast:2.0.2`. The container path is the shorter one for Claude, Codex and Gemini CLI, where `claude mcp add`, `codex mcp add` and `gemini mcp add` carry the variables for you. Cursor, GitHub Copilot and Windsurf take a JSON block instead. Skip the credentials and the server has nothing to connect to.

## Requirements
- Needs: Docker
- Environment variables: `DATABASE_URL`, `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`, `AWS_SECRET_NAME`, `AWS_REGION` — keys and tokens: ask the human for the values, never commit them or put them in shared files.
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env DATABASE_URL=<DATABASE_URL> --env DB_HOST=<DB_HOST> --env DB_PORT=<DB_PORT> --env DB_USER=<DB_USER> --env DB_PASSWORD=<DB_PASSWORD> --transport stdio dbeast-postgresql-mcp -- docker run -i --rm -e DATABASE_URL -e DB_HOST -e DB_PORT -e DB_USER -e DB_PASSWORD ghcr.io/snss10/dbeast:2.0.2
```
Replace <…> with your own values. 3 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add dbeast-postgresql-mcp --env DATABASE_URL=<DATABASE_URL> --env DB_HOST=<DB_HOST> --env DB_PORT=<DB_PORT> --env DB_USER=<DB_USER> --env DB_PASSWORD=<DB_PASSWORD> -- docker run -i --rm -e DATABASE_URL -e DB_HOST -e DB_PORT -e DB_USER -e DB_PASSWORD ghcr.io/snss10/dbeast:2.0.2
```
Replace <…> with your own values. 3 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "dbeast-postgresql-mcp": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "DATABASE_URL",
                "-e",
                "DB_HOST",
                "-e",
                "DB_PORT",
                "-e",
                "DB_USER",
                "-e",
                "DB_PASSWORD",
                "ghcr.io/snss10/dbeast:2.0.2"
            ],
            "env": {
                "DATABASE_URL": "<DATABASE_URL>",
                "DB_HOST": "<DB_HOST>",
                "DB_PORT": "<DB_PORT>",
                "DB_USER": "<DB_USER>",
                "DB_PASSWORD": "<DB_PASSWORD>"
            }
        }
    }
}
```
Replace <…> with your own values. 3 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "dbeast-postgresql-mcp": {
            "type": "stdio",
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "DATABASE_URL",
                "-e",
                "DB_HOST",
                "-e",
                "DB_PORT",
                "-e",
                "DB_USER",
                "-e",
                "DB_PASSWORD",
                "ghcr.io/snss10/dbeast:2.0.2"
            ],
            "env": {
                "DATABASE_URL": "<DATABASE_URL>",
                "DB_HOST": "<DB_HOST>",
                "DB_PORT": "<DB_PORT>",
                "DB_USER": "<DB_USER>",
                "DB_PASSWORD": "<DB_PASSWORD>"
            }
        }
    }
}
```
Replace <…> with your own values. 3 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e DATABASE_URL=<DATABASE_URL> -e DB_HOST=<DB_HOST> -e DB_PORT=<DB_PORT> -e DB_USER=<DB_USER> -e DB_PASSWORD=<DB_PASSWORD> dbeast-postgresql-mcp docker run -i --rm -e DATABASE_URL -e DB_HOST -e DB_PORT -e DB_USER -e DB_PASSWORD ghcr.io/snss10/dbeast:2.0.2
```
Replace <…> with your own values. 3 more environment variables are in the server README

## When to use it
- map an unfamiliar database before touching it
- find out why a dashboard query drags
- see how many rows a bulk update would hit before running it
- check roles, grants and what the public schema exposes
- spot duplicate rows and null-heavy columns

## Example prompts
- Show me the schema for the `orders` table with its indexes
- Explain the execution plan for the dashboard query and suggest indexes
- Audit the public schema for security and maintenance issues

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [dbx](https://affpapa.org/en/nevibecode/mcp/dbx.md) — MCP server · ★ 27669
- [Metabase](https://affpapa.org/en/nevibecode/mcp/metabase.md) — MCP server · ★ 49845

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
