Connect Claude Code directly to any PostgreSQL database to run queries, inspect schemas, analyze query plans, and generate migrations with natural language.
The PostgreSQL MCP creates a secure tunnel between Claude Code and any Postgres-compatible database. Unlike ORMs or GUI tools, it lets Claude issue raw SQL, inspect execution plans, and reason about your schema at the database level — ideal for performance tuning, schema design, and data debugging.
mcpizy install postgres
Provide your connection string (e.g., postgresql://user:password@host:5432/dbname) during setup. SSL connections are supported and recommended for remote databases.
pg_stat_statements and identify bottlenecks.Identify the slowest queries in your production database:
SELECT query, calls, total_exec_time / calls AS avg_ms
FROM pg_stat_statements
ORDER BY avg_ms DESC
LIMIT 10;
Claude runs this via the MCP, then proposes missing indexes or query rewrites based on the results.
BEGIN; ... ROLLBACK; blocks when testing destructive statements before committing.