DEV Community

SN
SN

Posted on

I built DBeast: a PostgreSQL MCP server that gives AI assistants DBA-level tools

AI assistants can write SQL.

But writing SQL is only a small part of working with a real database.

Most database work is investigation:

  • What tables exist?
  • How are they related?
  • Why is this query slow?
  • Which indexes are unhealthy?
  • Is autovacuum keeping up?
  • Are there risky permissions?
  • Which columns may contain sensitive data?
  • What would happen if we changed or deleted this data?

That is what I built DBeast for.

DBeast is a PostgreSQL MCP server that gives AI assistants structured DBA-style tools for understanding, analyzing, and troubleshooting PostgreSQL databases.

GitHub: https://github.com/snss10/DBeast

Why I built it

A lot of AI database integrations start with a simple tool:

execute_sql(query)
Enter fullscreen mode Exit fullscreen mode

That is useful, but it is also incomplete.

A good database assistant should not just run SQL.

It should help you reason about the database.

It should inspect schemas, explain query plans, identify maintenance issues, detect security risks, analyze data quality, and help you understand the impact of changes before you make them.

That is the idea behind DBeast.

What DBeast does

DBeast exposes 21 MCP tools for PostgreSQL across areas like:

  • Schema discovery
  • ERD generation
  • Safe SELECT query execution
  • Query analysis
  • Query optimization hints
  • Write-impact previews
  • Database health checks
  • Maintenance analysis
  • Index and vacuum insights
  • Security audits
  • Sensitive data detection
  • Data quality reports
  • Duplicate detection
  • Replication monitoring
  • PostgreSQL configuration review
  • Audit logging

Instead of giving the assistant one giant database tool, DBeast gives it focused tools that map to real DBA workflows.

The bigger idea

I do not want AI assistants to be just SQL autocomplete.

I want them to become useful database copilots.

With DBeast, you can ask things like:

Show me how the sales schema is structured and generate an ERD.
Enter fullscreen mode Exit fullscreen mode
Investigate why this dashboard query is slow and suggest indexes.
Enter fullscreen mode Exit fullscreen mode
Review the public schema for maintenance issues, security risks, and data quality problems.
Enter fullscreen mode Exit fullscreen mode
Compare table bloat, dead tuples, and index health across all schemas.
Enter fullscreen mode Exit fullscreen mode
Find columns that may contain sensitive customer data.
Enter fullscreen mode Exit fullscreen mode
Check replication lag and tell me if anything looks unhealthy.
Enter fullscreen mode Exit fullscreen mode

That is much more useful than just:

Run this SQL.
Enter fullscreen mode Exit fullscreen mode

Safety still matters

DBeast is designed to be safe by default.

SELECT queries can run with automatic row limits.

But write operations like:

  • INSERT
  • UPDATE
  • DELETE
  • DROP
  • TRUNCATE

are not executed directly.

They are analyzed as impact previews.

So instead of blindly running a risky query, your assistant can tell you:

  • what tables may be affected
  • how many rows may change
  • whether related objects are involved
  • what the risk level looks like
  • what you should review first

The human stays in control.

How it works

DBeast runs as a local MCP server.

AI assistant  ->  DBeast MCP server  ->  PostgreSQL
Enter fullscreen mode Exit fullscreen mode

Your assistant talks to DBeast through the Model Context Protocol. DBeast talks to PostgreSQL using asyncpg.

It works with:

  • Local PostgreSQL
  • Docker PostgreSQL
  • AWS RDS / Aurora
  • Supabase
  • Neon
  • Railway
  • Render
  • Fly.io
  • SSH tunnels
  • AWS Secrets Manager

Quick start

git clone https://github.com/snss10/DBeast.git
cd DBeast
pip install -e .
Enter fullscreen mode Exit fullscreen mode

Example MCP config:

{
  "mcpServers": {
    "dbeast": {
      "type": "stdio",
      "command": "python",
      "args": ["/absolute/path/to/DBeast/src/server.py"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Then ask your assistant about your database.

Who this is for

DBeast may be useful if you:

  • use PostgreSQL
  • use Cursor, Claude Desktop, Windsurf, or another MCP client
  • want AI help understanding a database
  • want query and performance analysis
  • want safer database workflows
  • want a local tool instead of a hosted database agent

What I’m looking for

This is an early release, and I would love feedback from:

  • PostgreSQL users
  • DBAs
  • backend engineers
  • MCP builders
  • people experimenting with AI developer tools

I’m especially interested in:

  • what database workflows you would want next
  • whether setup is clear
  • what safety checks would make this more trustworthy
  • which MCP clients you want first-class examples for

GitHub: https://github.com/snss10/DBeast

Top comments (0)