{
  "id": "JVS2oSR8h2s2imQ7",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Notion MCP server",
  "tags": [],
  "nodes": [
    {
      "id": "b73a14c4-935a-4c26-a0e9-0180a91d3c96",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        140,
        0
      ],
      "parameters": {
        "options": {
          "allowFileUploads": false
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "caa0a241-ef95-4ebb-8923-4fa30506e382",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        540,
        220
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "37b5cd8f-303e-4898-95c6-09331ffe310a",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        360,
        220
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-pro-preview-06-05"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8941aabf-a565-41db-a898-4f390f93a63c",
      "name": "AI Task Planner",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are a helpful assistant. \n\nYou have access to my Notion workspace. You can retrieve the list of available Notion tools using the node \u201cNotion - list tools\u201d.\n\nHere is the ID of my task database:20d45c70c57381f09418d42c78ad360b. \n\nIf you need to interact with a database, first use your tools to get its structure and properties. Never ask for the properties if you can obtain them by yourself. \n\nAlso avoid to ask the exact names of pages to the user. Use the context you have to determine the pages that should be impacted. "
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "9150e740-e736-4001-b597-ded0b9046148",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 420,
        "height": 360,
        "content": "## Create an AI assistant connected to Notion\n\nChat with your AI assistant and let it interact with your Notion workspace: ask information stored in Notion, create task, add content, create databases ...\n\n![Your AI Agent in action](https://lh3.googleusercontent.com/d/18Io1JU1E1_Z0a0jMqwleRqInkYFllZkQ)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "44732fe4-2eaa-46be-b17f-ac72a77faeb9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -420,
        400
      ],
      "parameters": {
        "color": 3,
        "height": 100,
        "content": "**Disclaimer**\nThis templates is only available in self-hosted as it requires a community node."
      },
      "typeVersion": 1
    },
    {
      "id": "bd201c87-d79d-45f0-a2ca-f4233c2e9390",
      "name": "Notion - execute tool",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        900,
        220
      ],
      "parameters": {
        "toolName": "={{ $fromAI(\"tool\", \"the tool selected\")  }}",
        "operation": "executeTool",
        "toolParameters": "={{ $fromAI('tool_parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "076db3c9-7240-4936-94ef-67b47180d08d",
      "name": "Notion - list tools",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "notes": "Asks Notion what tools are available (e.g. add content to a page, create a database, etc.)\n",
      "position": [
        740,
        220
      ],
      "parameters": {},
      "credentials": {
        "mcpClientApi": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "498d567b-abb2-44a6-a17f-709d1374b1da",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        360
      ],
      "parameters": {
        "width": 160,
        "height": 200,
        "content": "**Setup step 1** - Enter your Chat model API key.\n\nGemini is used in this example but you can use the model of your choice."
      },
      "typeVersion": 1
    },
    {
      "id": "0d052137-f2e7-4abf-ba69-dc923a136e12",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        360
      ],
      "parameters": {
        "width": 400,
        "height": 80,
        "content": "**Setup step 2** - Install the [n8n-nodes-mcp community node](https://www.npmjs.com/package/n8n-nodes-mcp). [How to install a community node](https://docs.n8n.io/integrations/community-nodes/installation/)."
      },
      "typeVersion": 1
    },
    {
      "id": "9215b268-c0aa-49e1-8818-20760c631d69",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        460
      ],
      "parameters": {
        "width": 400,
        "height": 380,
        "content": "**Setup step 3** - Enter your credentials for the Notion MCP server. \n\nCommand=npx\nArguments=-y @notionhq/notion-mcp-server\nEnvironment=(keep it empty) \n\nThe environment field is not compatible with the Notion MCP server env variables. So you'll need to pass the env variables differently. \n\nFor **Docker**, add the the following command when starting your docker instance: \n -e OPENAPI_MCP_HEADERS={\u201cAuthorization\u201d:\u201cBearer YOUR_TOKEN_HERE\u201d, \u201cNotion-Version\u201d:\u201c2022-06-28\u201d} \n\nWhere ntn_xxx is your notion integration secret. [Check the installation guide to generate it](https://github.com/makenotion/notion-mcp-server)."
      },
      "typeVersion": 1
    },
    {
      "id": "ac03f02c-6646-4a79-9196-5b258526a471",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        160
      ],
      "parameters": {
        "width": 220,
        "height": 180,
        "content": "**Setup step 4** - Click on \"open chat\" below and start interacting with your assistant.\n\nNote: be cautious regarding the pages you give your AI assistant access to. "
      },
      "typeVersion": 1
    },
    {
      "id": "82d94df8-50e3-4228-91a3-af515a39315a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -140
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 120,
        "content": "**Tip**\nGive some context to your AI agent by completing the system message in the AI Task Planner node."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "37656e91-d524-493c-a52d-70a5afb6f671",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Task Planner",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Notion - list tools": {
      "ai_tool": [
        [
          {
            "node": "AI Task Planner",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Notion - execute tool": {
      "ai_tool": [
        [
          {
            "node": "AI Task Planner",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Task Planner",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Task Planner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}