Postgres MCP Pro for Claude Code: Setup & Config
Give Claude Code PostgreSQL schema access, SQL execution, health checks, and performance analysis.
What you can do with Postgres MCP Pro in Claude Code
Pick PostgreSQL tooling that goes beyond queries into health checks, plans, and index evaluation.
- Inspect tables, views, constraints, and indexes before writing SQL.
- Review database health using a restricted read-only connection.
Before you start: Postgres MCP Pro in Claude Code
- Python 3.12+ for this launch path
- uv with uvx
- PostgreSQL database access credentials
- An MCP-compatible client
The README supports this restricted replacement for its unrestricted example. pg_stat_statements and hypopg are optional database extensions needed for fuller performance and index analysis. Docker is also documented.
Postgres MCP Pro Claude Code configuration
Choose Claude Code configuration scope
For Postgres MCP Pro, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.
Add Postgres MCP Pro to Claude Code
Use the postgres-mcp entry below in mcpServers. Keep Postgres MCP Pro's documented stdio connection fields and your other Claude Code entries.
Check Postgres MCP Pro in Claude Code
Postgres MCP Pro: Inspect claude mcp list and /mcp status.
Config file · Project scope: .mcp.json at the repository root
{
"mcpServers": {
"postgres-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"postgres-mcp",
"--access-mode=restricted"
],
"env": {
"DATABASE_URI": "<PostgreSQL connection URI with your database credentials>"
}
}
}
}claude mcp add-json --scope project 'postgres-mcp' '{"type":"stdio","command":"uvx","args":["postgres-mcp","--access-mode=restricted"],"env":{"DATABASE_URI":"<PostgreSQL connection URI with your database credentials>"}}'Postgres MCP Pro tools available to Claude Code
Postgres MCP Pro's stored tool list documents 9 tools; compare it with Claude Code's connected tool list, because the stored list is not a live check.
- list_schemas
For Postgres MCP Pro's list_schemas, review the permission request and arguments in Claude Code before approval.
- list_objects
For Postgres MCP Pro's list_objects, review the permission request and arguments in Claude Code before approval.
- get_object_details
For Postgres MCP Pro's get_object_details, review the permission request and arguments in Claude Code before approval.
Read an object's columns, indexes, constraints, and related structural details.
- execute_sql
For Postgres MCP Pro's execute_sql, review the permission request and arguments in Claude Code before approval.
Run SQL statements subject to the configured access restrictions.
- explain_query
For Postgres MCP Pro's explain_query, review the permission request and arguments in Claude Code before approval.
Inspect a query plan and optionally evaluate hypothetical indexes.
- get_top_queries
For Postgres MCP Pro's get_top_queries, review the permission request and arguments in Claude Code before approval.
- analyze_workload_indexes
For Postgres MCP Pro's analyze_workload_indexes, review the permission request and arguments in Claude Code before approval.
- analyze_query_indexes
For Postgres MCP Pro's analyze_query_indexes, review the permission request and arguments in Claude Code before approval.
Recommend indexes for a supplied set of up to ten SQL queries.
- analyze_db_health
For Postgres MCP Pro's analyze_db_health, review the permission request and arguments in Claude Code before approval.
Check cache, connections, indexes, constraints, sequences, and vacuum health.
Troubleshooting Postgres MCP Pro in Claude Code
- If Postgres MCP Pro fails to start, check uvx postgres-mcp (from uv, for Python tools), the working directory, and Claude Code's selected scope; inspect claude mcp list and /mcp.
- Postgres MCP Pro: check DATABASE_URI; keep credentials out of shared .mcp.json.
- Postgres MCP Pro uses stdio here: Claude Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
- Known limitation: Advanced workload and index analysis needs optional Postgres extensions.
- Known limitation: Unrestricted mode allows data and schema modification.
- Known limitation: Native Python execution requires Python 3.12 or newer.
- General Claude Code troubleshooting lives in the /clients/claude-code guide.
Postgres MCP Pro — details. Claude Code guide