n8n MCP Server: Expose Workflows as AI Agent Tools
Use the n8n MCP Server Trigger to expose workflows as AI tools, and the MCP Client Tool to call external servers, with auth, scoping and safety guidance.
Executive Summary: n8n speaks the Model Context Protocol in both directions. The MCP Server Trigger turns selected workflows into tools that any MCP client, such as Claude Desktop or an IDE assistant, can call. The MCP Client Tool lets an n8n AI agent use tools from external MCP servers. Setting up an n8n MCP server takes minutes; making it safe takes deliberate choices about which tools to expose, how to authenticate callers and how to keep tool results small. This guide covers both directions and the guardrails I apply.
Picture a developer asking an AI assistant in their editor, “Has the nightly build passed, and who is on call?” The assistant does not know. However, an n8n workflow does: it already queries the CI system and reads the on-call rota. The only missing piece is a standard way for the assistant to call that workflow.
In short, that missing piece is the Model Context Protocol, or MCP. It gives AI clients a common way to discover and call tools, so you do not build a custom integration for every assistant. If MCP itself is new to you, my MCP guide explains the protocol, and my post on MCP for AI agents covers how agents use it.
This article focuses on n8n. It explains how to run an n8n MCP server that exposes workflows as tools, how to consume external MCP servers from n8n agents and how to do both without creating a new security hole.
Two Directions, Two Nodes
| Direction | Node | What it does | Available since |
|---|---|---|---|
| n8n as server | MCP Server Trigger | Exposes attached tools at an MCP URL for external clients | n8n 1.88.0, April 2025 |
| n8n as client | MCP Client Tool | Lets an n8n AI agent call tools on an external MCP server | n8n 1.88.0, April 2025 |
Both nodes arrived in the same release, according to the n8n 1.88.0 release notes. Streamable HTTP transport for the server side followed in mid-2025, alongside the original Server-Sent Events transport. A standalone MCP Client node, for calling MCP tools outside an agent, arrived later in 2025.
Running an n8n MCP Server
First, note that the MCP Server Trigger behaves differently from other triggers. It does not pass data to the next node. Instead, you attach tool sub-nodes to it, and those tools become what MCP clients see.
Step 1: Add the trigger and set a path
Create a workflow with an MCP Server Trigger. Like the Webhook node, it has a test URL and a production URL, and it generates a random path by default. Set a meaningful path, such as mcp/devops, because clients will store it in their configuration.
Step 2: Attach tools
Any tool node can attach to the trigger. However, the most useful is the Call n8n Workflow Tool. It exposes a complete sub-workflow as one tool. The sub-workflow can validate input, call several systems, handle errors and return a clean answer. That is far safer than exposing raw API access.
For example, for the build-status case I would create two sub-workflows: get_build_status, which queries the CI system for the latest pipeline run, and get_on_call, which reads the rota. Each returns a few fields, not a full API response.
Step 3: Require authentication
Choose Bearer auth or Header auth on the trigger, backed by a credential with a long random token. An n8n MCP server without authentication lets anyone with the URL run your tools. Treat the token like an API key: one per client where possible, stored in the client’s secret store and rotated when people leave.
Step 4: Publish and connect a client
Next, publish the workflow to register the production URL. Clients that support remote MCP servers can connect directly. For clients that only support local stdio servers, such as some desktop apps, n8n’s documentation shows how to use a gateway like mcp-remote:
{
"mcpServers": {
"n8n-devops": {
"command": "npx",
"args": [
"mcp-remote",
"https://n8n.example.com/mcp/devops",
"--header",
"Authorization: Bearer ${AUTH_TOKEN}"
],
"env": {
"AUTH_TOKEN": "replace-with-a-secret-from-your-vault"
}
}
}
}
Once connected, the client then lists your tools with their names and descriptions. The MCP Server Trigger documentation covers transports, authentication options and client examples.
Designing Tools That Models Use Well
An MCP tool is only as good as its contract. Models choose and call tools based on names, descriptions and input schemas, so design those deliberately.
- Name tools as verbs with objects.
get_build_statusis clearer thanci_tool. - Describe when to use the tool. “Returns the status of the latest pipeline for a given repository. Use this for questions about whether a build passed.” tells the model exactly when to call it.
- Keep inputs few and typed. A repository name and an optional branch are enough. Avoid free-form “query” parameters that the tool then interprets.
- Return small, structured results. A status, a timestamp and a link beat a 200 KB JSON dump that floods the model’s context.
- Fail with useful messages. “Repository not found: payments-api” helps the model recover; a stack trace does not.
Result size also matters for a second reason. In queue mode, tool results travel back from workers through Redis, and n8n enforces a maximum size on that relay. An oversized result reaches the client as a tool error. Small results avoid the problem entirely.
Using External MCP Servers from n8n
Meanwhile, the other direction is just as useful. The MCP Client Tool attaches to an AI Agent node and connects to an external MCP server. The agent can then call that server’s tools as if they were native n8n tools.
To set it up, configure the server’s endpoint and authentication, then choose which tools to include. You can include all tools, only selected tools or all tools except some. Always prefer an explicit selection. An external server might add a destructive tool in a future version, and “include all” would hand it to your agent without review.
This is how an n8n AI agent can, for example, use a documentation server, a ticketing server and your own internal servers in one conversation, without custom HTTP integrations for each.
Security: An MCP Server Is an API
Above all, avoid the easiest mistake, which is to think of an MCP server as a chat feature. It is an API that executes workflows, often with access to production systems. Apply the same controls you would apply to any API.
| Risk | Control |
|---|---|
| Unauthorised callers | Bearer or header auth on every production MCP Server Trigger |
| Overly powerful tools | Expose sub-workflows with narrow purposes, read-only by default |
| Prompt injection through data | Treat tool inputs as untrusted; validate and constrain them in the sub-workflow |
| Destructive actions | Require a human approval step inside the sub-workflow for anything irreversible |
| Unclear audit trail | Log the tool name, input and caller in every sub-workflow |
In particular, prompt injection deserves special mention. A model calling your tool might have read a malicious document that told it to request something harmful. Your tool cannot see that context, so it must enforce its own rules. My articles on prompt injection in agents and tool sandboxing and least privilege go deeper on both risks.
n8n has also been previewing instance-level MCP access, which exposes chosen workflows from a whole instance through one endpoint. The same principles apply there: opt workflows in deliberately, scope access and review what each exposed workflow can touch.
Testing an n8n MCP Server Before You Share It
Before you hand an MCP URL to colleagues, test it the way a client will use it. A short routine catches most problems.
- Test each tool alone. Run every sub-workflow directly with pinned inputs, including bad ones: a missing repository, an empty branch or an unexpected type. Confirm the error messages are short and useful.
- Connect one client. Use the test URL first, ask the assistant a question that should trigger each tool and watch the execution appear on the canvas.
- Read the model’s choices. If the assistant picks the wrong tool, improve the descriptions rather than adding more tools.
- Try to misuse it. Ask the assistant to do something the tool should refuse, such as reading another team’s data. The sub-workflow, not the model, must block it.
- Check result sizes. Look at the output of each tool in the Executions list. If a result is large, trim it before publishing.
After publishing, keep an eye on the executions for the first few days. Unusual call patterns, such as one tool called many times in a row, usually point to a confusing description or a result the model cannot interpret.
A small example from my own work shows why this matters. My editorial pipeline has a sub-workflow that searches existing posts. Exposed as an MCP tool, it lets any assistant check for overlap before suggesting a topic. If that tool returned full post bodies, answers would be slow and noisy. Returning only titles, URLs and dates keeps them fast and focused. Small results are not an optimisation; they are part of the tool’s design.
Where an n8n MCP Server Fits Best
An n8n MCP server shines when you already have workflows that encapsulate real business knowledge: checking a build, looking up a customer, creating a ticket with the right fields. MCP makes that knowledge available to every assistant your team uses, without rebuilding it for each one.
On the other hand, it fits less well as a thin proxy over a single API that already has an official MCP server. In that case, use the official server and spend your effort on the workflows that only your organisation can build.
Frequently Asked Questions
How do I expose an n8n workflow as an MCP tool?
Create a workflow with an MCP Server Trigger, attach a Call n8n Workflow Tool that points to your sub-workflow, enable authentication and publish. Clients then connect to the production MCP URL.
Can n8n use tools from other MCP servers?
Yes. Attach the MCP Client Tool to an AI Agent node, point it at the external server and select the tools to include.
Does the MCP Server Trigger work in queue mode?
Yes, but keep tool results small, because results from workers pass through a size-limited relay. Check the queue mode documentation for routing guidance when you run several webhook processes.
Expose Knowledge, Not Access
The best n8n MCP servers expose carefully designed capabilities, not raw access to systems. Wrap each capability in a sub-workflow, describe it precisely, authenticate every caller and keep results small. Do that, and every AI assistant in your organisation can use the automation you have already built, safely.
Last updated on 29 November 2026