Operations & Systems
MCP Server setup w/ n8n workflows as mcp tools
This n8n workflow acts as an MCP Server. An OpenAI AI Agent interacts via ChatTrigger, using Redis for memory. It uses n8n's API to manage and expose other tagged n8n workflows as custom tools. The agent can add, remove, list, search, and execute these workflows dynamically via…
Built · ~7 hours saved per week
MCP Server for n8n Workflows
This workflow transforms an n8n instance into a powerful, AI-driven "MCP Server" (Meta-Circular Prompting Server). It allows a conversational AI agent to discover, manage, and execute other n8n workflows as if they were tools. The core value is enabling an AI to perform complex, end-to-end tasks by using the full power of n8n's automation capabilities, moving beyond simple, single-purpose tools.
Technologies Used
- n8n: The core automation platform. - n8n LangChain Nodes: Provides the AI agent, memory, and tool integration capabilities (AI Agent, MCPTrigger, MCPClient, toolWorkflow). - OpenAI: The Large Language Model (LLM) used by the AI Agent to reason and decide which actions to take. - Redis: An in-memory database used to maintain a dynamic list of "available" workflows that the AI agent is permitted to use. - n8n API: Used internally by the n8n node to fetch and inspect other workflows on the instance.
How the AI Integrates into the Flow
This workflow is fundamentally built around AI. The AI is not just a step in the process; it is the orchestrator that drives the entire system.
1. Conversational Interface: The AI Agent node, powered by an OpenAI Chat Model, acts as the brain. It receives user prompts through a ChatTrigger and uses its system prompt instructions to decide how to respond. 2. Dynamic Tool Use: The AI is given a set of custom "tools" (addWorkflow, removeWorkflow, listWorkflows, searchWorkflows, executeWorkflow). These aren't simple commands; they are toolWorkflow nodes that trigger this very same workflow to perform complex management and execution tasks. 3. Reasoning and Planning: The AI uses the listWorkflows and searchWorkflows tools to understand which capabilities are available. Based on the user's request, it can plan a multi-step process, such as adding a required workflow to its active pool and then executing it with the correct parameters. 4. Parameter Extraction: When the AI decides to execute a workflow, it generates the necessary parameters in a structured format.
Tags: Chatbot, Data Transformation, MCP
Integrations: Redis, AI Agent, Sub-workflow, OpenAI