home / mcp / postgres mcp pro mcp server
Provides health checks, index tuning, explain plans, and safe SQL execution for PostgreSQL via MCP clients.
Configuration
View docs{
"mcpServers": {
"bach-ai-tools-bach--postgres-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"DATABASE_URI",
"crystaldba/postgres-mcp",
"--access-mode=unrestricted"
],
"env": {
"DATABASE_URI": "postgresql://username:password@localhost:5432/dbname",
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"
}
}
}
}Postgres MCP Pro is a server that gives AI agents a safe, observable way to work with PostgreSQL. It provides health checks, index tuning recommendations, explain plan analysis, and protected SQL execution so you can develop confidently and optimize production workloads.
You connect your MCP client to the Postgres MCP Pro server and use its tools to inspect health, tune indexes, analyze query plans, and run queries within safety constraints. Start in development with unrestricted access to explore capabilities, then switch to restricted mode for production environments where safety matters most.
Lists all database schemas available in the PostgreSQL instance.
Lists database objects (tables, views, sequences, extensions) within a specified schema.
Provides information about a specific database object, for example, a table's columns, constraints, and indexes.
Executes SQL statements on the database, with read-only limitations when connected in restricted mode.
Gets the execution plan for a SQL query describing how PostgreSQL will process it and exposing the query planner's cost model. Can be invoked with hypothetical indexes to simulate the behavior after adding indexes.
Reports the slowest SQL queries based on total execution time using pg_stat_statements data.
Analyzes the database workload to identify resource-intensive queries, then recommends optimal indexes for them.
Analyzes a list of specific SQL queries (up to 10) and recommends optimal indexes for them.
Performs comprehensive health checks including: buffer cache hit rates, connection health, constraint validation, index health (duplicate/unused/invalid), sequence limits, and vacuum health.