mcp-postgres-analytics
Provides read-only PostgreSQL analytics tools including query plan analysis, slow queries, index usage, table bloat estimation, vacuum status, connection stats, lock waits, and size summaries.
Verified asset on Archimedes Market. View the full 4-dimension Trust Report (security · quality · license · complexity) and the curated catalog on the asset page.
MCP PostgreSQL Analytics
Read-only PostgreSQL analytics agent exposed as an MCP server. Designed to drop into a production database safely — no DDL, no DML, no writes ever.
Eight tools cover the observability surface most teams reach for during incident response and capacity planning:
query_plan—EXPLAIN (ANALYZE, BUFFERS, VERBOSE)against a query string, with annotated cost hot spotsslow_queries— top N queries by mean time / total time / call count frompg_stat_statementsindex_usage— index hit ratio, dead indexes, missing-index hints frompg_stat_user_indexestable_bloat— bloat estimation per table using the pgstattuple-equivalent heuristicvacuum_status— last vacuum / autovacuum / analyze per table, with wraparound risk flaggedconnection_stats— active sessions, idle-in-transaction, longest-running transactionslock_waits— blocked queries with the blocker chain resolvedsize_summary— database/schema/table/index size, sorted
Safety guarantees
The MCP server connects as a role with pg_read_all_stats and CONNECT only. The connection string in MCP_POSTGRES_DSN is validated at startup to refuse any role that has CREATE, INSERT, UPDATE, DELETE, TRUNCATE, ALTER, or DROP privileges on any schema. Refusal exits with a clear error rather than running with elevated rights.
query_plan accepts a query string but executes it inside EXPLAIN (...) only — the query itself is never run.
Related MCP server: mcp-postgres
Quick start
pip install mcp-postgres-analytics
export MCP_POSTGRES_DSN="postgresql://reader@host:5432/db"
mcp-postgres-analytics serveClaude Desktop config:
{
"mcpServers": {
"postgres-analytics": {
"command": "mcp-postgres-analytics",
"args": ["serve"],
"env": {
"MCP_POSTGRES_DSN": "postgresql://reader@host:5432/db"
}
}
}
}Typical agent workflow
Agent: "Why is our /api/checkout endpoint slow this week?"
↓
1. slow_queries → top 5 queries by mean time
2. query_plan on the worst → spots a sequential scan
3. index_usage → confirms missing index hint
4. size_summary → confirms the table is 14GB
5. Output: "Index on orders(status, created_at) missing. ~150ms saved per call. Run during low-traffic window."What it does NOT do
No write operations of any kind
No connection to non-PostgreSQL databases (use the DuckDB MCP for Parquet/CSV)
No backup/restore (use pg_dump directly)
No replication topology management
If you need write access for an agent workflow, use a separate MCP server with explicit gates. Mixing read-only analytics with write operations is exactly the kind of conflated tooling that this server was built to avoid.
License
MIT.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -license-quality-maintenanceEnables users to perform SQL query execution, schema exploration, and performance analysis on PostgreSQL databases through any MCP-compatible client. It prioritizes security with read-only protection by default and provides guided workflows for database documentation and optimization.Last updated
- Alicense-qualityCmaintenanceRead-only PostgreSQL MCP server that enables running SELECT queries, listing tables and schemas, and describing columns, with built-in protection against writes and malicious SQL attacks.Last updated576MIT
- Alicense-qualityBmaintenanceA secure, read-only PostgreSQL MCP server that provides safe database introspection and querying capabilities.Last updated7MIT
- AlicenseAqualityCmaintenanceRead-only PostgreSQL database MCP server for safely exploring schema, tables, relationships, and sample data without modification.Last updated1073MIT
Related MCP Connectors
Read-only MCP server for wafergraph.com's semiconductor & AI supply-chain data: 30 tools, no auth.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
MCP server for managing Prisma Postgres.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/archimedes-market/mcp-postgres-analytics'
If you have feedback or need assistance with the MCP directory API, please join our Discord server