Claude Code can inspect application code, trace a failing query, and propose a PostgreSQL migration in one session.
That does not mean the same session should execute the migration.
A safer Claude Code + MCP + Postgres boundary:
- use a dedicated read-only investigation identity
- expose schema, plan, lock, sample, and migration-status tools
- keep mutation tools out of that server
- bind every call to an explicit environment
- return a structured migration plan with preconditions and a digest
- validate the plan against current schema and runtime state
- approve the exact digest, target, scope, window, and impact
- execute through a controlled runner with a short-lived identity
- revalidate before execution
- return a durable receipt and preserve recovery checkpoints
The key distinction is simple:
- Claude Code can investigate.
- Claude Code can propose.
- A reviewer can approve.
- A constrained runner can execute.
Combining those authorities makes a smooth demo.
Separating them makes a production boundary.
Full guide: Claude Code MCP Postgres: separate investigation from migration authority
Top comments (0)