AutomationFlowsAI & RAG › Conversational Postgresql Agent with Visuals, Multi-kpi, and Data Editing (mcp)

Conversational Postgresql Agent with Visuals, Multi-kpi, and Data Editing (mcp)

Byhippolyte-hu @hippolyte-hu on n8n.io

Ask your PostgreSQL database complex questions and receive clear summaries, charts, and even update or insert data — all through one smart agent powered by n8n’s Model Context Protocol (MCP).

Event trigger★★★★☆ complexityAI-powered22 nodesPostgres ToolExecute Workflow TriggerTool WorkflowPostgresMcp TriggerAgentMcp Client ToolAnthropic Chat
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3903 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "CXe5AJieJbpn6RYE",
  "meta": {
    "templateId": "3631",
    "templateCredsSetupCompleted": true
  },
  "name": "Build your own PostgreSQL MCP server (visuals capable)",
  "tags": [],
  "nodes": [
    {
      "id": "0c49141e-128c-424e-afdf-ea131b7a3dd8",
      "name": "GetTableSchema",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        -40,
        840
      ],
      "parameters": {},
      "typeVersion": 2.6
    },
    {
      "id": "8ffeefb9-357c-41bc-8239-0c07c706be97",
      "name": "ListTables",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        20,
        980
      ],
      "parameters": {},
      "typeVersion": 2.6
    },
    {
      "id": "efcf7ff3-976e-448a-9d47-47a98f3b0fcb",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        920,
        820
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "abd292d7-fc2b-4e98-a474-b50e44d16b6c",
      "name": "CreateTableRecords",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        160,
        1020
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "4a71d42a-99a5-489e-b449-09c3c5081505",
      "name": "ReadTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        620
      ],
      "parameters": {},
      "typeVersion": 2.6,
      "alwaysOutputData": true
    },
    {
      "id": "bdc60aa8-9ab1-4bbd-8b9e-89c968d54043",
      "name": "Operation",
      "type": "n8n-nodes-base.switch",
      "position": [
        1120,
        820
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "cdb5b556-3638-4fa5-94c6-bff0c03f6c89",
      "name": "UpdateTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        1020
      ],
      "parameters": {},
      "typeVersion": 2.6
    },
    {
      "id": "9263fc78-321e-4c83-90d3-890dd87d6aed",
      "name": "UpdateTableRecords",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        320,
        1040
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "dd7e28fb-b2c7-4084-bc9b-9aa3e0187682",
      "name": "CreateTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1420,
        820
      ],
      "parameters": {},
      "typeVersion": 2.6
    },
    {
      "id": "9cf39ca3-b704-49ce-b6e2-db2703c4acad",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        540
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ac3d9b98-8f1e-4abd-972c-1725aac1ad1e",
      "name": "PostgreSQL MCP Server",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        80,
        620
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "416a09d5-c327-410d-b951-a2d08402c6fe",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        540
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c514c8a8-25b8-474b-8e3d-3a598e15c4ab",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        360,
        1260
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "294589fe-2dc4-40ea-b4e4-d7c42d1a28e1",
      "name": "MCP Client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        640,
        1560
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c566125c-daac-4b3f-ac2c-19588fd96831",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        340,
        1600
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "ce46a834-c43c-4d14-b98c-c37084534324",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        840,
        1540
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2513b2d7-bcdd-4622-93a1-27608af78894",
      "name": "get table details",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        620,
        1040
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "324503c0-117b-45ec-97dd-7074eb1db22e",
      "name": "ReadTableRows",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        480,
        1040
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "39a88e5b-585e-4caa-8f4a-d7c313dce70e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        1220
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "87a1998e-0106-43c2-943f-7b9b6744fd7f",
      "name": "Plot tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        640,
        840
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "ed260e47-5ba9-44fd-93b8-1643304da110",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        500,
        1600
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "05a17841-b900-4e5c-bd46-1707892f4a82",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        1260
      ],
      "parameters": {},
      "typeVersion": 1.1
    }
  ],
  "active": true,
  "settings": {},
  "versionId": "ff22a4a9-cacc-423b-bc2e-ae822eefb53a",
  "connections": {
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        []
      ]
    },
    "Operation": {
      "main": [
        [
          {
            "node": "ReadTableRecord",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "CreateTableRecord",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "UpdateTableRecord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Plot tool": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ListTables": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ReadTableRows": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "GetTableSchema": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ReadTableRecord": {
      "main": [
        []
      ]
    },
    "get table details": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "CreateTableRecords": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "UpdateTableRecords": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Operation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Ask your PostgreSQL database complex questions and receive clear summaries, charts, and even update or insert data — all through one smart agent powered by n8n’s Model Context Protocol (MCP).

Source: https://n8n.io/workflows/3903/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

The AI-Powered Shopify SEO Content Automation is an enterprise-grade workflow that transforms product content creation for e-commerce stores. This sophisticated multi-agent system integrates GPT-4o, C

Perplexity Tool, Memory Buffer Window, Agent +15
AI & RAG

Splitout Redis. Uses executeWorkflowTrigger, n8n, redis, splitOut. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, n8n, Redis +7
AI & RAG

3770. Uses executeWorkflowTrigger, n8n, redis, agent. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, n8n, Redis +7
AI & RAG

Designing agent tools for outcome rather than utility has been a long recommended practice of mine and it applies well when it comes to building MCP servers; In gist, agents to be making the least amo

Execute Workflow Trigger, n8n, Redis +7
AI & RAG

Learn how to build an MCP Server and Client in n8n with official nodes.

Agent, Google Calendar Tool, Mcp Trigger +8