Overview
What Postgres MCP Pro does
Postgres MCP Pro pairs ordinary schema and SQL access with deterministic database-analysis tools. Agents can inspect objects, request execution plans, identify slow statements from pg_stat_statements, run health checks, and evaluate index ideas with PostgreSQL's planner and optional HypoPG support. Restricted mode wraps execution in read-only transactions and limits execution time, while unrestricted mode permits database changes for development environments. The server runs locally through Python or Docker and can also expose an SSE endpoint for multiple clients.
Best for
- PostgreSQL performance investigations and index design
- Schema-aware SQL assistance with a configurable read-only mode
- Database health reviews that combine several operational checks
Not ideal for
- Non-PostgreSQL database engines
- Production write access without an independently restricted database role and human review
Capabilities
What an agent can do
- 01
List schemas and inspect tables, views, sequences, extensions, constraints, and indexes
- 02
Execute SQL under restricted or unrestricted access modes
- 03
Explain queries and simulate hypothetical indexes when HypoPG is available
- 04
Find high-cost statements from pg_stat_statements and recommend workload indexes
- 05
Check cache, connections, constraints, indexes, sequences, and vacuum health
Representative tools and operations
list_schemaslist_objectsget_object_detailsexecute_sqlexplain_queryget_top_queriesanalyze_workload_indexesanalyze_query_indexesanalyze_db_health
Installation
Connect Postgres MCP Pro
Use the publisher’s current instructions as the source of truth. The examples below were checked on .
Any stdio MCP clientRun with uvx in restricted mode
uvx postgres-mcp --access-mode=restricted
{
"mcpServers": {
"postgres": {
"command": "uvx",
"args": ["postgres-mcp", "--access-mode=restricted"],
"env": {
"DATABASE_URI": "postgresql://readonly_user:password@localhost:5432/dbname"
}
}
}
}
Docker-based local clientsRun the published container over stdio
docker run -i --rm -e DATABASE_URI crystaldba/postgres-mcp --access-mode=restricted
Use a secret-managed DATABASE_URI and a database role whose grants independently enforce the required access level.
Trust and access
Authentication and security notes
Authentication: A PostgreSQL DATABASE_URI supplies database credentials. The local stdio server has no separate login; shared SSE deployments must add transport security and client authentication externally.
Review before connecting
- Use restricted mode together with a genuinely read-only PostgreSQL role; application-level parsing should not be the sole control.
- Keep DATABASE_URI out of committed client configuration and chat history by using a secret store or protected environment.
- Unrestricted mode can change data and schema, so reserve it for isolated development databases and require confirmations.
- Protect any SSE deployment with TLS, authentication, network restrictions, and per-user database authorization.
Known limitations
- The strongest tuning features depend on optional pg_stat_statements and HypoPG extensions.
- Connection information is fixed when the server starts, which is inconvenient for switching among many databases.
- Read-only transactions can still be risky around unsafe procedural languages; database privileges remain the primary boundary.
- It is a community project rather than an official PostgreSQL Global Development Group server.
Evidence
Sources used for this guide
Facts were checked against primary publisher material. Descriptions and guidance are original Graphify summaries.
FAQ
Questions about Postgres MCP Pro
Should I use restricted or unrestricted mode?
Start with restricted mode. Use unrestricted mode only for an isolated database where the agent is explicitly expected to modify data or schema.
Are PostgreSQL extensions required?
No for basic schema and SQL tools. pg_stat_statements and HypoPG unlock workload analysis and hypothetical-index workflows.