Documentation

Docs / PostgreSQL

Manage PostgreSQL from an AI agent over MCP

An AI agent connected over MCP can do the routine database work, while the dangerous steps stay with a person. This page shows how to connect an agent, what it can do, how deletion approval works and why the connection string stays out of the conversation.

Connect your agent

Add the Resilis MCP server to Claude Code or Codex and sign in. Review the access it asks for before you approve it.

Terminal

# Claude Code
claude mcp add --transport http resilis https://mcp.resilis.io
claude mcp login resilis

# Codex CLI
codex mcp add resilis --url https://mcp.resilis.io
codex mcp login resilis

What an agent can do

Within the access you authorize and your plan’s limits, an agent can do the following with a managed database.

  • Create a database with databases.create, using plan-aware defaults, and bind it to an app with databases.bind.
  • Run a migration as a bounded release job with deployments.release.run, then read its status and logs with deployments.release.get and deployments.release.logs.
  • Check backup health with databases.backups.status and see snapshot days and point-in-time coverage with databases.backups.availability.
  • Take a snapshot with databases.snapshots.create and request a restore with databases.restore. A fork restore keeps the source database; an in-place restore needs confirm_inplace set to true.

How deletion approval works

An agent cannot delete a database. It can prepare a deletion, which calculates the impact and never deletes anything. A person approves it, and a ten-minute cancellation window follows before the deletion happens. A request that sits unapproved expires after 15 minutes. In production, an account owner approves by email.

Every agent tool call is recorded with the person, the client and the tool.

The connection string stays out of the conversation

When the agent binds a database, Resilis writes the connection string into the app’s environment and does not return it to the model, so it stays out of the transcript. Tools that do return credentials are marked as such and should not be displayed or copied unless you ask for them.

How do I add a Postgres database to an app built with Claude Code?

Connect Claude Code to the Resilis MCP server at https://mcp.resilis.io, sign in, and review the access it asks for. Then ask for a plan before anything changes: a private PostgreSQL database in the project and environment you choose, bound to the app as DATABASE_URL.

After you approve the plan, the agent creates the database and binds it. Deploy, then create and read a disposable record to prove the connection works.

Can my AI agent create or delete my database?

An agent connected over MCP can create a database and bind it, within the access you authorize and your plan’s limits. It cannot delete one directly.

It can only prepare a deletion. A person approves it, a ten-minute cancellation window follows, and requests that sit unapproved expire after 15 minutes. In production an account owner also approves by email.

Managed PostgreSQL on Resilis

Create a private PostgreSQL database in your project, bind it to your app and turn on continuous backups. The database draws from your runtime credit.

Get started About managed PostgreSQL