Skip to main content

Overview

n8n can sit in front of a hosted MCP server as a lightweight workflow layer. A common pattern is:
  1. Trigger the workflow from a Webhook, Manual Trigger, or Schedule Trigger.
  2. Normalize the incoming JSON, form data, or uploaded CSV in Code nodes.
  3. Call the MCP endpoint with an n8n MCP Client node or with HTTP Request nodes.
  4. Resolve stored outputs with result_get when a tool returns a result_id.
  5. Assemble a JSON, log, email, or chat response from sanitized result fields.

Safe Workflow Exports

Workflow exports can include API keys, credential IDs, email addresses, chat recipients, webhook paths, and delivery-service settings. Do not publish raw n8n workflow JSON unless it has been reviewed and scrubbed. When sharing a workflow:
  • Keep secrets in n8n Credentials or environment variables.
  • Replace webhook paths with examples such as my-factor-report.
  • Remove credential id / name blocks from exported nodes.
  • Remove delivery recipients and bot/channel identifiers.
  • Keep only endpoint URLs, tool names, request shapes, and routing notes.

Workflow Templates and Webhooks

The workflow JSON files below are sanitized templates: credential blocks, private recipients, private webhook identifiers, and literal secrets have been removed. Import them into your own n8n instance, then attach your own MCP Client credentials and delivery credentials.

MCP Client Node Pattern

Use this when your n8n installation has an MCP Client node that supports streamable HTTP. For example, a Statistical Factor Models workflow can route validated input to complete-panel-factor-extractor-fit, swfactor-extractor-fit, or bmfactor-extractor-fit through separate MCP Client nodes.

HTTP Request Node Pattern

Use this when you want explicit session control or need to call helper tools such as result_get.

1. Initialize

Store the mcp-session-id response header.

2. Send Initialized

Send it with the stored MCP-Session-Id header.

3. Call a Tool

Keep Content-Type: application/json and Accept: application/json, text/event-stream on every HTTP Request node. If the endpoint is protected, add the Authorization header through n8n Credentials instead of hard-coding it.

Webhook Pattern

For user-facing workflows, configure a Webhook Trigger with POST and responseMode: responseNode. Typical body shapes:
The workflow should validate input early and route errors to a Respond to Webhook node with {"ok": false, "error": "..."}.

Server Examples

Delivery

Keep delivery separate from MCP calls. The MCP nodes should produce structured JSON; delivery nodes can then send:
  • webhook JSON response;
  • n8n execution logs;
  • email report;
  • chat or bot notification;
  • saved CSV or image artifact.
Do not put delivery API keys or recipients into Code node constants. Use n8n Credentials, workflow variables, or environment variables.

Checklist

  • The MCP URL is the server-specific /mcp/... URL, not the /health URL.
  • Every tool payload is wrapped as {"request": {...}}.
  • Direct HTTP Request flows keep and reuse MCP-Session-Id.
  • Stored outputs are resolved with result_get before formatting reports.
  • Workflow exports are scrubbed before they are shared or committed.