What is Mcp Postgres Analytics?
Mcp Postgres Analytics is a read-only PostgreSQL analytics agent exposed as an MCP server. It connects to a production database safely—never performing any writes, DDL, or DML—and provides tools for query planning, performance diagnostics, and database statistics.
How to use Mcp Postgres Analytics?
Install via pip install git+https://github.com/archimedes-market/mcp-postgres-analytics, set the environment variable MCP_POSTGRES_DSN to a postgresql:// connection string, then run mcp-postgres-analytics serve.
Key features of Mcp Postgres Analytics
- Reads-only: no DDL, DML, or writes ever
- Startup refuses roles with write privileges (CREATE, INSERT, etc.)
query_plan runs only EXPLAIN (ANALYZE, BUFFERS, VERBOSE)—never the query itself
- Provides tools for slow queries, index usage, table bloat, vacuum status, connections, lock waits, and size summaries
- Connects as a role with minimal
pg_read_all_stats and CONNECT privileges
Use cases of Mcp Postgres Analytics
- Monitor slow queries via
pg_stat_statements
- Analyze query execution plans without running the actual query
- Detect index bloat and missing-index hints
- Identify lock contention and blocking transaction chains
- Track vacuum/autovacuum progress and wraparound risk
评论