Mindket

Chat agent that queries a Supabase or Postgres database

Newversion 1 · updated

Overview

An n8n workflow with a chat agent that answers questions about a Postgres database, such as one on Supabase. It reads the table list and each table’s columns, writes SQL and runs it through three Postgres tools.

Chat agent that queries a Supabase or Postgres database is an n8n workflow in the Developer category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there, with a database that accepts connections from it
  • Your own n8n server: the same file and steps
  • Supabase: copy the host, database, user and password from the project’s database settings
  • Plain Postgres: any database the n8n server can reach, including one on your own network

Platform

Connects 2 apps

How it works

Trigger

Chat message

It starts when you send a message in n8n’s chat:

  • A question about your data, in plain words

Actions

  1. The agent lists the tables in the public schema
  2. It reads the columns, types and foreign keys of the table it needs
  3. It writes a SQL query for your question
  4. The query runs on your database
  5. The agent answers in the chat from the rows that come back

Result

A plain-language answer drawn from the rows of your database, with the SQL that ran behind it

Integrations

What you need before you start.

OpenAI

Language model

Runs the agent’s model, which picks the tools, writes the SQL and words the answer.

NeedsOpenAI API key

PostgreSQL

Database

Serves three tools: the table list, one table’s columns and the SQL the agent writes.

NeedsA Postgres login with host, database, user and password. A read-only user is safest

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
2 steps, starting on a chat message
AI
1 step calls an AI model: AI Agent
Sign-ins
Signs in to: OpenAI
API keys
No API key is left in the file
Step types
Mindket’s checker reads 1 of its 2 step types. It does not read: AI Agent

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow lets you ask a Postgres database questions in plain words. A chat agent with an OpenAI model has three Postgres tools. One lists the tables in the public schema. One returns the columns, types and foreign keys of a single table. The third runs whatever SQL the agent writes, so it can count, group and total rows before it answers. Six nodes do the work, beside three sticky notes.

Who it suits

People who need numbers from a Supabase or Postgres database but do not write SQL every day, such as founders, analysts and support leads. Skip it for data you cannot send to a model, or if you need to review each query first. The agent writes and runs its own SQL.

Who uses it, and how
IndustryWho uses itHow they use itExample
StartupsFoundersAsk for signups, revenue or churn from the app’s own tablesA founder asks how many people signed up last week.
EcommerceStore managersCheck orders and stock without opening a dashboardA manager asks which five products sold most this month.
Customer supportSupport leadsCount tickets or look up an account by planA lead asks how many open tickets each plan has.
AnalyticsAnalystsGet a first answer, then rewrite the SQL by handAn analyst asks for revenue by country and refines the query the agent ran.

You need a little n8n and a database login: import a file, add two credentials and tell the agent about your tables.

Where to use it

Any n8n that can reach your database and OpenAI will run it. The answers appear in the chat.

  • n8n Cloud: import the file into a new workflow there, with a database that accepts connections from it
  • Your own n8n server: the same file and steps
  • Supabase: copy the host, database, user and password from the project’s database settings
  • Plain Postgres: any database the n8n server can reach, including one on your own network

Setup

Download saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Use a database login that can only read.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
PostgresA database the n8n server can reach: host, database name, user and password
OpenAIAn API key. The model node takes its default model
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add a Postgres credential with the database’s host, database, user and password. Select it in DB Schema, Get table definition and Run SQL Query.
  3. Add an OpenAI credential and select it in OpenAI Chat Model.
  4. Open AI Agent and read its system message. Add notes about your tables there if a column’s name does not say what it holds.
  5. Save, press Chat on the canvas and ask which tables it can see.

How to use it

Ask in plain words, such as how many orders came in last week. The agent can list the tables, read the columns of the ones it needs, write a query and answer from the rows. Ask for counts and totals, since every row it fetches goes to the model.

What to change for a different result
To changeWhere
The agent’s instructionsThe system message in AI Agent
The modelOpenAI Chat Model, which sets none in this file
What the lookups showThe public schema filter in DB Schema and Get table definition
How it writes SQLThe tool descriptions in Run SQL Query and Get table definition

Example

A store manager asks how many orders came in last week and which three products sold most.

The agent reads the table list, finds the orders table and its columns, and writes a query that groups order lines by product. The reply is a short answer in the chat. The query ran on your database, so check it in the chat’s log if the numbers matter.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. Here the agent sits in the middle, with its model and three tools plugged into it. Start with a question about one table, then open the chat’s log to read the SQL the agent wrote.

For experts. The tools are Postgres Tool nodes with a manual description. Run SQL Query takes its SQL from the model through $fromAI, and Get table definition does the same for a table name.

Where to look closer
NodeWhat it doesWhat to know
DB SchemaLists base tables in public from information_schema.tablesIt cannot see other schemas
Get table definitionJoins four information_schema views for each column’s name, type, nullability, default and foreign keyThe model’s table name is placed straight into the query text
Run SQL QueryRuns the SQL in the query fieldIts description tells the agent to use ->> to read JSON values
AI AgentAn OpenAI Functions agent with a three-line system messagen8n lists this mode as deprecated

Good to know

