This workflow corresponds to n8n.io template #3892 — 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 →
{
"id": "Wsw6HdSAFk8y7jxh",
"meta": {
"templateId": "3631",
"templateCredsSetupCompleted": true
},
"name": "Build your own PostgreSQL MCP server(No visuals)",
"tags": [],
"nodes": [
{
"id": "735a96e6-a254-4c0c-8268-88c33db886e8",
"name": "GetTableSchema",
"type": "n8n-nodes-base.postgresTool",
"position": [
-40,
920
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "aba773b1-8fd0-4b5a-953f-c2de44029b68",
"name": "ListTables",
"type": "n8n-nodes-base.postgresTool",
"position": [
60,
1020
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "217bac36-8448-4f91-b53f-2ffb8dcb13c1",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
760,
880
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "8752c39a-5bb6-4696-a591-cb7a4f649586",
"name": "CreateTableRecords",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
180,
1020
],
"parameters": {},
"typeVersion": 2.1
},
{
"id": "448c74a8-8051-4aeb-be50-98f61b4c1476",
"name": "ReadTableRecord",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
720
],
"parameters": {},
"typeVersion": 2.6,
"alwaysOutputData": true
},
{
"id": "a51c89a7-3c6e-4c71-83f7-c17dea2fac6a",
"name": "Operation",
"type": "n8n-nodes-base.switch",
"position": [
920,
880
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "0ee5c0cf-cb53-41a7-a81e-1eca93648eee",
"name": "UpdateTableRecord",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
1040
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "2f0fafb5-e369-4550-99df-04983c4f0080",
"name": "UpdateTableRecords",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
300,
1040
],
"parameters": {},
"typeVersion": 2.1
},
{
"id": "40deab57-d6f3-4f40-8368-ae0b5c0830e7",
"name": "CreateTableRecord",
"type": "n8n-nodes-base.postgres",
"position": [
1260,
880
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "e6d70398-2fda-4ad4-9fa9-9277b0e8037f",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
500
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "13154e61-77a4-40bb-b2a1-49c43af5e8c8",
"name": "PostgreSQL MCP Server",
"type": "@n8n/n8n-nodes-langchain.mcpTrigger",
"position": [
120,
580
],
"parameters": {},
"typeVersion": 1
},
{
"id": "62e57740-0e1c-46ce-8a12-d963dfe47d65",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
500
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "87fba2e8-96d1-48e1-bd2e-fefbf6d1ba74",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
300,
1440
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "19d4bfb8-ab2f-447f-8d58-4bfe2b7d182c",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
540,
1400
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "87781b4a-1c07-4447-b28f-bc9010dfe672",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
540,
1760
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "3ff30556-c402-47d7-b0d4-200c61006cb9",
"name": "MCP Client",
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"position": [
700,
1760
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a43e3dc5-adbf-4ae5-b46a-d04654cebbf0",
"name": "Anthropic Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
360,
1740
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "b683d331-989f-4b09-8158-df302fe12cab",
"name": "Think",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1000,
1720
],
"parameters": {},
"typeVersion": 1
},
{
"id": "cf864de0-57a5-4537-b42c-5ad12da49d01",
"name": "get table details",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
540,
860
],
"parameters": {},
"typeVersion": 2.1
},
{
"id": "01300da8-259d-43ca-9185-2f16cf7e2913",
"name": "ReadTableRows",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
480,
1020
],
"parameters": {},
"typeVersion": 2.1
},
{
"id": "9bdb7802-23ad-45d2-a35e-1de546aa8903",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
1320
],
"parameters": {
"content": ""
},
"typeVersion": 1
}
],
"active": true,
"settings": {},
"versionId": "ab18f1aa-d451-4aa8-b682-e8d3ab6697b7",
"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
}
]
]
},
"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
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Enable AI-driven conversations with your PostgreSQL database using a secure and visual-free agent powered by n8n’s Model Context Protocol (MCP). This template allows users to ask multiple KPIs in a single message, returning consolidated insights — more efficient than the…
Source: https://n8n.io/workflows/3892/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
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
Splitout Redis. Uses executeWorkflowTrigger, n8n, redis, splitOut. Event-driven trigger; 46 nodes.
3770. Uses executeWorkflowTrigger, n8n, redis, agent. Event-driven trigger; 46 nodes.
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
Learn how to build an MCP Server and Client in n8n with official nodes.