Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"mcpg": {
"env": {
"MCPG_DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
},
"args": [
"mcpg"
],
"command": "uvx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A production-grade Model Context Protocol server for PostgreSQL. Lets AI agents safely inspect, query, operate, and tune a Postgres database — over 100 tools spanning catalog introspection, query intelligence, natural-language SQL, structural diffs, hybrid search, graph queries, data movement, live ops, and more.
Run this in your terminal to verify the server starts. Then let us know if it worked — your result helps other developers.
uvx 'mcpg' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
Checked mcpg against OSV.dev.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in data / ai-ml
Manage Supabase projects — databases, auth, storage, and edge functions
Query and manage PostgreSQL databases directly from AI assistants
Dynamic problem-solving through sequential thought chains
Persistent memory using a knowledge graph
MCP Security Weekly
Get CVE alerts and security updates for io.github.devopam/mcpg and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A production-grade Model Context Protocol server for PostgreSQL. Lets AI agents safely inspect, query, operate, and tune a Postgres database — 253 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