The agent can change data, not only read it, and its agent type is on its way out of n8n.

  • Writes: Run SQL Query runs whatever SQL the model writes, including inserts, updates and deletes. Connect with a database user that can only read, or point it at a copy
  • Quoting: Get table definition places the table name the model gives straight into its query text, so a read-only user also limits a hostile message
  • Agent type: n8n marks the OpenAI Functions mode as deprecated and says it is removed in n8n v3. After that update, replace AI Agent with the current AI Agent and reconnect its model and tools
  • Models: OpenAI Chat Model sets no model, so it takes the node’s own default, gpt-5-mini in n8n’s repository on 12 November 2026. OpenAI’s deprecations page, read that day, gives 14 January 2027 as the shutdown of gpt-4o and gpt-4o-mini, with gpt-6-luna as the replacement. If your n8n offers an older default, pick a model in the node
  • Schemas: the two lookup tools list only public
  • Size: query results go to the model, so a large result costs tokens
  • Your data: the table list, the column definitions, your questions and the rows returned go to OpenAI
  • The chat: it opens only inside n8n’s editor
  • Credentials: the JSON holds none

README and files

README

Chat agent that queries a Supabase or Postgres database

An n8n workflow with a chat agent that answers questions about a Postgres database, such as the one behind a Supabase
project. It lists the tables, reads the columns of the one it needs, writes SQL and runs it, with an OpenAI model behind it.

What is inside

  • workflow.json: the workflow as n8n exports it, nine nodes, three of them sticky notes. It holds no credential. One
    note holds the workflow's title.
  • README.md: these notes.

What we changed from the original copy

  • The model node and the three Postgres tools were linked to credentials in their author's n8n. The links are gone, so
    select your own.
  • Three sticky notes carried their author's promotion, an affiliate link, a video link and setup steps. One now holds a
    short title, and the other two are gone.
  • The original copy had no settings block. Mindket's sets the execution order to v1.
  • Nothing else. The file has no Code node, and its expressions needed no repair.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • A Postgres database the n8n server can reach, such as a Supabase project's. You need its host, database name, user and
    password. Supabase lists them in the project's database settings.
  • An OpenAI API key.
  • A database user that can only read. See Good to know.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Add a Postgres credential with the database's host, database, user and password. Select it in DB Schema,
    Get table definition and Run SQL Query.
  3. Add an OpenAI credential and select it in OpenAI Chat Model.
  4. Open AI Agent and read its system message, three short lines that cast it as a database assistant. Add notes about
    your tables there if you want the agent to know what a column means.
  5. Save, press Chat on the canvas and ask, for example, which tables it can see.

How a run goes

  1. When chat message received takes your message, and AI Agent reads it from chatInput.
  2. The agent is an OpenAI Functions agent with three tools.
  3. DB Schema lists the base tables in the public schema.
  4. Get table definition takes a table_name from the model. It returns each column's name, type, nullability and
    default, with the table a foreign key points to.
  5. Run SQL Query runs the SQL the model writes in its query field. Its description tells the agent to use the ->>
    operator to read values out of JSON columns.
  6. The agent answers in the chat from the rows that come back.

Change the look

  • The agent's instructions: the system message in AI Agent.
  • The model: OpenAI Chat Model, which sets none in this file.
  • What the tools may see: the schema filter, public, in DB Schema and Get table definition.
  • How the agent writes SQL: the tool descriptions in Run SQL Query and Get table definition.

Good to know

  • Run SQL Query runs whatever SQL the model writes, including inserts, updates and deletes. Connect with a database user
    that can only read, or point it at a copy.
  • Get table definition places the table name the model gives straight into its query text. A read-only user limits what a
    badly worded or hostile message can do.
  • Agent type: n8n marks the OpenAI Functions mode as deprecated and says it is removed in n8n v3. After that update,
    replace AI Agent with the current AI Agent and reconnect its model and tools.
  • Models: OpenAI Chat Model sets no model, so it takes the node's own default, gpt-5-mini in n8n's repository on
    12 November 2026. OpenAI's deprecations page, read that day, gives 14 January 2027 as the shutdown of gpt-4o and
    gpt-4o-mini, with gpt-6-luna as the replacement. If your n8n offers an older default, pick a model in the node.
  • Only the public schema is listed. Tables in other schemas are not found by the two lookup tools.
  • Query results go to the model, so a large result costs tokens. Ask for counts and totals instead of whole tables.
  • Your data: the table list, the column definitions, your questions and the rows returned go to OpenAI.
  • The chat opens only inside n8n's editor, since the trigger's public option is off.
Files
NOTICE.md  618 B
README.md  4 KB
workflow.json  6 KB

3 files, 11 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-12

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Developer

See all in Developer

buzz

block · Kit

Self-hostable workspace where people and AI agents share the same rooms, built on a Nostr relay that logs every action as a signed event. For teams that want t…

New37.3k

plannotator

backnotprop · Kit

Opens your AI coding agent's plans, specs and code changes in a browser so you can annotate or comment on them and send the feedback straight back to the agent.

New10.5k

open-code-review

alibaba · Kit

Reviews Git changes with an AI agent that reads files and searches the codebase, then writes comments tied to exact lines. It suits developers who want automat…

New50.7k