MCP Fusion/Integrations and federation/n8n connector

n8n connector

Ask AI about Vinkius

Expose tagged n8n workflows as MCP tools: auto-discover webhooks, infer input schemas and refresh the agent tool list when workflows change.

n8n already contains the automation logic. MCP Fusion turns those workflows into an agent-facing connector without asking you to rewrite each workflow as TypeScript. The n8n package discovers webhooks, infers their input shape and synthesizes grouped tools.

Auto-discover tagged workflows

typescript
import { createN8nConnector } from '@mcpfusion/n8n';

const n8n = await createN8nConnector({
  url: process.env.N8N_URL!,
  apiKey: process.env.N8N_API_KEY!,
  includeTags: ['ai-enabled'],
  pollInterval: 60_000,
  onChange: () => server.notification({
    method: 'notifications/tools/list_changed',
  }),
});

for (const tool of n8n.tools()) {
  registry.register(defineTool(tool.name, tool.config));
}

The source config is intentionally small: url and apiKey are required; includeTags, excludeTags, timeout, pollInterval and onChange are optional. Tag filtering happens during discovery, so internal workflows never enter the connector surface.

What discovery does

WorkflowDiscovery reads the n8n workflows and identifies webhook-triggered flows. inferSchema turns the webhook payload into parameter definitions. synthesizeTool creates one tool, and synthesizeAll creates the full set. toToolName gives the workflow a deterministic MCP name.

When the poll detects a changed workflow, call notifications/tools/list_changed through onChange. The client reloads the surface without a redeploy of your connector code.

Manual tool definition

Discovery is convenient, but a stable public contract may be better written by hand:

typescript
import { defineN8nTool } from '@mcpfusion/n8n';

const sendInvoice = defineN8nTool({
  name: 'billing.send_invoice',
  workflowId: 'workflow_42',
  webhookPath: 'billing/send-invoice',
  method: 'POST',
  description: 'Send an invoice through the approved workflow',
  params: {
    invoice_id: { type: 'string', required: true },
    notify_customer: { type: 'boolean', required: false },
  },
  tags: ['billing'],
});

The manual config accepts workflowId, webhookPath, optional HTTP method, description, params, annotations and tags. You own the tool name and schema; n8n owns the workflow execution.

Security boundary

The API key is a connector credential, not a model argument. Store it with BYOC credentials, never in a prompt or a generated tool schema. Add auth middleware around the synthesized tools, filter tags by deployment, and attach Presenters when a workflow returns domain records. n8n does not automatically infer your tenant policy or redact arbitrary response fields.

Next steps