DBeast PostgreSQL MCP — Claude Code MCP server: setup and tools
Hooks an AI assistant up to PostgreSQL for schema browsing, read-only queries, security and performance audits.
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.2What DBeast PostgreSQL MCP 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.
What it helps with
- 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 for the agent
- Show me the schema for the
orderstable with its indexes - Explain the execution plan for the dashboard query and suggest indexes
- Audit the public schema for security and maintenance issues
How to install DBeast PostgreSQL MCP
Platform CLI
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.2Replace <…> with your own values. 3 more environment variables are in the server README
Platform CLI
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.2Replace <…> with your own values. 3 more environment variables are in the server README
Config file
{
"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
Config file
{
"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
Platform CLI
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.2Replace <…> with your own values. 3 more environment variables are in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about DBeast PostgreSQL MCP
How do I install DBeast PostgreSQL MCP in Claude Code?
Run `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`. Docker has to be installed and running.
What does DBeast PostgreSQL MCP do?
It gives the assistant a set of PostgreSQL tools: schema discovery, read queries, query and plan analysis, security and maintenance checks, and data quality reports.
Can it run arbitrary SQL?
Writes do not go through: execute_query accepts SELECT only and caps the row count itself. For changes there is analyze_impact, which reports affected rows and risk without executing anything.