PostgreSQL MCP server offering 254+ tools for safe query execution, introspection, tuning, and multi-version support.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Inspect callable tools, capabilities, and parameters exposed to AI agents by MCPg.
A production-grade Model Context Protocol server for PostgreSQL. It lets AI agents safely inspect, query, operate, and tune a Postgres database β 254 tools spanning catalog introspection, query intelligence, natural-language SQL, structural diffs, hybrid search, graph queries, data movement, live ops, and more.
Try it live: point an MCP client β or the MCP Inspector β at the hosted, read-only demo endpoint
https://devopam-mcpg-demo.hf.space/mcp. It serves read tools against throwaway demo data; for real use, run MCPg next to your own database (see Quick start).
| Aspect | MCPg |
|---|---|
| Safety | Read-only default + AST validation |
| Transport | stdio + HTTP/SSE |
| Install | pip install mcpg |
| Postgres Versions | 14β19 |
| Key Differentiator | Production observability + multi-tenancy |
[A-Za-z_][A-Za-z0-9_]* regex β a design constraint that means
user input never reaches the database through string concatenation.
Capabilities like DDL, shell, and LISTEN/NOTIFY are off until you
opt in. Every tool publishes MCP ToolAnnotations (readOnlyHint,
openWorldHint) derived from those same gates, so clients can
auto-approve reads and gate writes without guessing.psycopg3 directly, speaks every pg_* system view, integrates with
TimescaleDB, pgvector, PostGIS, Apache AGE, and pg_stat_statements
where they're available, and degrades gracefully when they aren't.SET ROLE multi-tenancy, read-replica routing with degraded-host
detection, server-side cursors with dedicated connections,
rate-limiting, audit trail with regex redaction, PG TLS enforcement
on startup, OIDC JWT bearer auth, per-session statement / lock
timeouts./metrics endpoint on the
HTTP transport surfaces mcpg_tool_calls_total{tool,status} +
mcpg_tool_duration_seconds. Every tool call records a structured
audit event with credential-redacted arguments.Verify:
Pull the pre-built image from the GitHub Container Registry (published
on every tagged release β :latest tracks the newest, or pin a version
like :0.6.5):
On Windows PowerShell replace the trailing \ with a backtick `
(or put the command on one line); the installation
guide has ready-to-copy
Linux/macOS, PowerShell, and Command Prompt blocks.
Or build it yourself from source:
Multi-stage image: runtime stage drops the build toolchain, runs as
uid=10001 / gid=10001 with nologin shell, application files
root-owned and read-only to the runtime user.
uv sync creates a venv with all runtime + dev dependencies and exposes
the mcpg console script.
More detail in the Installation Guide.
One-click installs:
β setup for Windsurf, JetBrains, Zed, Cline, Antigravity, Qwen Code, Perplexity,
ChatGPT, Copilot Studio, Continue, and HTTP
clients in the integrations guide.
Download mcpg-<version>.mcpb from the
latest release and
double-click it (or drag it into Claude Desktop's Settings β
Extensions). You'll be prompted for your PostgreSQL connection URL β
stored in the OS keychain β and an access mode (defaults to
read-only). That's the whole install: the bundle is ~2 kB and the
host resolves the pinned mcpg release from PyPI for your platform.
Drop this into your claude_desktop_config.json (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json;
Windows: %APPDATA%\Claude\claude_desktop_config.json):
Restart Claude Desktop. The MCPg toolset is now available to the model. You can ask Claude things like:
"What schemas exist in this database? For each one, summarise the three biggest tables."
"Why is this query slow?
SELECT * FROM orders WHERE customer_id = 42 ORDER BY created_at DESC"
One command seeds a small, curated e-commerce dataset (3,000 orders,
900 product reviews, deliberately planted flaws) into an mcpg_demo
schema β engineered so the index advisor, query-plan analysis,
full-text search, PII audit, and graph projection all have something
real to find on your first try. See the
guided tour for a captured walkthrough, and remove it
any time with mcpg --demo-drop.
Then point any MCP-aware client at http://localhost:8000/mcp (or
/sse for the SSE transport). Set
MCPG_HTTP_AUTH_TOKEN=... for a static bearer, or
MCPG_AUTH_MODE=oidc for full JWT validation against an OIDC issuer.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/devopam-mcpg)<a href="https://allmcps.com/mcp/devopam-mcpg"><img src="https://allmcps.com/api/badge/devopam-mcpg?style=directory" alt="MCPg on AllMCPs" /></a>