Connecting Claude or ChatGPT to a Postgres database means picking an MCP server. If you're on Supabase or Neon, there's a ready-made connector in Claude, and Supabase is also a ChatGPT app. Google Cloud has remote servers for Cloud SQL and AlloyDB, and AWS and others publish local servers. Whichever you choose, the AI can explore your schema and answer questions with SQL. What it's allowed to touch comes down to one thing: the database role you connect with.
This guide covers the routes, what to set up first, how to connect, and what changes when a whole team asks data questions.
MCP (Model Context Protocol) is an open standard for plugging AI assistants into other apps. Claude and ChatGPT are a great fit for a developer's own questions. BlueNexus is for when data questions are shared work.
For a developer or analyst asking questions of one database.
For someone who works in ChatGPT.
For a team where support, ops and finance ask data questions.
Pick a server
- On Supabase or Neon. Both have Claude connectors. Supabase is also a ChatGPT app, and Neon connects to ChatGPT as a custom MCP server. Both offer a read-only mode. Supabase also lets you limit it to one project, and Neon recommends its server for development and testing.
- On Google Cloud. Cloud SQL and AlloyDB have remote MCP servers, including a read-only set of tools, with setup for Claude and ChatGPT.
- On AWS, Azure or your own servers. AWS's Postgres MCP server for Aurora and RDS is read-only by default. Azure's MCP server includes Postgres tools. Open-source servers like Postgres MCP Pro add query plans and health checks. These usually run locally.
A note on older guides: many still use the original MCP reference server, @modelcontextprotocol/server-postgres. It was archived in May 2025, and Datadog Security Labs later showed that a query could end its read-only transaction and then write. Use a maintained server instead.
What a Postgres MCP server lets an AI do
- The database role is the real limit, not the server's settings
- The original reference server is archived
- Every query uses your database's resources
- Text in your rows can carry instructions
Connect Postgres to Claude or ChatGPT
Both start with a database role for the AI.
Connect Postgres to Claude
15 minA good fit if you ask questions of one database yourself.
- 1Create a database role for the AI that can only read what it needs. See our read-only access guide.
- 2In Claude, open Customize, then Connectors. Search for Supabase or Neon, or add a custom connector with your MCP server's address.
- 3Sign in, and choose read-only if the server offers it.
- 4Ask a small question first, like which tables hold orders.
Custom connectors need a server Claude can reach over the internet. Local servers, like AWS's or Postgres MCP Pro, run in Claude Desktop through its config file.
Connect Postgres to ChatGPT
15 minA good fit if you work in ChatGPT.
- 1Create the same read-only role for the AI.
- 2In ChatGPT, open Plugins. Add Supabase, or add a custom MCP server with your server's address (Neon's, for example).
- 3Sign in and allow access.
- 4Ask which tables hold orders.
On Business plans, only admins and owners can add custom MCP servers. ChatGPT may ask you to confirm before an action that changes data.
For developers
Claude's custom connectors connect from Anthropic's cloud, so the server needs a public HTTPS address, or an allowlist for Anthropic's IP addresses. ChatGPT also needs a public HTTPS endpoint or a secure tunnel. In the server's connection string, use sslmode=verify-full so it checks the server's certificate and hostname. AWS notes that its query checks are not a security boundary, and Supabase calls its confirmations guardrails, not guarantees. Grants in Postgres are what hold.
Who can do what
- Use a role of its own. Don't reuse your app's database user. Give the AI a role that can read only the tables or views it needs. Our read-only access guide walks through it.
- Set a time limit. A read-only role can still run a query that takes forty minutes. Set
statement_timeouton the role. - Prefer a replica. A read replica can't be written to, and keeps heavy questions off your live database.
- Row-level security applies, except for superusers, roles with
BYPASSRLS, and table owners, unless the table usesFORCE ROW LEVEL SECURITY. - Watch what's in the rows. Text stored in your tables, like support messages, can contain instructions. Keep the AI away from tables with tokens and secrets.
When it doesn't work
- The connector can't reach the database. Custom connectors need a public address. For a private database, use a local server in Claude Desktop, or allowlist Anthropic's IP addresses.
- A query is canceled. It hit
statement_timeout, or a replica canceled it to keep up with changes. - Permission denied. The role doesn't have access to that table. That's usually working as intended.
- Too many connections. Each server or client opens its own connections. Set a connection limit on the AI's role.
With a team: Postgres in BlueNexus
In Claude or ChatGPT, each person connects with their own setup. That suits one developer. In a growing company, support, operations and finance all have data questions, and engineering wants to control what the AI can see.
BlueNexus is a shared AI workspace where people and AI agents work in the same projects, channels and tasks. The BlueNexus PostgreSQL connector, our own integration, has 12 tools, 8 that read and 4 that act, for searching tables, querying data, exploring schemas and managing records. Engineering connects it once, with the database user it chooses, and every record change waits for a person in Needs you.
Open Add a connector, search for PostgreSQL, click Connect and follow the steps.
- All
- AI
- Analytics
- Communication
- Finance
- Marketing
- Productivity
- Sales
- Social
Connect to any PostgreSQL database to search tables, query data, explore schemas, and manage records.
Illustration of the BlueNexus app with example data.
At Thimble & Co, a 45-person craft supplies subscription company in Portland, Sol, the support lead, asks the data agent which subscribers had a failed payment this week and haven't been contacted. The plan waits in Needs you.
The agent found the tables, ran one query and showed its SQL. Contacting customers stays with Sol's team.
Sol asked the data agent. From Postgres, on the read replica with the AI's read-only role. Nothing is posted until Sol approves it.
- Find the tables for subscriptions, payments and ticketsThree views in the reporting schema
- Run one query for failed payments this week with no ticketOn the read replica, with a 15-second limit
- Post the list in the support channel for SolThe count, the subscribers and the SQL it ran
- Email the subscribersLeft unticked: Sol's team writes from the help desk
Illustration of the BlueNexus app with example data.
For setup, see how to give AI read-only access to Postgres. For the team, see how ops, support and finance query Postgres.
Which way fits you
If you're on Supabase or Neon, add their connector to Claude or ChatGPT and choose read-only. Elsewhere, pick a maintained server, and connect with a role that can only read.
If data questions are shared work, across support, operations and finance, you'll get more from one shared space than from several private chats. That's what BlueNexus is built for, and you can sign up for BlueNexus to bring your team in.