MCP server for PostgreSQL, MySQL, and SQLite schema analysis, index optimization, and query plan inspection
MCP server for PostgreSQL, MySQL, and SQLite schema analysis, index optimization, and query plan inspection
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.
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.Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.
Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.
| Tool | What it does |
|---|---|
| inspect_schema |
{
"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.
| Variable | Description | Required |
|---|---|---|
| DATABASE_URL | Declared in the maintainer’s client configuration. | Check documentation |
Inspect PostgreSQL schemas and run read-only queries with the archived MCP reference server. Review its maintenance status before choosing it.
Connect the Notion MCP server to search workspace content and work with pages and databases through Notion’s hosted OAuth service.
Use the Supabase MCP server to inspect database schemas, query project data and retrieve docs through a project-scoped connection.
Query, modify and analyse local SQLite databases in conversation — the fastest way to chat with a data file.
Metabase ships its own MCP endpoint — search your BI content, build and run queries, and save questions and dashboards without leaving the chat.
Official MongoDB server covering data, schemas and Atlas management — from find queries to spinning up clusters.