Skip to content
← Notebook

Automation & Agents

Bidirectional n8n + MCP: From Static Workflows to an Autonomous Agent Hub

How to turn your business automations into live tools that Claude Code, Cursor and autonomous agents can call through the Model Context Protocol.

Date
Oct 2, 2026
Reading time
6 min
Result
Bidirectional • Dynamic Tool Discovery • Latency <150ms • Zero Rigid Webhooks

Translated from the Spanish original. The code, data and READMEs on GitHub are in Spanish.

Traditional webhooks and rigid linear automations have become the main bottleneck when building AI agents in production environments.

In the classic architecture, a webhook responds with a blind payload to a fixed endpoint (https://.../webhook/stripe). But modern language models (Claude 3.7 / Claude Code, Cursor, Hermes) don’t work with static triggers: they need to reason about which tools exist, inspect their parameters and receive structured responses in real time.

That’s where n8n’s native, bidirectional support for the Model Context Protocol (MCP) comes in.


1. The Problem in the Trenches: Webhooks vs the MCP Protocol

In traditional integrations:

  • Zero introspection: The AI model doesn’t know what inputs a webhook needs until someone writes a manual prompt.
  • Fragile maintenance: Any change to an API’s schema breaks the chain.
  • One-way only: There’s no standard way for the agent to receive typed errors or retry parameters.
[ Old Architecture - Blind Webhooks ]
┌──────────────┐   Blind POST (no schema)    ┌────────────────┐
│ AI agent     ├────────────────────────────►│ n8n webhook    │ ➔ Rigid and failure-prone
└──────────────┘                             └────────────────┘

[ Modern Architecture - n8n as an MCP Hub ]
┌──────────────┐   1. Discovery (tools/list)  ┌────────────────┐
│ Claude Code  ├────────────────────────────►│ MCP Server     │
│ Cursor / AI  │◄────────────────────────────┤ Trigger (n8n)  │ ➔ Typed JSON schema
│              │   2. Call (tools/call)      │                │
│              ├────────────────────────────►│ n8n subflow    │ ➔ Controlled execution
└──────────────┘                             └────────────────┘

2. Both Directions of the Flow: Server and Client

n8n doesn’t just let an agent call a workflow; it also lets n8n workflows call agents and external tools.

A. Server Mode (Outbound - MCP Server Trigger)

Turns any subflow or set of nodes into a standard MCP tool.

  • Node: n8n-nodes-langchain.mcptrigger
  • Transport: Server-Sent Events (SSE) or Streamable HTTP with Bearer token authentication.
  • Tool Node: Attached to Custom n8n Workflow Tool nodes to package critical operations (e.g. checking stock, issuing invoices, updating the CRM).
{
  "name": "consultar_pedidos_cliente",
  "description": "Devuelve el histórico de pedidos recientes y estado de entrega dado un email o ID de cliente.",
  "parameters": {
    "type": "object",
    "properties": {
      "customer_email": { "type": "string", "description": "Email corporativo del cliente" },
      "limit": { "type": "integer", "default": 5 }
    },
    "required": ["customer_email"]
  }
}

(The tool definition is kept as in the original: a consultar_pedidos_cliente, “get customer orders”, tool whose description says it returns the recent order history and delivery status for a customer email or ID.)

B. Client Mode (Inbound - MCP Client Tool)

Lets an AI Agent node inside n8n connect to remote or local MCP servers (such as file servers, SQLite WAL databases or third-party APIs) and use their capabilities without writing ad-hoc integrations.


3. Connecting Claude Desktop / Claude Code to n8n MCP

Since many desktop clients use stdio transport while n8n exposes HTTP/SSE endpoints, the standard bridge is mcp-remote:

{
  "mcpServers": {
    "n8n-production-hub": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://n8n.tu-dominio.com/mcp/production",
        "--header",
        "Authorization: Bearer ${N8N_MCP_TOKEN}"
      ],
      "env": {
        "N8N_MCP_TOKEN": "sk-yeswelab-sec-9921"
      }
    }
  }
}

4. The Lab’s Dual Track Philosophy

At YesWeLab we apply the Show, Don’t Sell principle by evaluating both implementation routes:

  • Track A (DIY / Open Source - Full Control & Privacy):

    • n8n Community deployed in local Docker.
    • Direct connection to local MCP servers (SQLite in WAL mode, bash scripts and a Python sandbox).
    • Zero data exposed to external clouds and $0 infrastructure cost.
  • Track B (Fast-Track SaaS - Immediate Time-to-Market):

    • n8n Cloud with managed auto-scaling.
    • Direct orchestration with Claude Code / Cursor to expose business tools in minutes.
    • Ideal for validating workflows with clients without worrying about server monitoring.

5. Conclusion and Next Steps

The Model Context Protocol is the glue that turns disconnected collections of APIs into an intelligent, autonomous ecosystem. Setting up n8n as an MCP hub lets any team scale its AI operations while keeping absolute control over which code runs and which data is shared.

#n8n v1.88+#Model Context Protocol (MCP)#Claude Code#Docker#SQLite WAL