GUIDE

How to connect a Neon database to ChatGPT, Claude and Cursor, read-only

Updated

Create a role in Neon that can only read, copy its connection string, and paste it into Kaiva Bridge. Bridge turns your tables into tools on one MCP address for ChatGPT, Claude and Cursor, and every call runs in a read-only transaction. Each person signs in with their own Kaiva account, so nobody needs your Neon password or a Neon account.

Step by step

  1. Create a read-only roleOpen the SQL Editor in the Neon Console, pick your branch and database, and run the SQL below.
  2. Copy the connection stringClick Connect on your project's dashboard, choose the branch and database, turn connection pooling off, and copy the string. Put ai_reader and its password in place of the user and password in it.
  3. Create the server in Kaiva BridgeSign up free at app.kaiv.ai, choose New server, then Database, then PostgreSQL, and paste the string. Neon's certificate is verified with no extra setup.
  4. Choose tools and connectBridge makes two tools per table: get_<table> reads rows and summarize_<table> counts and totals them. Switch on the ones your AI needs, click Deploy server, and add the address from the Connect tab to ChatGPT, Claude or Cursor.

From a terminal, with the connection string read from a variable so it never lands in your shell history:

Terminal
npx @kaiva/cli login
printf %s "$NEON_AI_URL" | npx @kaiva/cli bridge push neon-db --postgres --secret-stdin
npx @kaiva/cli bridge install neon-db --client claude-code

The SQL for Neon

For Neon's default database, neondb. Choose a long random password.

SQL (Neon)
CREATE ROLE ai_reader LOGIN PASSWORD 'choose-a-long-random-password';
GRANT CONNECT ON DATABASE neondb TO ai_reader;
GRANT USAGE ON SCHEMA public TO ai_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ai_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO ai_reader;
ALTER ROLE ai_reader SET default_transaction_read_only = on;

When the database is asleep

If your compute scales to zero when idle, the first call after a quiet spell can take a little longer while Neon starts it. Later calls are as fast as usual.

What your AI can do with it

Ask "which customers signed up this month?" and your AI calls get_customers with a filter. Ask how many and it calls summarize_customers. It never writes SQL, and only the tables and columns ai_reader can read become tools.

A Neon project and a free Kaiva account are all you need. Free includes 10 MCP servers, 200,000 tool calls a month and 200 pages of documents, with no card.

Other ways to do it

  • Neon's own MCP serverBest when you want your AI to manage Neon: projects, branches, migrations and SQL. Each person signs in to Neon. It has a read-only mode and can run its SQL as a role you name.
  • Kaiva Postgres MCP, on your machineFor Claude Code, Cursor or Claude Desktop on your own machine: free, open source, read-only, no account. Use the same ai_reader connection string.
  • Your own codeIf you build the AI app yourself, give your code the read-only connection string directly and let it decide which queries to run.

Questions

Can the AI change my Neon data?
Not through Bridge. Its database tools only read, every call runs in a read-only transaction, and ai_reader has no write grants.
Do my teammates need a Neon account?
No. They join your Kaiva workspace and sign in to Kaiva Bridge from ChatGPT, Claude or Cursor. The database password stays with Bridge, encrypted, and is never sent to the AI client.
Pooled or direct connection string?
The direct one, with connection pooling off. Bridge keeps its own small pool of connections.
Should I use my production branch?
Bridge only reads, so it can. To keep AI traffic off production, point the string at another branch or a read replica.
Is it free?
Free includes 10 MCP servers, 200,000 tool calls a month and 200 pages of documents, with no card.