Postgres Scout MCP logo

Postgres Scout MCP

Inspect, monitor, diagnose, and improve PostgreSQL databases through MCP tools with read-only defaults and guarded write modes.

Install Postgres Scout MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "postgres-scout-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "postgres-scout-mcp",
        "read-only",
        "postgresql://localhost:5432/postgres"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio postgres-scout-mcp -- npx -y postgres-scout-mcp read-only postgresql://localhost:5432/postgres

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y postgres-scout-mcp read-only postgresql://localhost:5432/postgres

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

postgres-scout-mcp MCP server connects AI agents to PostgreSQL through tools for database exploration, query analysis, monitoring, optimization, and data-quality checks. It runs over stdio with a PostgreSQL connection string and defaults to read-only mode, while a separate read-write mode enables controlled modifications. Use it to inspect schemas, explain queries, review health and activity, identify data issues, or plan maintenance. The server also includes safeguards such as parameterized queries, validation, rate limiting, timeouts, and response limits.

Use cases

  • Inspect PostgreSQL schemas, tables, indexes, and relationships
  • Diagnose slow queries, bloat, locks, and connection activity
  • Find duplicate, missing, orphaned, or inconsistent data
  • Review health metrics and receive maintenance recommendations
  • Run controlled database writes in an explicit read-write instance

Key features

  • PostgreSQL schema and table exploration
  • Query execution, EXPLAIN analysis, and optimization suggestions
  • Health, activity, lock, and live metric monitoring
  • Bloat, vacuum, index, and partitioning analysis
  • Data-quality and foreign-key checks
  • Read-only default with guarded read-write mode

Tools36

What Postgres Scout MCP lets your agent do. Expand a tool for its parameters.

Self-reported~480 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

14/14 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 17d ago via OSV.dev · postgres-scout-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads294Package downloads in the last 30 days.
Last commit9mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed36Callable tools this server registers over MCP.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How Postgres Scout MCP works

What postgres-scout-mcp MCP server does

postgres-scout-mcp MCP server gives an AI client structured access to PostgreSQL database information and analysis operations. It can enumerate accessible databases, schemas, and tables; inspect columns, constraints, and indexes; and return table size and row statistics. The query tools support SELECT statements by default, with write statements available when the server is explicitly started in read-write mode.

Its diagnostic capabilities cover database health, cache performance, connection information, table bloat, slow queries, index usage, locks, active sessions, and table activity. Data-quality tools can look for duplicate rows, missing values, orphaned records, constraint violations, inconsistent text-column types, and foreign-key issues. Relationship and time-based analysis are also supported through foreign-key traversal, recent-row searches, and time-series analysis.

How it works

The server is launched with npx and a PostgreSQL connection string, then exposes MCP tools to a compatible client. Exploration and analysis calls query PostgreSQL metadata and statistics. For example, an agent can combine listTables with analyzeTableBloat, or use getSlowQueries followed by suggestIndexes when investigating performance.

The default operating mode is read-only. A read-write instance must be selected explicitly with --read-write; the documented setup uses separate instances for production read-only access and development writes. Write tools include query execution in read-write mode and guarded update, delete, and insert operations with dry-run or validation features as applicable.

Setup and configuration

Install and run the package through npx with a database URL:

Terminal
npx -y postgres-scout-mcp postgresql://localhost:5432/mydb

Claude Code can register the command with claude mcp add. Claude Desktop, Cursor, and VS Code can configure it as a stdio MCP server with npx and the same connection-string argument.

Configuration is available through environment variables for query timeout, maximum result rows, rate limiting, connection-pool sizing, logging, and log verbosity. File logging is disabled unless ENABLE_LOGGING=true; when enabled, usage and error logs are written under LOG_DIR. Connection strings are redacted from output.

Tools and capabilities

The postgres-scout-mcp MCP server groups its tools around practical database work:

  • Explore databases, schemas, tables, columns, constraints, and indexes.
  • Execute and explain queries, then request query-specific optimization recommendations.
  • Review health scores, anomalies, bloat, slow queries, vacuum needs, and index opportunities.
  • Monitor current activity, locks, live metrics, hottest tables, and per-table I/O or scan statistics.
  • Check duplicates, NULLs, orphaned rows, constraint readiness, type consistency, and foreign keys.
  • Trace multi-hop relationships and analyze recent or time-series data.

Limitations and notes

getSlowQueries requires PostgreSQL's pg_stat_statements extension. Query results are bounded by the configured maximum row count, and queries have a configurable timeout. Rate limiting is enabled by default and can be configured.

Read-only mode prevents write operations through the server, but write access is available if the process is intentionally started in read-write mode. The documented safety controls include parameterized values, input and identifier validation, rate limiting, query timeouts, and response-size limits.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Postgres Scout MCP

postgres-scout-mcp is an MCP server that connects AI agents to PostgreSQL databases through tools for database exploration, querying, diagnostics, monitoring, optimization, and data-quality checks. Its main tools include listTables, executeQuery, getHealthScore, getCurrentActivity, findDuplicates, and analyzeTimeSeries, with writes available only in read-write mode.

Run it with npx and a PostgreSQL connection string, such as `npx -y postgres-scout-mcp postgresql://localhost:5432/mydb`.

Yes, postgres-scout-mcp starts in read-only mode by default. Use `--read-write` to enable write operations, and the documented setup recommends separating read-only production access from read-write development access. Query execution and write tools follow the selected mode.

Yes, postgres-scout-mcp can be configured in Cursor as an MCP server using the stdio command, the `npx` package invocation, and a PostgreSQL connection string. The README provides a Cursor and VS Code settings example for this setup.

The `getSlowQueries` tool requires PostgreSQL's `pg_stat_statements` extension. Other exploration, monitoring, optimization, and data-quality tools are documented separately and do not state this requirement.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewPostgres Scout MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/postgres-scout-mcp?style=directory)](https://allmcps.com/mcp/postgres-scout-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/postgres-scout-mcp"><img src="https://allmcps.com/api/badge/postgres-scout-mcp?style=directory" alt="Postgres Scout MCP on AllMCPs" /></a>