Read-only PostgreSQL analytics MCP server

Read-only PostgreSQL analytics MCP server

mcp-postgres-analytics•byarchimedes-market

An MCP server that provides read-only PostgreSQL analytics tools for query plans, slow queries, index usage, bloat, vacuum status, connections, locks, and sizes.

License: Not specified•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Provides query_plan, which runs EXPLAIN ANALYZE with buffers and verbose output against a query string with annotated cost hot spots.
  • •Offers slow query, index usage, table bloat, and vacuum status analysis using PostgreSQL statistics views and heuristics.
  • •Reports connection statistics and lock waits, including active sessions, idle-in-transaction, longest-running transactions, and blocker chains.
  • •Validates at startup that the connection role lacks write and DDL privileges, refusing to run with elevated rights.

BEST FOR

  • •Diagnosing slow endpoints by inspecting slow queries, query plans, and missing index hints.
  • •Incident response and capacity planning against production PostgreSQL databases.
  • •Teams that need read-only database analytics without exposing write access to agents.

ABOUT MCP-POSTGRES-ANALYTICS

Read-only PostgreSQL analytics MCP server is cataloged as an MCP server attributed to archimedes-market. An MCP server that provides read-only PostgreSQL analytics tools for query plans, slow queries, index usage, bloat, vacuum status, connections, locks, and sizes. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Read-only PostgreSQL analytics MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can this MCP server write to the database?

No. It performs no write operations and is designed to connect with a read-only role limited to pg_read_all_stats and CONNECT.

Does query_plan actually execute the supplied query?

No. The query string is executed only inside EXPLAIN, so the query itself is never run.

What happens if the database role has write privileges?

Startup validation refuses roles with CREATE, INSERT, UPDATE, DELETE, TRUNCATE, ALTER, or DROP privileges and exits with a clear error.

Upstream README

View this exact version on GitHub

README.md · 6e9710a44140 · Fetched 2026-11-13 12:21:25 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Archimedes Trust Report — VERIFIED 92/100

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 spots
  • slow_queries — top N queries by mean time / total time / call count from pg_stat_statements
  • index_usage — index hit ratio, dead indexes, missing-index hints from pg_stat_user_indexes
  • table_bloat — bloat estimation per table using the pgstattuple-equivalent heuristic
  • vacuum_status — last vacuum / autovacuum / analyze per table, with wraparound risk flagged
  • connection_stats — active sessions, idle-in-transaction, longest-running transactions
  • lock_waits — blocked queries with the blocker chain resolved
  • size_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.

Quick start

pip install mcp-postgres-analytics
export MCP_POSTGRES_DSN="postgresql://reader@host:5432/db"
mcp-postgres-analytics serve

Claude 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.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Read-only PostgreSQL analytics MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-postgres-analytics)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage