Labsco
MCP SERVER

MCP DB Analyzer

by Dmitriusan

Diagnose a Postgres or MySQL database — unused and missing indexes, table bloat, slow queries, idle-in-transaction connections, and VACUUM status — as findings rather than statistics.

Relational SQL DatabasesVerified
Summary
Idle-in-transaction detection is the tell — that is the state experienced operators check early and nobody else knows to look for.

A session sitting idle inside a transaction holds its locks, prevents VACUUM from reclaiming dead tuples, and looks completely normal in a connection count. It is a specific piece of operational knowledge encoded as a tool, and the same instinct runs through the rest: unused indexes and missing indexes as separate analyses because they are separate decisions, bloat measured differently per engine because the engines fragment differently. The pairing of analyze_vacuum with bloat and idle-in-transaction is the whole PostgreSQL maintenance story in three calls. Read-only, which is the right scope for a diagnostic.

What it is

A database diagnostic layer covering the problems that accumulate silently: index usage, bloat, query plans, slow-query statistics, connection state, foreign-key structure and PostgreSQL maintenance.

What you get
  • analyze_indexes finds unused indexes wasting space alongside the misuse cases, and suggest_missing_indexes works the other direction — tables with high sequential scan counts and no index usage at all.
  • analyze_table_bloat handles both engines properly, checking dead tuple ratios on PostgreSQL and InnoDB fragmentation on MySQL.
  • analyze_slow_queries reads pg_stat_statements or the MySQL performance schema, so the answer comes from the server's own accounting rather than from sampling.
  • explain_query returns a formatted plan with cost estimates rather than raw EXPLAIN output.
  • analyze_connections detects idle-in-transaction sessions specifically — the state that holds locks and blocks VACUUM while looking harmless.
  • analyze_vacuum checks dead tuple ratios and vacuum status on PostgreSQL.
  • analyze_table_relationships builds the foreign-key dependency graph.
  • inspect_schema lists tables with row counts and sizes, or inspects one in detail.
Requirements

DATABASE_URL. Everything here reads — the tools inspect and analyse, and none of them alter the schema or the data.

Setup effort

One command plus a key — npx -y mcp-db-analyzer, then supply credentials