Postgres MCP Pro is an open source Model Context Protocol (MCP) server built to support you and your AI agents throughout the entire development process—from initial coding, through testing and deployment, and to production tuning and maintenance.
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.
{
"mcpServers": {
"postgres": {
"command": "uv",
"args": [
"run",
"postgres-mcp",
"--access-mode=unrestricted"
],
"env": {
"DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
}
}
}
}