- Home
- MCP servers
- Postgres MCP Pro
Postgres MCP Pro
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
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.
How to use
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.
Available tools
list_schemas
Lists all database schemas available in the PostgreSQL instance.
list_objects
Lists database objects (tables, views, sequences, extensions) within a specified schema.
get_object_details
Provides information about a specific database object, for example, a table's columns, constraints, and indexes.
execute_sql
Executes SQL statements on the database, with read-only limitations when connected in restricted mode.
explain_query
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.
get_top_queries
Reports the slowest SQL queries based on total execution time using pg_stat_statements data.
analyze_workload_indexes
Analyzes the database workload to identify resource-intensive queries, then recommends optimal indexes for them.
analyze_query_indexes
Analyzes a list of specific SQL queries (up to 10) and recommends optimal indexes for them.
analyze_db_health
Performs comprehensive health checks including: buffer cache hit rates, connection health, constraint validation, index health (duplicate/unused/invalid), sequence limits, and vacuum health.