Skip to main content

Build your own N8N workflows MCP server

Workflow preview

Workflow preview
100%
Build your own N8N workflows MCP server preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template shows you how to create an MCP server out of your existing n8n workflows. With this, any MCP client connected can get more done with powerful end to end workflows rather than just...

Best for

  • Engineering automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.set, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.switch, n8n-nodes-base.n8n, n8n-nodes-base.filter, n8n-nodes-base.redis, n8n-nodes-base.splitout, n8n-nodes-base.aggregate

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Jimleuk.

Original n8n.io source

1.1 Workflow description

Title
Build your own N8N workflows MCP server
Workflow name
Build your own N8N workflows MCP server

This n8n template shows you how to create an MCP server out of your existing n8n workflows. With this, any MCP client connected can get more done with powerful end-to-end workflows rather than just simple tools.

Designing agent tools for outcome rather than utility has been a long recommended practice of mine and it applies well when it comes to building MCP servers; In gist, agents to be making the least amount of calls possible to complete a task.

This is why n8n can be a great fit for MCP servers! This template connects your agent/MCP client (like Claude Desktop) to your existing workflows by allowing the AI to discover, manage and run these workflows indirectly.

How it works

  • An MCP trigger is used and attaches 4 custom workflow tools to discover and manage existing workflows to use and 1 custom workflow tool to execute them.
  • We'll introduce an idea of "available" workflows which the agent is allowed to use. This will help limit and avoid some issues when trying to use every workflow such as clashes or non-production.
  • The n8n node is a core node which taps into your n8n instance API and is able to retrieve all workflows or filter by tag. For our example, we've tagged the workflows we want to use with "mcp" and these are exposed through the tool "search workflows".
  • Redis is used as our main memory for keeping track of which workflows are "available". The tools we have are "add Workflow", "remove workflow" and "list workflows". The agent should be able to manage this autonomously.
  • Our approach to allow the agent to execute workflows is to use the Subworkflow trigger. The tricky part is figuring out the input schema for each but was eventually solved by pulling this information out of the workflow's template JSON and adding it as part of the "available" workflow's description. To pass parameters through the Subworkflow trigger, we can do so via the passthrough method - which is that incoming data is used when parameters are not explicitly set within the node.
  • When running, the agent will not see the "available" workflows immediately but will need to discover them via "list" and "search". The human will need to make the agent aware that these workflows will be preferred when answering queries or completing tasks.

How to use

  • First, decide which workflows will be made visible to the MCP server. This example uses the tag of "mcp" but you can all workflows or filter in other ways.
  • Next, ensure these workflows have Subworkflow triggers with input schema set. This is how the MCP server will run them.
  • Set the MCP server to "active" which turns on production mode and makes available to production URL.
  • Use this production URL in your MCP client. For Claude Desktop, see the instructions here - https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger/#integrating-with-claude-desktop.
  • There is a small learning curve which will shape how you communicate with this MCP server so be patient and test. The MCP server will work better if there is a focused goal in mind ie. Research and report, rather than just a collection of unrelated tools.

Requirements

  • N8N API key to filter for selected workflows.
  • N8N workflows with Subworkflow triggers!
  • Redis for memory and tracking the "available" workflows.
  • MCP Client or Agent for usage such as Claude Desktop - https://claude.ai/download

Customising this workflow

  • If your targeted workflows do not use the subworkflow trigger, it is possible to amend the executeTool to use HTTP requests for webhooks.
  • Managing available workflows helps if you have many workflows where some may be too similar for the agent. If this isn't a problem for you however, feel free to remove the concept of "available" and let the agent discover and use all workflows!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Simplify Workflows

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 2 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 3 - Operations

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 4 - Get MCP-tagged Workflows

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 5 - Filter Matching Ids

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 6 - Store In Memory

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 7 - AddTool Success

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - AddTool Error

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Get Memory

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 10 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 11 - Filter Matching IDs

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 12 - Store In Memory1

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 13 - Remove Tool Success

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 14 - Convert to JSON

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - listTools Success

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 16 - Get MCP-tagged Workflows1

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 17 - Simplify Workflows1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 18 - listTools Success1

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 19 - Get Parameters

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - executeTool Result

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 21 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 22 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 23 - MCP Client

Type / Role
@n8n/n8n-nodes-langchain.mcpClientTool - mcpClientTool
Config choices
Version 1

Block 24 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Showing the first 24 of 46 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Build your own N8N workflows MCP server
Complexity advanced
Nodes 46
Categories Engineering, AI RAG
Author Jimleuk
Published 28 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3770/3770.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Build your own N8N workflows MCP server do?

This n8n template shows you how to create an MCP server out of your existing n8n workflows. With this, any MCP client connected can get more done with powerful end to end workflows rather than just...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI RAG use case.