Skip to content
MCP server

pgmcp

Read-only Postgres ops/DBA diagnostics: slow queries, EXPLAIN, locks, index and table…

Runs locallyStatus and history
Install
Pricing
Open source
Runs
Locally
Version
1.1.0
Listing updated
6 days ago

About pgmcp

pgmcp is an open-source MCP server. It runs locally on your machine and is started by your AI client.

Read-only Postgres ops/DBA diagnostics: slow queries, EXPLAIN, locks, index and table health.

Install

Run in a terminal

claude mcp add pgmcp --env PGMCP_DATABASE_URL='<PGMCP_DATABASE_URL>' -- docker run -i --rm -e PGMCP_DATABASE_URL ghcr.io/pascalallen/pgmcp:1.1.0

Add to claude_desktop_config.json

{
  "mcpServers": {
    "pgmcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGMCP_DATABASE_URL",
        "ghcr.io/pascalallen/pgmcp:1.1.0"
      ],
      "env": {
        "PGMCP_DATABASE_URL": "<PGMCP_DATABASE_URL>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "pgmcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGMCP_DATABASE_URL",
        "ghcr.io/pascalallen/pgmcp:1.1.0"
      ],
      "env": {
        "PGMCP_DATABASE_URL": "<PGMCP_DATABASE_URL>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "pgmcp": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGMCP_DATABASE_URL",
        "ghcr.io/pascalallen/pgmcp:1.1.0"
      ],
      "env": {
        "PGMCP_DATABASE_URL": "<PGMCP_DATABASE_URL>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "pgmcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGMCP_DATABASE_URL",
        "ghcr.io/pascalallen/pgmcp:1.1.0"
      ],
      "env": {
        "PGMCP_DATABASE_URL": "<PGMCP_DATABASE_URL>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "pgmcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PGMCP_DATABASE_URL",
        "ghcr.io/pascalallen/pgmcp:1.1.0"
      ],
      "env": {
        "PGMCP_DATABASE_URL": "<PGMCP_DATABASE_URL>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • PGMCP_DATABASE_URLPostgres connection string (read-only role recommended)Required
  • PGMCP_DATABASE_URLPostgres connection string (read-only role recommended)Required

Pricing

Open source

pgmcp FAQ

Is pgmcp free?

Yes. pgmcp is open source, so you can use and self-host it for free.

How do I add pgmcp to Claude Code?

Run this command in your terminal: claude mcp add pgmcp --env PGMCP_DATABASE_URL='<PGMCP_DATABASE_URL>' -- docker run -i --rm -e PGMCP_DATABASE_URL ghcr.io/pascalallen/pgmcp:1.1.0

Where this comes from

  • Description: from the official MCP Registry entry.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers