PostgreSQL connector for Claude

Use Porter’s PostgreSQL connector for Claude to ask about the tables you choose through a read-only role, then compare them with Google Ads spend.

  • Count orders or signups by day and status
  • Rank lead sources by leads and won leads
  • Flag days that look off against the 7-day average
  • Compare signups with Google Ads spend for cost per signup
G2★★★★★Rated 4.6/5 on G2 (288 reviews, October 2026)

By Porter Metrics team · Last updated October 19, 2026

ClaudePorter connected
Using my table public.orders, count rows by day for the last 14 days using the created_at column.
Porter / PostgreSQL / Trailgear Demo✓ 4 rows
Oct 10 had the most new orders (1,284). Weekdays average about 1,050.
DayRows
Oct 71,012
Oct 81,047
Oct 91,096
Oct 101,284
Demo data, Trailgear Demo account
One table per question
01Setup

How to connect PostgreSQL to Claude

Porter’s PostgreSQL connector for Claude takes 3 steps, and you don’t install an MCP server anywhere. Create a read-only role and enter its credentials in Porter. Add Porter’s MCP URL to Claude as a custom connector, then ask about any table that role reads. MCP (Model Context Protocol) is the open standard Claude uses to connect to tools.

What you need first

  • Before you start, you need a PostgreSQL database that accepts connections from outside its network, and a role you can grant privileges to. You also need a free Porter account and a Claude plan that allows custom connectors.
  • Claude offers custom connectors on Free, Pro, Max, Team and Enterprise, although Free allows one connector (Anthropic’s help article on custom connectors).
  1. Step 1: Create a read-only role and connect it in Porter

    Run the SQL under “What the connector needs from PostgreSQL” to create a read-only role. Then sign up free at Porter, pick PostgreSQL as the source and enter that role’s credentials. Finally, pick Claude as the destination.

  2. Step 2: Add the connector to Claude

    In Claude, open Customize, then Connectors, and choose Add custom connector. Then name it Porter Metrics and paste the URL of Porter’s MCP server:

    MCP URL
    https://mcp.portermetrics.com/mcp
  3. Step 3: Ask Claude about PostgreSQL

    Sign in to Porter when Claude asks, then paste:

    Prompt
    Using my PostgreSQL table public.orders, count rows by day for the last 14 days using the created_at column.

Guides and videos

Connect PostgreSQL to Claude free

app.portermetrics.com / create
Porter's PostgreSQL connection form with name, host, port and database fields
First, name the connection and add the host, port and database.
Porter's PostgreSQL form with username, password, SSL mode and SSH tunnel fields
Then, add a read-only user and choose SSL or an SSH tunnel.
Claude's Add custom connector window with the name Porter Metrics and Porter's MCP URL filled in
Then, in Claude, add a custom connector with Porter's MCP URL.
Porter's Application Access Request screen asking you to let Claude use the Porter MCP server
When Claude asks, sign in to Porter and select Allow Access.
Porter Metrics listed as a connected connector in Claude with its read-only tools
After that, Porter shows as connected, so you can ask your first question.
If you prefer video, watch the whole PostgreSQL to Claude setup (1:19, no sound).
Interactive walkthrough, so you can click along here
02Use cases and prompts

What you can ask Claude

Each use case comes with a prompt to copy, the columns it needs and who it’s for. Column names are examples, so swap in your own table and columns, and name the date column so Claude filters on the right one.

Can Claude count the orders or signups that came in each day?

The daily count lands in your chat instead of a ticket for whoever has database access.

Prompt
From my PostgreSQL table public.orders, count rows and sum amount by day and status for the last 30 days, using created_at as the date. Which status changed most?

For: RevOps and ops leads · founders · growth marketers

Fields used: your table's columns, for example a date column (created_at), a category column (status) and a numeric column

Can Claude show which lead source brings the most leads?

So you can decide which source gets next week’s budget without waiting on someone’s saved query.

Prompt
From my PostgreSQL table crm.leads, count leads by source for last week and last month using created_at, plus leads where status is won. Rank sources by won leads.

For: growth marketers · sales ops · agencies

Fields used: your table's columns, for example source, status, created_at

Can Claude flag days that look off?

So a drop shows up the day you ask, not in the weekly reconciliation.

Prompt
From my PostgreSQL table public.orders, show daily row count and sum of amount for the last 60 days using created_at. Flag days more than 30% away from the trailing 7-day average.

For: founders · product managers · ops

Fields used: your table's columns, for example created_at, amount

Can Claude combine two tables, like orders and customers?

As a result, you get order totals by plan without a new view or a request to the backend team.

Prompt
From my PostgreSQL tables public.orders and public.customers, get last month's order count and amount by customer_id, then each customer's plan. Match them on customer_id and total orders by plan.

For: RevOps · analysts · founders

Fields used: orders table: customer_id, created_at, amountcustomers table: customer_id, plan

Can Claude tell if more Google Ads spend brought more signups?

The weekly budget call can then rest on the signup count the product team trusts, set against what paid search cost.

Prompt
For the last 8 weeks, show Google Ads Cost by week next to the weekly count of rows in my PostgreSQL table public.users using created_at. Work out cost per signup and say whether higher-spend weeks brought more signups.

For: growth and performance marketers · agencies

Fields used: your signups table's date columnCost
03Why Porter

Why Porter for PostgreSQL in Claude

The PostgreSQL project publishes no official MCP, so Porter brings the tables your role can read into Claude, next to your ad, CRM and analytics data. Need to write SQL or change rows instead? Use a provider MCP such as Supabase’s MCP server or Neon’s MCP server, which run any SQL you allow.

✓

Hosted, nothing to install

Porter hosts the MCP server, so there’s nothing to install or patch. Create a read-only role, enter its credentials in Porter and add one MCP URL to Claude.

⊞

Safe for production data

Claude reads every table your role can SELECT and tells you what changed, while your rows stay exactly as you set them. Your grants decide which tables Claude sees.

⚙

Your app data next to your ads

Ask about orders or signups next to Google Ads, Meta Ads, GA4, HubSpot and other Porter connectors, for cost per signup from the table your product team trusts.

Aa

Works with any host

Porter reaches any PostgreSQL that accepts its connection, including Supabase, Neon, Amazon RDS and Cloud SQL. It signs in with database credentials, not a provider login.

↻

Free plan to start

The PostgreSQL connector comes with every Porter plan, including Free, so your first table costs nothing to try.

04Pricing

Pricing

You can start free, since Porter’s PostgreSQL connector for Claude comes with every plan. Use the calculator for your number of accounts, or see Porter pricing for every plan.

What you get

  • Free plan: the MCP, unlimited connected accounts and 30 days of history (15 days in AI chats)
  • Reporting: from $12.50 per account a month billed annually, or $15 month to month for one account
  • Billing: every PostgreSQL table you query counts as one account, with volume discounts and no per-seat fee
  • No credits needed: Claude’s PostgreSQL questions are reads, so they use no AI credits
  • Trial: 14 days of full access, no card

Price calculator

$33.33/mo$6.67 per account

An account is one ad account, Stripe account, store, page or GA4 property. The Free plan has unlimited accounts with 30 days of history.

05Data and actions

PostgreSQL data Claude can use

The PostgreSQL connector gives Claude no fixed field list. Instead, each table your role can read shows up as its own account, named schema.table. Its columns then become the fields Claude filters, groups and adds up. Claude reads one table per question and matches results across tables in chat.

How Claude reads PostgreSQL

What Porter readsExampleNote
Tablespublic.orders, analytics.signupsOne account each
Columnscreated_at, status, amountOnly columns the role can read
System columnsctidNever listed

Product stats

WhatPostgreSQL connector
FieldsNo fixed list; each column the role can read is a field
ActionsReads only, so your database stays exactly as you set it
ReadsOne table per question, named schema.table, from every schema the role can read
History30 days on the Free plan, 15 in AI chats
AccessRead-only role with CONNECT, USAGE and SELECT
Not readSystem columns such as ctid, and tables the role can't SELECT
DatabasesAny PostgreSQL that accepts outside connections, including Supabase, Neon, Amazon RDS and Cloud SQL
06Security

Is it safe?

Yes. Porter reads through a role that holds only SELECT, so your rows and tables stay exactly as you set them, and PostgreSQL itself enforces that. If you can, point the connection at a read replica to keep long reporting questions off the primary.

What the connector needs from PostgreSQL

Porter needs CONNECT on the database, USAGE on each schema and SELECT on each table (PostgreSQL's GRANT reference). For tables created after setup, the role that creates them runs ALTER DEFAULT PRIVILEGES (PostgreSQL's ALTER DEFAULT PRIVILEGES docs).

SQL
CREATE ROLE porter_ro LOGIN PASSWORD 'choose-a-strong-password'; GRANT CONNECT ON DATABASE mydb TO porter_ro; GRANT USAGE ON SCHEMA public TO porter_ro; GRANT SELECT ON ALL TABLES IN SCHEMA public TO porter_ro; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO porter_ro;

Network and encryption

PostgreSQL only accepts remote connections once listen_addresses goes beyond localhost, and pg_hba.conf must allow the connection, ideally with scram-sha-256 passwords (PostgreSQL's pg_hba.conf rules). In addition, the strictest SSL mode, verify-full, checks both the server certificate and its host name (libpq's SSL modes).

Use a read replica

A replica takes reporting load off the primary, especially for long questions. On a hot standby, though, PostgreSQL cancels a query that blocks replay once max_standby_streaming_delay passes, 30 seconds by default (PostgreSQL's standby server settings).

07FAQ

FAQ

The questions fall into two groups. Three are about fit: hosted databases, whether MCP works with databases at all, and tables across several schemas. Then three are fixes: numbers that don't match your SQL client, tables with no columns, and long questions that fail.

Does it work with Supabase, Neon, Amazon RDS or Cloud SQL?

Yes. Porter's PostgreSQL connector for Claude reaches a hosted database as long as it accepts outside connections. Porter signs in with database credentials, not a provider login, so Claude can read Supabase, Neon, Amazon RDS and Cloud SQL databases alike. Neon and Prisma Postgres also appear in Porter as separate integrations for actions.

Can MCP connect to a database?

Yes. In short, an MCP server such as Porter's sits between Claude and the database and decides what Claude can run. Porter's hosted server, for example, reads tables through a role you grant. However, provider servers from Supabase or Neon can run SQL, including writes, unless you switch on their read-only setting.

Can I connect tables from several schemas?

Yes. Porter lists tables from every schema your role can read under one connection, each named schema.table, and then Claude asks about whichever table you name. Grant USAGE only on the schemas Claude should see, because those are the only tables that show up.

Troubleshooting

Why don't the numbers match my SQL client?

Claude's numbers through Porter usually differ from your SQL client because the two read a different table, filter, date column or time zone. So check those four first. A read replica can also trail the primary, so a count taken there may miss the newest rows.

Why does Claude see no columns in my table?

Grant SELECT on the table and USAGE on its schema, then ask Claude about the table again. PostgreSQL hides a table's columns from roles without a privilege on it, so an empty column list means the Porter role needs that grant.

Why does a long question fail?

Ask for a shorter date range. A long question can stop inside PostgreSQL before Porter returns any rows. The statement_timeout setting cancels statements past its limit (PostgreSQL's statement_timeout setting), and a hot standby can also cancel queries. Finally, the max_connections setting, typically 100, can refuse a new connection (PostgreSQL's connection settings).

08Next

More Claude connectors

The MCP URL behind the PostgreSQL connector also gives Claude every other source you connect in Porter. So your app tables can sit beside warehouse, CRM or analytics data in one chat. Two database siblings and three marketing sources pair especially well with them, or browse all Claude connectors:

Try the connector in Claude

Setting up the PostgreSQL connector for Claude takes one database role and one URL. Then ask which day dipped, which source converts and what a signup costs. The free plan already includes the MCP, so your first table costs nothing to try.

Written by the Porter Metrics team, who build Porter's Claude connectors.

Free plan · 14-day trial · No card needed

Growth marketers: cost per signup from the users table instead of an export.

RevOps and ops leads: daily counts by status and source, straight from the database.

Founders: a same-day read on unusual days in orders or signups.