Loading...

Postgres MCP Pro provides AI agents with database health checks, index tuning, query plan analysis, and safe SQL execution via the Model Context Protocol.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
Postgres MCP Pro provides AI agents with database health checks, index tuning, query plan analysis, and safe SQL execution via the Model Context Protocol.
Postgres MCP Pro offers configurable access controls, but unrestricted mode carries significant risks. It's safe for development with proper access controls. Production use requires restricted mode and careful monitoring to prevent unintended data modifications or performance impacts.
Performance depends on the complexity of the queries and the size of the database. Index tuning can significantly improve performance.
Cost depends on the resources consumed by the Postgres database. Index tuning can reduce costs by improving query performance.
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"DATABASE_URI",
"crystaldba/postgres-mcp",
"--access-mode=unrestricted"
],
"env": {
"DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
}
}
}
}DATABASE_URIOPENAI_API_KEYdatabase_health_checkAnalyzes database health, including index health, connection utilization, and replication lag.
Read-only access to database statistics.
index_tuningExplores index options to optimize database performance.
Can modify database schema by creating new indexes.
query_plan_analysisReviews EXPLAIN plans to validate and optimize query performance.
Read-only access to query execution plans.
safe_sql_executionExecutes SQL queries with configurable access control.
Can modify data or schema depending on access mode.
schema_intelligenceProvides context-aware SQL generation based on the database schema.
Read-only access to database schema information.
Environment Variable
hybrid
Postgres MCP Pro offers configurable access controls, but unrestricted mode carries significant risks. It's safe for development with proper access controls. Production use requires restricted mode and careful monitoring to prevent unintended data modifications or performance impacts.
Autonomy depends on the configured access mode. Unrestricted mode allows full autonomy, while restricted mode limits operations.
Production Tip
Use restricted mode in production to prevent unintended data modifications.
Unrestricted mode allows full read/write access, while restricted mode limits operations to read-only transactions and imposes resource constraints.
Replace `--access-mode=unrestricted` with `--access-mode=restricted` in the configuration file.
The `pg_stat_statements` and `hypopg` extensions are required.
Run `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;` and `CREATE EXTENSION IF NOT EXISTS hypopg;` using a role with sufficient privileges.
Yes, by using the SSE transport.
Start the server with the `--transport=sse` option and update your MCP client configuration to call the MCP server's SSE endpoint.
Docker is generally recommended for its reliability, but Python installation is also supported.