MCP Db Analyzer MCP Server

MCP server for PostgreSQL, MySQL, and SQLite schema analysis, index optimization, and query plan inspection

Local serverstdioPython

What is the MCP Db Analyzer MCP Server?

MCP server for PostgreSQL, MySQL, and SQLite schema analysis, index optimization, and query plan inspection

What you get

A Model Context Protocol (MCP) server that gives AI assistants deep visibility into your databases. It inspects schemas, detects index problems, analyzes table bloat/fragmentation, and explains query plans — so your AI can give you actionable database optimization advice instead of generic suggestions.

Recorded tools

  • inspect_schema — List all tables with row counts and sizes, or drill into a specific table's columns, types, constraints, and foreign keys.
  • analyze_indexes — Find unused indexes wasting disk space and missing indexes causing slow sequential scans. Also detects unindexed foreign keys.
  • explain_query — Run EXPLAIN on a SQL query and get a formatted execution plan with cost estimates, node types, and optimization warnings. Optionally run EXPLAIN ANALYZE for actual timing (SELECT queries only).
  • analyze_table_bloat — Analyze table bloat by checking dead tuple ratios, vacuum history, and table sizes. Recommends VACUUM ANALYZE for tables with >10% dead tuples.
  • suggest_missing_indexes — Find tables with high sequential scan counts and zero index usage, cross-referenced with unused indexes wasting space. Provides actionable CREATE INDEX and DROP INDEX recommendations.
  • analyze_slow_queries — Find the slowest queries using pg_stat_statements (PostgreSQL) or performance_schema (MySQL). Shows execution times, call counts, and identifies optimization candidates.
  • analyze_connections — Analyze active database connections. Detects idle-in-transaction sessions, long-running queries, lock contention, and connection pool utilization. PostgreSQL and MySQL only.
  • analyze_table_relationships — Analyze foreign key relationships between tables. Builds a dependency graph showing entity connectivity, orphan tables (no FKs), cascading delete chains, and hub entities.
  • analyze_vacuum — Analyze PostgreSQL VACUUM maintenance status. Checks dead tuple ratios, vacuum staleness, autovacuum configuration, and identifies tables needing manual VACUUM. PostgreSQL only.

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
inspect_schema

How to install the MCP Db Analyzer MCP Server

{
  "mcpServers": {
    "db-analyzer": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-db-analyzer"
      ],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

VariableDescriptionRequired
DATABASE_URLDeclared in the maintainer’s client configuration.Check documentation

Example prompts to try

  • “Use MCP Db Analyzer to MySQL.”
  • “Use MCP Db Analyzer to SQLite.”
  • “Use MCP Db Analyzer to inspect schema.”

Frequently asked questions

MCP server for PostgreSQL, MySQL, and SQLite schema analysis, index optimization, and query plan inspection Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.