AutomationFlowsWeb Scraping › Ncp Turn Lifecycle (n8n)

Ncp Turn Lifecycle (n8n)

NCP Turn Lifecycle (n8n). Uses httpRequest. Event-driven trigger; 7 nodes.

Event trigger★★★★☆ complexity7 nodesHTTP Request
Web Scraping Trigger: Event Nodes: 7 Complexity: ★★★★☆ Added:

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
{
  "name": "NCP Turn Lifecycle (n8n)",
  "nodes": [
    {
      "parameters": {},
      "id": "1f6f0e1a-0001-4a9e-8b1a-000000000001",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -200,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "baseUrl",
              "type": "string",
              "value": "http://localhost:4242"
            },
            {
              "id": "a2",
              "name": "authToken",
              "type": "string",
              "value": "REPLACE_WITH_NCP_AUTH_TOKEN"
            },
            {
              "id": "a3",
              "name": "pipelineId",
              "type": "string",
              "value": "pipe_n8n_demo"
            },
            {
              "id": "a4",
              "name": "agentId",
              "type": "string",
              "value": "n8n_worker"
            },
            {
              "id": "a5",
              "name": "task",
              "type": "string",
              "value": "summarize_ticket_queue"
            }
          ]
        },
        "options": {}
      },
      "id": "1f6f0e1a-0002-4a9e-8b1a-000000000002",
      "name": "Set Workflow Variables",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        20,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $json.baseUrl }}/mcp",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.authToken }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  jsonrpc: \"2.0\",\n  id: 1,\n  method: \"tools/call\",\n  params: {\n    name: \"ncp_get_context\",\n    arguments: {\n      agent_id: $json.agentId,\n      role: \"build\",\n      task: $json.task,\n      slot: \"queue_summary\",\n      intent: \"advance\",\n      pipeline_id: $json.pipelineId,\n      max_tokens: 1200,\n      ctx_used: 0.0\n    }\n  }\n}) }}",
        "options": {}
      },
      "id": "1f6f0e1a-0003-4a9e-8b1a-000000000003",
      "name": "ncp_get_context",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const rpcResult = $input.first().json;\nconst rawText = rpcResult.result.content[0].text;\nconst toolResult = JSON.parse(rawText);\n\nreturn [{\n  json: {\n    baseUrl: $('Set Workflow Variables').first().json.baseUrl,\n    authToken: $('Set Workflow Variables').first().json.authToken,\n    pipelineId: $('Set Workflow Variables').first().json.pipelineId,\n    agentId: $('Set Workflow Variables').first().json.agentId,\n    task: $('Set Workflow Variables').first().json.task,\n    context: toolResult.context,\n    session_id: toolResult.session_id,\n    pending_whisper_ids: toolResult.pending_whisper_ids || [],\n    telemetry: toolResult.telemetry || {}\n  }\n}];"
      },
      "id": "1f6f0e1a-0004-4a9e-8b1a-000000000004",
      "name": "Extract Context",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.example-llm-provider.com/v1/chat/completions",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.llmApiKey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  model: \"replace-with-your-model\",\n  messages: [\n    { role: \"system\", content: $json.context },\n    { role: \"user\", content: \"Summarize the open ticket queue and propose next actions.\" }\n  ]\n}) }}",
        "options": {}
      },
      "id": "1f6f0e1a-0005-4a9e-8b1a-000000000005",
      "name": "LLM Call (placeholder)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        0
      ],
      "notes": "Stand-in for whatever model call your workflow uses. Replace url/body with your provider; keep $json.context as the system prompt and pass through pipelineId/agentId/task/session_id/pending_whisper_ids to the next node."
    },
    {
      "parameters": {
        "jsCode": "const prev = $('Extract Context').first().json;\nconst llmResponse = $input.first().json;\n\nconst resultText = llmResponse.choices && llmResponse.choices[0]\n  ? llmResponse.choices[0].message.content\n  : \"REPLACE_WITH_LLM_OUTPUT\";\n\nreturn [{\n  json: {\n    baseUrl: prev.baseUrl,\n    authToken: prev.authToken,\n    pipelineId: prev.pipelineId,\n    agentId: prev.agentId,\n    task: prev.task,\n    pending_whisper_ids: prev.pending_whisper_ids,\n    result_summary: resultText.slice(0, 120),\n    result_full: resultText\n  }\n}];"
      },
      "id": "1f6f0e1a-0006-4a9e-8b1a-000000000006",
      "name": "Prepare Turn Result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $json.baseUrl }}/mcp",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.authToken }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  jsonrpc: \"2.0\",\n  id: 2,\n  method: \"tools/call\",\n  params: {\n    name: \"ncp_post_turn\",\n    arguments: {\n      agent_id: $json.agentId,\n      role: \"build\",\n      task: $json.task,\n      slot: \"queue_summary\",\n      intent: \"advance\",\n      pipeline_id: $json.pipelineId,\n      result_summary: $json.result_summary,\n      result_full: $json.result_full,\n      ack_whisper_ids: $json.pending_whisper_ids\n    }\n  }\n}) }}",
        "options": {}
      },
      "id": "1f6f0e1a-0007-4a9e-8b1a-000000000007",
      "name": "ncp_post_turn",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        0
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Workflow Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Workflow Variables": {
      "main": [
        [
          {
            "node": "ncp_get_context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ncp_get_context": {
      "main": [
        [
          {
            "node": "Extract Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Context": {
      "main": [
        [
          {
            "node": "LLM Call (placeholder)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Call (placeholder)": {
      "main": [
        [
          {
            "node": "Prepare Turn Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Turn Result": {
      "main": [
        [
          {
            "node": "ncp_post_turn",
            "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

NCP Turn Lifecycle (n8n). Uses httpRequest. Event-driven trigger; 7 nodes.

Source: https://github.com/kulkarni2u/neural-context-protocol/blob/7ab91def50bcabf72ff5efb411bc25dd1e41996c/examples/08_n8n/ncp_turn_workflow.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

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

Web Scraping

This workflow listens for an “Approved” label on a Trello card, reads the AI draft bookkeeping JSON from card comments, and posts the corresponding transaction to Xero. It then adds a Xero deep link b

Trello Trigger, HTTP Request
Web Scraping

02_LLM_Pipeline v1.0. Uses executeWorkflowTrigger, httpRequest, seaTable. Event-driven trigger; 65 nodes.

Execute Workflow Trigger, HTTP Request, Sea Table
Web Scraping

This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t

Execute Command, Read Write File, HTTP Request +3
Web Scraping

[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.

HTTP Request, GitHub, Stop And Error +1
Web Scraping

[](https://youtu.be/c7yCZhmMjtI)

HTTP Request, GitHub, Stop And Error +1