Use your n8n workflows as agent tools
Give an agent the workflows of your own n8n as tools, and choose per agent which ones it may run.
This is the opposite direction of the n8n node, which lets a workflow call 2kw.ai. Here an agent calls a workflow. n8n's own MCP Server Trigger publishes the workflows as an MCP server, and the agent uses that server as a connector. 2kw.ai does not host n8n: the n8n is yours, with its own licence and its own access rules.
Build the workflow
- Create a workflow that starts with an MCP Server Trigger node, node version 2 or later. Version 1.x speaks an older transport that 2kw.ai does not support.
- Set the trigger's authentication to Bearer and create a credential with a long random token. Never publish a trigger with authentication set to None.
- Attach one Custom n8n Workflow Tool to the trigger for each workflow an agent may run. Give each a clear name and description, and declare its inputs: the agent sees the name and the inputs, and the model decides from them when to call it.
- Publish the workflow. The trigger's Production URL is the address of the connector.
Every tool attached to the trigger can be reached by whoever holds its token, so attach only workflows you are willing to expose.
Add it to the connector relay
A trigger on your own network or behind a firewall is reached through a connector relay that you run and that connects out to 2kw.ai. An organization admin sets the relay up; see Relays in the CLI reference. List the trigger in the relay's file in service mode, where the relay holds the token and adds it to every request:
servers:
- name: n8n-tools
type: http
url: https://n8n.example.com/mcp/2kw-tools
auth:
mode: service
headers:
Authorization: Bearer ${N8N_MCP_TOKEN}
Set N8N_MCP_TOKEN in the relay's environment or mount it as a secret. 2kw.ai never receives the token.
A wrong or rotated token never asks anyone to sign in. A call fails as a tool error that names the relay and points to the organization admin, and the agent carries on. An approval someone decided while the token was wrong is refused and stays pending: decide it again once IT has updated the relay's secret.
Add the connector to an agent
- In the agent editor, open Connectors, choose Add connector and then Private network, and pick the trigger from the relay's list.
- Choose Test connection. Every attached workflow appears as a tool.
- Under Tools, choose Only these and tick the workflows this agent may run. See Connectors for the entry's fields.
n8n sends no read-only hints, so 2kw.ai treats every workflow as a write. Each call needs approval: in Ask a person approves it, in Auto it still goes to a person, and in Plan it is blocked. You can set a workflow to Blocked per agent.
A workflow that the n8n owner adds later reaches no agent that uses Only these until its author ticks it. An agent on All gets it at the connector's default level.
What a workflow receives and returns
- Arguments arrive as the trigger lists them. The tool's declared inputs are the arguments.
- Files in. When the model sets an argument to
backbone:file:<id>, the workflow receives that file as base64. Use n8n's Convert to File node to turn it into binary data. One call carries at most 10 files, 5 MiB of file data and 7 MiB of arguments; over a limit the call is refused and nothing is sent. See Files. - Results are text, usually JSON, up to 100,000 characters. An error in the workflow reaches the model as a tool error it can read.
- Files out are not supported. A workflow that creates a file returns a link or an id in its text.
Time limits
A call, including the connection setup, has to finish in under 60 seconds. A longer workflow fails with a timeout error, and because the workflow may still have run, 2kw.ai never retries a cut write. For slow work, let the workflow answer at once with a reference such as "started, reference 4711" and carry on by itself. Anything it reports later is a separate notification, not a continuation of the agent's turn.
A call the user cancels, or that times out, may still finish in n8n. Make workflows with side effects idempotent on their inputs.
Slow workflows called in parallel can wait for a free relay slot. Raise concurrency.calls in the relay's file (default 8) if calls queue up.
Queue mode
If your n8n runs in queue mode with several webhook replicas, route /mcp* to a single webhook replica.
Splitting tools between agents
Only these is a choice per agent, enforced by 2kw.ai, inside one trigger. Anyone with the trigger's token sees every tool on it. For a hard split, such as finance workflows kept apart from sales workflows, build two triggers with two tokens and add them as two connectors.