mcp-db-analyzer
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGHOST | No | PostgreSQL host (alternative to DATABASE_URL) | |
| PGPORT | No | PostgreSQL port (alternative to DATABASE_URL) | |
| PGUSER | No | PostgreSQL user (alternative to DATABASE_URL) | |
| DB_DRIVER | No | Database driver: 'postgres', 'mysql', or 'sqlite'. Default is auto-detected from DATABASE_URL or 'postgres'. | |
| MYSQL_HOST | No | MySQL host (alternative to DATABASE_URL) | |
| MYSQL_PORT | No | MySQL port (alternative to DATABASE_URL) | |
| MYSQL_USER | No | MySQL user (alternative to DATABASE_URL) | |
| PGDATABASE | No | PostgreSQL database name (alternative to DATABASE_URL) | |
| PGPASSWORD | No | PostgreSQL password (alternative to DATABASE_URL) | |
| DATABASE_URL | No | Database connection URL. For PostgreSQL: postgresql://user:password@host:port/dbname. For MySQL: mysql://user:password@host:port/dbname. For SQLite: /path/to/database.db | |
| MYSQL_DATABASE | No | MySQL database name (alternative to DATABASE_URL) | |
| MYSQL_PASSWORD | No | MySQL password (alternative to DATABASE_URL) |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| inspect_schemaA | List all tables in a schema with row counts and sizes, or inspect a specific table's columns, types, constraints, and foreign keys. |
| analyze_indexesA | Analyze index usage statistics to find unused indexes wasting space and missing indexes causing slow sequential scans. Also detects unindexed foreign keys. |
| explain_queryA | Run EXPLAIN on a SQL query and return a formatted plan with cost estimates, node types, and optimization warnings. Optionally runs EXPLAIN ANALYZE for actual execution statistics (read-only queries only). |
| analyze_table_bloatC | Analyze table bloat by checking dead tuple ratios (PostgreSQL) or InnoDB fragmentation (MySQL), vacuum history, and table sizes. |
| suggest_missing_indexesA | 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_queriesA | Find the slowest queries using pg_stat_statements (PostgreSQL) or performance_schema (MySQL). Shows execution times, call counts, and optimization recommendations. PostgreSQL requires the pg_stat_statements extension to be installed and listed in shared_preload_libraries — the tool returns setup instructions if the extension is missing. Not available for SQLite. |
| analyze_connectionsA | Analyze active database connections. Detects idle-in-transaction sessions and lock contention between sessions (PostgreSQL), long-running queries flagged at >30 seconds, and connection pool utilization. Idle-in-transaction and lock contention detection are not available on MySQL — use this tool's output to investigate PostgreSQL-specific blocking scenarios. Not available for SQLite. |
| analyze_table_relationshipsA | Analyze foreign key relationships between tables. Builds a dependency graph showing entity connectivity, orphan tables (no FKs), cascading delete chains (shown at full depth), hub entities (tables with 5+ FK connections), and circular FK dependencies. Useful for understanding schema design, planning migrations, and impact analysis. |
| analyze_vacuumA | Analyze PostgreSQL VACUUM maintenance status. Checks dead tuple ratios, vacuum staleness, autovacuum configuration, and identifies tables needing manual VACUUM. PostgreSQL only. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dmitriusan/mcp-db-analyzer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server