Skip to main content
The postgres MCP adapter connects with a PostgreSQL DSN (connection string) and provides read/write SQL access, schema introspection, and query planning. Use it for operational reporting, data enrichment, migration checks, performance triage, and schema-aware agents in workflows — often paired with the MySQL connector when you operate both relational engines.

Prerequisites

  • A PostgreSQL database (self-hosted, RDS, Cloud SQL, Supabase, or compatible) reachable from AgentRuntime
  • A connection string (DSN) with credentials scoped to the operations your workflows need
  • SELECT for reporting; INSERT/UPDATE/DELETE only when workflows must write
  • TLS configured for production (sslmode=require or stricter in the DSN)
  • project_contributor access

Connect in AgentRuntime

1

Create a connection

Go to Connections and click New custom connection to create a connection string connection with your Postgres DSN:
Use a read-only role for reporting workflows. Grant write privileges only when steps call postgres_exec.
2

Add postgres MCP instance

Go to MCP, click Add instance for postgres, wire your connection on Instance config, set the profile active, and save.
3

Test with a health check

Add a workflow with a single mcp_call to postgres_health. Run it to confirm connectivity before adding production queries.
4

Explore schema (optional)

Run mcp_callpostgres_list_schemas and postgres_list_tables to verify the bound database and default schema (public).
See Authentication for binding connections to MCP instances.

What you can build

  • Operational reports — Scheduled postgres_query on KPI tables → LLM narrative → Gmail or Resend digest.
  • Enrichment pipeline — External API fetch → postgres_exec INSERT with $1 args → downstream sync to Google Sheets.
  • Approval-gated writeshuman_task before postgres_exec UPDATE/DELETE on production tables.
  • Schema-aware agentspostgres_list_tables + postgres_describe_table + postgres_explain_query → Autopilot answers with grounded SQL.

Tools

Example

Fetch pending orders for a daily report:
Reference query output in a downstream lua_script step:

Configuration

Troubleshooting