{
  "name": "Build your own PostgreSQL MCP server",
  "nodes": [
    {
      "id": "0c49141e-128c-424e-afdf-ea131b7a3dd8",
      "name": "GetTableSchema",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        -460,
        220
      ]
    },
    {
      "id": "8ffeefb9-357c-41bc-8239-0c07c706be97",
      "name": "ListTables",
      "type": "n8n-nodes-base.postgresTool",
      "position": [
        -340,
        300
      ]
    },
    {
      "id": "efcf7ff3-976e-448a-9d47-47a98f3b0fcb",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        280,
        200
      ]
    },
    {
      "id": "abd292d7-fc2b-4e98-a474-b50e44d16b6c",
      "name": "CreateTableRecords",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -240,
        400
      ]
    },
    {
      "id": "4a71d42a-99a5-489e-b449-09c3c5081505",
      "name": "ReadTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        760,
        0
      ]
    },
    {
      "id": "bdc60aa8-9ab1-4bbd-8b9e-89c968d54043",
      "name": "Operation",
      "type": "n8n-nodes-base.switch",
      "position": [
        460,
        200
      ]
    },
    {
      "id": "cdb5b556-3638-4fa5-94c6-bff0c03f6c89",
      "name": "UpdateTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        760,
        400
      ]
    },
    {
      "id": "9263fc78-321e-4c83-90d3-890dd87d6aed",
      "name": "UpdateTableRecords",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -100,
        320
      ]
    },
    {
      "id": "dd7e28fb-b2c7-4084-bc9b-9aa3e0187682",
      "name": "CreateTableRecord",
      "type": "n8n-nodes-base.postgres",
      "position": [
        760,
        200
      ]
    },
    {
      "id": "324503c0-117b-45ec-97dd-7074eb1db22e",
      "name": "ReadTableRows",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        20,
        240
      ]
    },
    {
      "id": "9cf39ca3-b704-49ce-b6e2-db2703c4acad",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -120
      ],
      "parameters": {
        "width": 680,
        "height": 660,
        "content": "## 1. Set up an MCP Server Trigger\n[Read more about the MCP Server Trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger)"
      }
    },
    {
      "id": "ac3d9b98-8f1e-4abd-972c-1725aac1ad1e",
      "name": "PostgreSQL MCP Server",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        -340,
        20
      ]
    },
    {
      "id": "416a09d5-c327-410d-b951-a2d08402c6fe",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -120
      ],
      "parameters": {
        "width": 820,
        "height": 720,
        "content": "## 2. Keep Secure by Preventing Raw SQL Statements\n[Read more about the PostgreSQL Node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.postgres/)\n\nWhilst it may be easier to just l"
      }
    },
    {
      "id": "0187fb3f-4c31-461d-84e9-4a4a0bf4188d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -560
      ],
      "parameters": {
        "width": 440,
        "height": 1320,
        "content": "## Try It Out!\n### This n8n demonstrates how to build a simple PostgreSQL MCP server to manage your PostgreSQL database such as HR, Payroll, Sale, Inventory and More!\n\nThis MCP example is based off an"
      }
    },
    {
      "id": "bc4e427f-f6fd-4243-844a-8edf2dc1a0e9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        -240
      ],
      "parameters": {
        "width": 380,
        "height": 100,
        "content": "### Always Authenticate Your Server!\nBefore going to production, it's always advised to enable authentication on your MCP server trigger."
      }
    }
  ],
  "connections": {
    "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
          }
        ]
      ]
    },
    "ReadTableRows": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GetTableSchema": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ReadTableRecord": {
      "main": [
        []
      ]
    },
    "CreateTableRecords": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "UpdateTableRecords": {
      "ai_tool": [
        [
          {
            "node": "PostgreSQL MCP Server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Operation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}