dba-checkup-mcp
Provides read-only PostgreSQL health-check tools for inspecting active sessions, blocking locks, top queries, storage, index health, maintenance and vacuum status, replication/WAL archiving, and overall database health.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
dba-checkup-mcp
Read-only database health checks for AI assistants, over the Model Context Protocol.
Point Claude (or any MCP client) at a PostgreSQL database and ask "is anything wrong with this database?". Instead of letting the model write SQL against production, this server gives it a fixed set of checks a DBA would run: blocking locks, long-running and idle-in-transaction sessions, top statements, invalid and unused indexes, tables that need an index, dead rows and transaction ID wraparound, WAL archiving and replication slots. Every check explains what it found in plain words, most serious first.
Built by a DBA with 20+ years of Oracle, SQL Server and PostgreSQL production support.
Why fixed checks instead of free-form SQL
Nothing can change. Every statement runs inside a
READ ONLYtransaction, on a session that defaults to read-only, with a statement timeout. A test proves writes are refused, even with a superuser login.No surprise queries. The model picks from known checks; it never writes SQL against your database. The optional
explain_querytool only plans a single SELECT (EXPLAIN without ANALYZE) and is off unless you turn it on.Customer data stays out of the chat. Statement text is masked by default: every string and number literal becomes
?, soWHERE email = 'ana@example.com'shows asWHERE email = ?.Credentials never pass through the AI. The connection comes from the environment only.
Database text is treated as data. Results are fenced and labeled, and the server tells the model never to follow instructions that appear inside query text or application names.
Everything is audited. Each call is appended to a local JSONL log with timing and outcome.
Least privilege. It is designed for a login with PostgreSQL's built-in
pg_monitorrole, which can read monitoring views but not your tables.overviewwarns if you connect as a superuser.
Related MCP server: MCP-PostgreSQL-Ops
Tools
Tool | What it checks |
| Runs every check and lists what needs attention, most serious first. Start here. |
| Version, uptime, connections vs |
| Work running now, longest first; long statements and sessions idle inside an open transaction. |
| Who is blocking whom, how long they have waited, and the root blockers. |
| Statements using the most time (needs |
| Largest tables and materialized views, with index size. |
| Invalid indexes, unused indexes, large tables read mostly by full scans. |
| Autovacuum status, dead rows, last vacuum/analyze, transaction ID wraparound age. |
| WAL archiving failures, replica lag, replication slots holding back WAL. |
| (off by default) The plan for one SELECT, without running it; flags large full scans. |
Quick start
Create a monitoring login (as a superuser) with
sql/create_monitor_role.postgres.sql:CREATE ROLE dba_checkup LOGIN PASSWORD 'choose-a-strong-password'; GRANT pg_monitor TO dba_checkup; GRANT CONNECT ON DATABASE your_database TO dba_checkup;Add it to your MCP client.
Claude Desktop (
claude_desktop_config.json):{ "mcpServers": { "dba-checkup": { "command": "npx", "args": ["-y", "dba-checkup-mcp"], "env": { "DBA_CHECKUP_DATABASE_URL": "postgres://dba_checkup:PASSWORD@host:5432/your_database" } } } }Claude Code:
claude mcp add dba-checkup -e DBA_CHECKUP_DATABASE_URL=postgres://dba_checkup:PASSWORD@host:5432/your_database -- npx -y dba-checkup-mcpAsk: "Run a health report on this database and tell me what to fix first."
It also works without an AI, for cron or a quick look:
DBA_CHECKUP_DATABASE_URL=postgres://... npx -y dba-checkup-mcp --reportThe exit code is 2 if anything is critical, 1 for warnings, 0 when healthy.
Settings
Variable | Default | Meaning |
| (required) | Connection string; the standard |
|
|
|
| off |
|
|
| Rows per check (max 200). |
|
| Statement timeout. |
|
| Audit file, or |
|
| Warning threshold for a running statement ( |
|
| Warning threshold for idle-in-transaction sessions. |
| 1.0 / 1.5 billion | Transaction ID age thresholds. |
What it does not see
Free disk space and backups taken by external tools (pgBackRest, Barman, snapshots) are not visible from SQL; the report says so instead of guessing.
Roadmap
Oracle Database (tested on Oracle Autonomous Database), with the same checks.
SQL Server.
Development
npm install
npm run build
TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres npm testThe tests build a database with real problems (a blocked session, a long-running statement, an idle transaction, an invalid index, an unused index, a table read by full scans, dead rows) and check that each one is found, that literals are masked, and that writes are refused. CI runs them on Node 20, 22 and 24 against PostgreSQL 16 and 17.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Open-source DBA tool for AI agents: graded database health checks, SQL, backups proven by restore
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to perform read-only PostgreSQL DBA analysis and monitoring through natural language, covering performance, bloat, locks/deadlocks, autovacuum, and schema inspection across PostgreSQL 12-18 without required extensions.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to perform read-only PostgreSQL DBA and monitoring tasks, including performance analysis, bloat detection, lock/deadlock monitoring, autovacuum and schema inspection across PostgreSQL 12–18. It supports natural-language queries against production-safe, RDS/Aurora-compatible connections, with optional query analytics via pg_stat_statements or pg_stat_monitor.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to inspect and monitor PostgreSQL databases with read-only DBA tools for performance analysis, bloat detection, locks/deadlocks, autovacuum, schema discovery, replication, and maintenance recommendations.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to perform read-only PostgreSQL DBA operations and monitoring through natural language, including performance and slow-query analysis, bloat detection, lock/deadlock monitoring, autovacuum and schema inspection, and maintenance recommendations across PostgreSQL 12–18.-