# DBeast PostgreSQL MCP [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/snss10/DBeast  
**GitHub Stars:** 9  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/dbeast-postgresql-mcp

## Description
PostgreSQL MCP server for schema, query, health, security, and performance analysis.

## Tools
Capabilities this server exposes over MCP:

- **connect** — Connect to PostgreSQL, check current status, or discover local databases
- **disconnect** — Close the current database connection
- **health_check** — Verify connectivity, pool health, PostgreSQL version, and extensions
- **get_schema** — List schemas, tables, columns, indexes, relationships, and optional Mermaid ERDs
- **dependency_analysis** — Map object dependencies before renaming, dropping, or changing database objects
- **execute_query** — Run read-only `SELECT` queries with automatic row-limit injection
- **analyze_query** — Parse and inspect query structure, warnings, and optimization hints
- **query_optimizer** — Recommend indexes and rewrites for a given query
- **analyze_impact** — Preview write-query impact, risk level, affected rows, and rollback context without executing
- **database_health** — Review cache hit rates, connections, transaction age, table health, and overall health signals
- **query_performance** — Report slow or expensive queries from PostgreSQL statistics
- **security_audit** — Inspect roles, privileges, superuser accounts, and public schema exposure
- **sensitive_data_scan** — Detect likely PII or secrets by column names and schema patterns
- **maintenance_analysis** — Review vacuum status, dead tuples, analyze timestamps, and index health
- **partition_analysis** — Inspect partition health, row distribution, and missing partition risks
- **data_quality_report** — Analyze null rates, cardinality, value distributions, and outliers
- **duplicate_detection** — Find duplicate rows across selected key columns
- **configuration_review** — Review PostgreSQL configuration and tuning opportunities
- **replication_status** — Inspect replication lag, WAL sender/receiver state, and replication slots
- **get_audit_logs** — Retrieve logged MCP tool calls for a given date
- **list_audit_files** — List available audit log files

## 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/snss10/DBeast), copied verbatim. Run them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/snss10/DBeast.git
```

2. Install:

```sh
cd DBeast
```

3. Install:

```sh
pip install -e .
```

4. Check the setup:

```sh
dbeast
```

5. Start the server:

```sh
python src/server.py
```

## Documentation

## What DBeast PostgreSQL MCP does

DBeast PostgreSQL MCP MCP server exposes focused PostgreSQL operations through the Model Context Protocol. It is intended for database inspection, read-only data access, query review, and operational analysis rather than unrestricted SQL execution. The server can connect to local PostgreSQL installations and hosted PostgreSQL services, including RDS or Aurora, Supabase, Neon, Railway, Render, and Fly.io when provided with a suitable connection method.

The tool set covers connection management, schema discovery, dependency mapping, query analysis, database health, security, maintenance, partitioning, data quality, replication, configuration, and audit-log access. Schema inspection can include tables, columns, indexes, relationships, and optional Mermaid ERDs. Sensitive-data scanning identifies likely PII or secrets from column names and schema patterns; it does not claim to classify data with certainty.

## How it works

The DBeast PostgreSQL MCP MCP server runs locally as a Python stdio MCP server. An MCP client starts it as a subprocess, passes connection settings through environment variables or tool arguments, and receives structured results after the server queries PostgreSQL with asyncpg. No HTTP service or separate server infrastructure is required.

`execute_query` accepts read-only `SELECT` queries and automatically applies a row limit. `analyze_impact` examines a write query for affected rows, risk, and rollback context without executing it. Other analysis tools query PostgreSQL metadata and statistics to produce reports about performance, privileges, vacuum state, partitions, replication, configuration, and data quality.

A practical workflow is to discover the schema first, run bounded read queries, preview potentially risky changes, and then inspect health or maintenance indicators. Audit tools can retrieve logged MCP calls for a date and list available audit files.

## Setup and configuration

Install the repository in editable mode with `pip install -e .`, then start it with `dbeast` or `python src/server.py`. Configure the MCP client with a stdio entry whose command points to the server or its source entry point. Cursor, Windsurf, VS Code, and Claude Desktop configuration examples are provided by the project.

Use `DATABASE_URL` for a complete PostgreSQL connection string, or provide `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`, and optionally `DB_SSLMODE`. Runtime connection arguments can also supply a URL or individual connection fields. AWS Secrets Manager connections use a secret name and AWS region. The documented tuning variables include `DBEAST_DEFAULT_ROW_LIMIT`, `DBEAST_QUERY_TIMEOUT`, `DBEAST_COMMAND_TIMEOUT`, `DBEAST_SSL_VERIFY`, and `DBEAST_SCHEMA_CACHE_TTL`.

## Tools and capabilities

- Connect, disconnect, check connectivity, inspect the connection pool, and discover local databases.
- List database structure and dependencies, including optional Mermaid relationship diagrams.
- Execute bounded read-only queries and inspect query structure, warnings, indexes, and rewrite suggestions.
- Review cache rates, connections, transaction age, slow queries, vacuum state, dead tuples, and index health.
- Inspect roles, privileges, superusers, public-schema exposure, likely sensitive columns, and PostgreSQL configuration.
- Analyze partitions, replication lag, WAL sender and receiver state, replication slots, null rates, cardinality, distributions, outliers, and duplicate rows.

## Limitations and notes

The server is designed around PostgreSQL 12 or later and uses a local stdio deployment model. `execute_query` is limited to read-only SELECT statements, while `analyze_impact` previews write-query effects without performing the write. Analysis results depend on the metadata, statistics, permissions, and extensions available to the connected PostgreSQL account. The project is licensed under MIT.

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

