Skip to main content

Connect PostgreSQL to Claude, ChatGPT and Copilot

PostgreSQL is the database behind many business applications, and the engine under Amazon RDS for PostgreSQL, Aurora PostgreSQL, Azure Database for PostgreSQL and Cloud SQL. Nexatron connects directly over TLS and runs each question as the asking person's own database role.

Nexatron's hosted MCP server is listed in Claude's connector directory. ChatGPT and Microsoft 365 Copilot add the same server as a custom MCP connector. Connect PostgreSQL to your Nexatron workspace once, then ask from whichever assistant you use.

What you can ask​

  • Which subscriptions renew in the next 30 days, and what revenue do they carry?
  • How many new subscriptions started each week this quarter, by plan?
  • Which accounts have had no logins in the last 30 days but are still paying?
  • What is average order value by country for the last 90 days?
  • Which invoices are unpaid more than 45 days after their due date?
  • How many support tickets did each product area receive last month?

Setup reads schemas, tables and views (materialized views included), declared foreign keys, JSONB columns, and information_schema and pg_catalog to learn columns, types and comments. Every query is checked as a single read-only SELECT before it runs.

Prerequisites​

  • A Nexatron workspace admin to add the connection.
  • A PostgreSQL-compatible endpoint Nexatron can reach over the network. A read replica is usually the better choice, so ad hoc questions never compete with the application.
  • A setup role that can read the catalog and the tables in scope. It reads metadata for setup only.
  • A database role for each person who asks questions, with grants on what they should ask about.

Admin setup​

  1. In Nexatron, go to Knowledge ▸ Sources ▸ New connection and choose PostgreSQL.
  2. Enter the host, the port (5432 by default) and the database.
  3. Enter the setup role's username and password. This user is the connection's setup role: it reads metadata only, for setup, and never answers anyone's question.
  4. Connect, then choose who can use the connection.

Connections use TLS (sslmode require) by default.

How each person signs in​

Each person opens Knowledge ▸ Sources ▸ Your sign-ins, finds the connection under Link your own login, enters their own database user and password, and selects Link my login. The login is stored encrypted for them alone and never shown again. Use your own login, not the connection's setup user: a person linked to the setup role is refused.

On Amazon RDS and Aurora, people can sign in with AWS IAM authentication instead. Then an admin approves the database user each person signs in as, and the card says Waiting for your admin until they do. Nexatron uses a short-lived credential for that user alone.

First question to try​

After you add Nexatron in Claude, ChatGPT or Copilot, ask:

Which subscriptions renew in the next 30 days, and what revenue do they carry?

Every answer shows the SQL it ran, so you can run the same statement in psql.

Permissions and masking​

Questions run as the person's own role, so table grants and row-level security policies (CREATE POLICY) apply as they would in psql. Setup keeps no values from a table with row-level security, because each person sees different rows there.

Nexatron's own rules under Settings ▸ Workspace ▸ Access (Access) apply on top: row rules limit rows and column masking hides a column's values. They narrow what PostgreSQL allows and never widen it. A question that would total, average or count a masked column is refused in words, and an answer that ran under rules says so in its evidence.

Troubleshooting​

SymptomCause and fix
Nexatron asks you to link your loginYou have not linked your own database login under Your sign-ins for this connection.
Your login for the connection stopped workingYour linked login no longer signs in to the database. Select Replace login and enter a working one.
An answer is refused for accessYour role has no grant on a table the question needs. Ask your database administrator.
Waiting for your adminThe connection signs people in with AWS IAM, and no database user has been approved for you yet.
A question about a masked column's total is refusedA Nexatron masking rule covers that column, and aggregates over masked columns are always refused.