AutomationFlowsAI & RAG › Expose Workflows as an Mcp Server for Claude and Openai Agents

Expose Workflows as an Mcp Server for Claude and Openai Agents

ByDr. Firas @drfiras on n8n.io

This workflow exposes selected n8n workflows as Model Context Protocol (MCP) tools, letting MCP clients (like Claude Desktop) discover, allowlist, and execute tagged workflows. It uses the n8n API to list workflows and an n8n Data Table to manage an “available” execution pool,…

Event trigger★★★★★ complexityAI-powered42 nodesMcp TriggerTool WorkflowExecute Workflow Triggern8nData TableChat TriggerAgentOpenAI Chat
AI & RAG Trigger: Event Nodes: 42 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #17314 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "jozNjVUr9SL0S50u",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Turn your n8n workflows into an MCP server for Claude and AI agents",
  "tags": [],
  "nodes": [
    {
      "id": "8812cc8f-32a0-419e-9e1f-690328d767b5",
      "name": "n8n workflows MCP server",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        192,
        0
      ],
      "parameters": {
        "path": "n8n-workflows-mcp"
      },
      "typeVersion": 2
    },
    {
      "id": "fcb9f8df-ef0c-4f91-b18d-0f532fc7998c",
      "name": "search_workflows",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        -48,
        224
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Discover every n8n workflow tagged for MCP use. Returns each workflow id, name, description and the JSON input schema of its Sub-workflow trigger. Use this to find workflow IDs before calling add_workflow.",
        "workflowInputs": {
          "value": {
            "operation": "searchWorkflows"
          },
          "schema": [
            {
              "id": "operation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "operation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "workflowIds",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "workflowIds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "parameters",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "parameters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d366c4e4-8446-42c5-a32c-a1c8dc8b57fd",
      "name": "add_workflow",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        112,
        224
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Add one or more workflows to the pool of available workflows the agent is allowed to run. Pass workflowIds as a comma-separated list of n8n workflow IDs obtained from search_workflows. Always ask the user before adding workflows.",
        "workflowInputs": {
          "value": {
            "operation": "addWorkflow",
            "workflowIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('workflowIds', 'Comma-separated list of n8n workflow IDs to add') }}"
          },
          "schema": [
            {
              "id": "operation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "operation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "workflowIds",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "workflowIds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "parameters",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "parameters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cf3dee79-6a4d-49fa-a757-9fde67f34e4b",
      "name": "remove_workflow",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        272,
        224
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Remove one or more workflows from the pool of available workflows. Pass workflowIds as a comma-separated list of n8n workflow IDs.",
        "workflowInputs": {
          "value": {
            "operation": "removeWorkflow",
            "workflowIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('workflowIds', 'Comma-separated list of n8n workflow IDs to remove') }}"
          },
          "schema": [
            {
              "id": "operation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "operation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "workflowIds",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "workflowIds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "parameters",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "parameters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "90e26b95-32f7-4ea1-ac63-a18cf93c3421",
      "name": "list_workflows",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        416,
        224
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "List the workflows currently in the available pool, ready to be executed. Each entry contains the workflow id, name, description and the exact JSON input schema (inputSchema) it expects. Always check this before calling execute_workflow.",
        "workflowInputs": {
          "value": {
            "operation": "listWorkflows"
          },
          "schema": [
            {
              "id": "operation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "operation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "workflowIds",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "workflowIds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "parameters",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "parameters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "baaecc84-e133-4e19-997e-99acec56398e",
      "name": "execute_workflow",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        576,
        224
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Run one workflow from the available pool. Pass workflowIds as the single workflow ID to run, and parameters as a JSON object matching the inputSchema returned by list_workflows. Only workflows already added to the pool can be executed.",
        "workflowInputs": {
          "value": {
            "operation": "executeWorkflow",
            "parameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters', 'JSON object of input values matching the workflow inputSchema from list_workflows', 'json') }}",
            "workflowIds": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('workflowIds', 'The ID of the single workflow to execute') }}"
          },
          "schema": [
            {
              "id": "operation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "operation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "workflowIds",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "workflowIds",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "parameters",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "parameters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "123ac955-6277-4939-b837-fdd8c7726a5a",
      "name": "When executed by MCP tool",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        0,
        912
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "operation"
            },
            {
              "name": "workflowIds"
            },
            {
              "name": "parameters",
              "type": "object"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "67059a02-ec33-4b54-bc6c-d257e948febe",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        912
      ],
      "parameters": {
        "options": {
          "ignoreConversionErrors": true
        },
        "assignments": {
          "assignments": [
            {
              "id": "cfg-tag",
              "name": "workflow_tag",
              "type": "string",
              "value": "mcp"
            },
            {
              "id": "cfg-published",
              "name": "only_published_workflows",
              "type": "boolean",
              "value": true
            },
            {
              "id": "cfg-operation",
              "name": "operation",
              "type": "string",
              "value": "={{ $('When executed by MCP tool').first().json.operation }}"
            },
            {
              "id": "cfg-ids",
              "name": "workflow_ids",
              "type": "string",
              "value": "={{ $('When executed by MCP tool').first().json.workflowIds }}"
            },
            {
              "id": "cfg-params",
              "name": "run_parameters",
              "type": "object",
              "value": "={{ $('When executed by MCP tool').first().json.parameters }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8dfcbe5e-c216-473c-861b-b81e3e9f0ea8",
      "name": "Route by operation",
      "type": "n8n-nodes-base.switch",
      "position": [
        432,
        864
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "search",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Configuration').first().json.operation }}",
                    "rightValue": "searchWorkflows"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "add",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Configuration').first().json.operation }}",
                    "rightValue": "addWorkflow"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "remove",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Configuration').first().json.operation }}",
                    "rightValue": "removeWorkflow"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "list",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Configuration').first().json.operation }}",
                    "rightValue": "listWorkflows"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "execute",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Configuration').first().json.operation }}",
                    "rightValue": "executeWorkflow"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "e2dcc613-84cb-4b9e-aa2c-dcf2cca30469",
      "name": "Get MCP-tagged workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        672,
        512
      ],
      "parameters": {
        "filters": {
          "tags": "={{ $('Configuration').first().json.workflow_tag }}",
          "activeWorkflows": "={{ $('Configuration').first().json.only_published_workflows }}"
        },
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "2cfe1d10-8a64-4e30-81b2-50c70c1a5bac",
      "name": "Format workflow profiles",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        512
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fmt-id",
              "name": "workflowId",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "fmt-name",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "fmt-desc",
              "name": "description",
              "type": "string",
              "value": "={{ $json.nodes.filter(node => node.type === 'n8n-nodes-base.stickyNote').map(node => node.parameters.content || '').filter(content => content.toLowerCase().includes('how it works')).map(content => content.substr(0, 400)).join('\\n') }}"
            },
            {
              "id": "fmt-schema",
              "name": "inputSchema",
              "type": "string",
              "value": "={{ (function(node) { if (!node) return {}; const inputs = ((node.parameters.workflowInputs || {}).values) || []; return { 'type': 'object', 'required': inputs.map(input => input.name), 'properties': inputs.reduce((acc, input) => ({ ...acc, [input.name]: { type: input.type ?? 'string' } }), {}) } })($json.nodes.filter(node => node.type === 'n8n-nodes-base.executeWorkflowTrigger').first()).toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "43e72cc0-f986-490b-abd9-9567a72279d3",
      "name": "Return search results",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1104,
        512
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "response"
      },
      "typeVersion": 1
    },
    {
      "id": "6abb70aa-2a65-462e-8b9d-cede5c45e8cb",
      "name": "Get MCP-tagged workflows for add",
      "type": "n8n-nodes-base.n8n",
      "position": [
        672,
        688
      ],
      "parameters": {
        "filters": {
          "tags": "={{ $('Configuration').first().json.workflow_tag }}",
          "activeWorkflows": "={{ $('Configuration').first().json.only_published_workflows }}"
        },
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "f39dc063-76eb-49e8-bd2b-d234804d630a",
      "name": "Keep only requested workflows",
      "type": "n8n-nodes-base.filter",
      "position": [
        880,
        688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.id ? $('Configuration').first().json.workflow_ids.split(',').map(id => id.trim()).includes($json.id) : false }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3,
      "alwaysOutputData": true
    },
    {
      "id": "73cb1e27-3718-4f4f-ba60-0d713d1453c3",
      "name": "Requested workflows found?",
      "type": "n8n-nodes-base.if",
      "position": [
        1104,
        688
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "6fce1e28-fe9d-4680-89b7-1791fd5b2fec",
      "name": "Format workflow profiles for add",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "fad-id",
              "name": "workflowId",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "fad-name",
              "name": "name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "fad-desc",
              "name": "description",
              "type": "string",
              "value": "={{ $json.nodes.filter(node => node.type === 'n8n-nodes-base.stickyNote').map(node => node.parameters.content || '').filter(content => content.toLowerCase().includes('how it works')).map(content => content.substr(0, 400)).join('\\n') }}"
            },
            {
              "id": "fad-schema",
              "name": "inputSchema",
              "type": "string",
              "value": "={{ (function(node) { if (!node) return {}; const inputs = ((node.parameters.workflowInputs || {}).values) || []; return { 'type': 'object', 'required': inputs.map(input => input.name), 'properties': inputs.reduce((acc, input) => ({ ...acc, [input.name]: { type: input.type ?? 'string' } }), {}) } })($json.nodes.filter(node => node.type === 'n8n-nodes-base.executeWorkflowTrigger').first()).toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "17cee294-3bbf-40d7-9f26-bb9caebb2ea1",
      "name": "Save to available pool",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1568,
        528
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $json.name }}",
            "workflowId": "={{ $json.workflowId }}",
            "description": "={{ $json.description }}",
            "inputSchema": "={{ $json.inputSchema }}"
          },
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "workflowId",
              "keyValue": "={{ $json.workflowId }}"
            }
          ]
        },
        "options": {},
        "matchType": "allConditions",
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "obqEgeCkj8k5ko50",
          "cachedResultName": "mcp_available_workflows"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "64ed8476-8b87-49e5-a170-b393340b4ef5",
      "name": "Confirm workflows added",
      "type": "n8n-nodes-base.set",
      "position": [
        1792,
        528
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cad-resp",
              "name": "response",
              "type": "string",
              "value": "={{ $('Format workflow profiles for add').all().length }} workflow(s) added to the available pool."
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "e8c2b961-595b-451f-8c85-f4cf99a20504",
      "name": "Report add error",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "rae-resp",
              "name": "response",
              "type": "string",
              "value": "No workflows matched the given IDs. Use search_workflows to list valid workflow IDs, then try again."
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "305a8657-91a0-409a-89d7-75b607da6f76",
      "name": "Split workflow IDs",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        912
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ { \"ids\": $('Configuration').first().json.workflow_ids.split(',').map(id => id.trim()) } }}"
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "df520290-f61c-403a-a446-8d7690c966b8",
      "name": "One item per workflow ID",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        896,
        912
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "ids"
      },
      "typeVersion": 1
    },
    {
      "id": "aa20bc56-a07e-4a2d-94d5-0a9548b8fdf8",
      "name": "Remove from available pool",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1120,
        912
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "workflowId",
              "keyValue": "={{ $json.ids }}"
            }
          ]
        },
        "options": {},
        "matchType": "allConditions",
        "operation": "deleteRows",
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "obqEgeCkj8k5ko50",
          "cachedResultName": "mcp_available_workflows"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "8bdd1abf-b11d-497c-b163-2352254d63f9",
      "name": "Confirm workflows removed",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        912
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "crm-resp",
              "name": "response",
              "type": "string",
              "value": "={{ $('Configuration').first().json.workflow_ids.split(',').length }} workflow(s) removed from the available pool."
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "b19d0dc4-eb99-4c15-a574-874bb17f86f4",
      "name": "Get available workflows",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        672,
        1072
      ],
      "parameters": {
        "filters": {
          "conditions": []
        },
        "matchType": "allConditions",
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "obqEgeCkj8k5ko50",
          "cachedResultName": "mcp_available_workflows"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "3618af77-dbba-4bc7-bc8e-3fbf141a4cdf",
      "name": "Return available pool",
      "type": "n8n-nodes-base.set",
      "position": [
        896,
        1072
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ { \"response\": $input.all().map(item => item.json).filter(item => item.workflowId) } }}"
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "51aa748a-9b6a-4771-8131-ef8c5f71286c",
      "name": "Check workflow is available",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        736,
        1600
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "conditions": [
            {
              "keyName": "workflowId",
              "keyValue": "={{ $('Configuration').first().json.workflow_ids }}"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "obqEgeCkj8k5ko50",
          "cachedResultName": "mcp_available_workflows"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "b3215bea-41cd-4e12-9b18-8b2eb7314a58",
      "name": "Workflow available?",
      "type": "n8n-nodes-base.if",
      "position": [
        912,
        1552
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.workflowId }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "ce28f69c-4066-477f-8a3c-1e0f89aaafe7",
      "name": "Prepare input parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        1136,
        1488
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $('Configuration').first().json.run_parameters || {} }}"
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "b3788655-fb89-44e6-9b60-47d91e441097",
      "name": "Run the selected workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1360,
        1472
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": true
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Configuration').first().json.workflow_ids }}"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "01a66bf1-f233-43be-9d27-c3cbd580c33e",
      "name": "Return execution result",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1584,
        1472
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "response"
      },
      "typeVersion": 1
    },
    {
      "id": "75b7316d-8c61-4575-9345-0f511563cc81",
      "name": "Report execute error",
      "type": "n8n-nodes-base.set",
      "position": [
        1136,
        1664
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ree-resp",
              "name": "response",
              "type": "string",
              "value": "This workflow is not in the available pool yet. Use list_workflows to see available workflows, or add_workflow to add it first."
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "36564be0-9ff1-4bca-b10a-1e93d62ca15a",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -112,
        1824
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "bf7b5e84-974f-443d-86d2-6a205f5d944c",
      "name": "Workflow runner agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        128,
        1728
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant who completes tasks exclusively by running n8n workflows through the connected MCP tools.\n* Assume a workflow exists for any task the user asks for. Never generate custom scripts or raw commands - use a workflow instead.\n* Start with the list_workflows tool to see the available pool. Workflows returned there are ready to run and do not need to be added again.\n* Use search_workflows to discover other workflows, and always ask the user before adding one with add_workflow.\n* Before running a workflow, read its inputSchema from list_workflows and build the parameters JSON accordingly.\n* You do not need to confirm each execution step with the user once a workflow is chosen.\n* If no available workflow is suitable, tell the user clearly instead of improvising."
        }
      },
      "typeVersion": 3.1
    },
    {
      "id": "c87b7a53-bdef-44b0-8374-c29bc0fb1f18",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        48,
        1920
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6a9b0f02-2f64-4957-9959-4c88b8090384",
      "name": "Conversation memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        224,
        1904
      ],
      "parameters": {
        "contextWindowLength": 20
      },
      "typeVersion": 1.4
    },
    {
      "id": "cc2ec856-bb42-4800-920e-e07bcfeefd04",
      "name": "n8n workflows MCP client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        416,
        1904
      ],
      "parameters": {
        "options": {},
        "endpointUrl": "<__PLACEHOLDER_VALUE__Production URL of the MCP Server Trigger above__>"
      },
      "typeVersion": 1.4
    },
    {
      "id": "36c50767-38a5-4c3c-b676-b195421eef14",
      "name": "Sticky Note 3eb2db1d",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        -112
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 2168,
        "content": "# Turn your n8n workflows into an MCP server for Claude and AI agents\n# \ud83d\udce5  [Open full documentation on Notion](https://automatisation.notion.site/Course-Turn-your-n8n-workflows-into-an-MCP-server-for-Claude-and-AI-agents-39e3d6550fd981aca9e1e805d6bd0403)\n\n## How it works\n\n* An **MCP Server Trigger** exposes 5 tools to any MCP client (Claude Desktop, Cursor, or your own agent): `search_workflows`, `add_workflow`, `remove_workflow`, `list_workflows` and `execute_workflow`.\n* Designing agent tools for **outcome** rather than utility means the agent should make the fewest calls possible to finish a task. That is exactly what n8n workflows are good at, so this template turns every workflow you already own into an end-to-end tool.\n* Each of the 5 tools re-enters this same workflow through a **Sub-workflow trigger**, and a single Switch routes the call to the right operation. One workflow, one file, five tools.\n* The **n8n node** taps into your instance API and returns every workflow carrying the `mcp` tag, together with a description (read from its main sticky note) and the JSON input schema extracted from its Sub-workflow trigger. The agent therefore knows exactly which parameters to send before it runs anything.\n* An **n8n Data Table** named `mcp_available_workflows` keeps the pool of \"available\" workflows the agent is allowed to run \u2014 one row per workflow. This replaces Redis: no external database, no extra container, and you can read or edit the pool directly in the n8n UI.\n* `execute_workflow` checks the pool first, then runs the selected workflow with **passthrough parameters** (incoming data is used when parameters are not explicitly set in the Execute Sub-workflow node).\n* A built-in **AI Agent + MCP Client** section lets you test the whole server from the n8n chat before plugging in Claude Desktop.\n\n## Setup\n\n1. Create an n8n API key (**Settings \u2192 n8n API**) and select it on both `n8n` nodes.\n2. Create a Data Table named `mcp_available_workflows` with 4 **string** columns: `workflowId`, `name`, `description`, `inputSchema`. Then select it on the 4 **Data table** nodes.\n3. Tag every workflow you want to expose with `mcp` (tag name editable in the **Configuration** node), and make sure each one has a **Sub-workflow trigger with a defined input schema**.\n4. Select your OpenAI credential on the **OpenAI Chat Model** node (test agent only).\n5. Activate the workflow, copy the **Production URL** of the MCP Server Trigger, and paste it into the **MCP Client** tool \u2014 and into Claude Desktop or any other MCP client.\n\n## Requirements\n\n* An **n8n API key** to list your workflows.\n* **n8n workflows with Sub-workflow triggers** and a defined input schema.\n* An **n8n Data Table** for the available pool (built in, no Redis).\n* An **OpenAI credential** \u2014 only used by the built-in test agent.\n* An **MCP client** such as Claude Desktop \u2014 https://claude.ai/download\n\n## Customization\n\n* Change `workflow_tag` in the **Configuration** node to expose a different set of workflows, or clear it to expose them all.\n* Set `only_published_workflows` to `false` to also discover drafts while you build.\n* Swap the OpenAI model, or delete the test agent section once Claude Desktop is connected.\n* If your target workflows use webhooks instead of Sub-workflow triggers, replace the **Execute Sub-workflow** node with an HTTP Request node.\n* Managing an available pool helps when many workflows look similar to the agent. If that is not a problem for you, wire `search_workflows` straight into `execute_workflow` and drop the pool.\n\nNeed help customizing?\nContact me for consulting and support : [Linkedin](https://www.linkedin.com/in/doctor-firass/)\n\n# MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new YouTube channel](https://www.youtube.com/@DrFiras_AI). Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.\n\n[![The AI Doctor](https://www.dr-firas.com/the-ai-doctor.png)](https://www.youtube.com/@DrFiras_AI)"
      },
      "typeVersion": 1
    },
    {
      "id": "8ed87a09-726f-433d-9be0-bd1740d65db6",
      "name": "Sticky Note faa39097",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 760,
        "height": 480,
        "content": "## 1. MCP server trigger\nExposes the 5 tools below to any MCP client. Activate the workflow, then copy the **Production URL** of this trigger into Claude Desktop or the MCP Client tool of the test agent."
      },
      "typeVersion": 1
    },
    {
      "id": "c85e0a21-adbf-4fd4-b532-98b6b5bf7f57",
      "name": "Sticky Note 0b324e6f",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        672
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 484,
        "content": "## 2. One entry point for every tool call\nEach tool re-enters this workflow through the Sub-workflow trigger. **Configuration** is the only node to edit: workflow_tag (which workflows are exposed) and only_published_workflows. The Switch then routes the call to the right operation."
      },
      "typeVersion": 1
    },
    {
      "id": "50c4fb0a-9496-47f8-aaf9-30e7093446bf",
      "name": "Sticky Note a1136d1c",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        352
      ],
      "parameters": {
        "color": 7,
        "width": 1420,
        "height": 858,
        "content": "## 3. Discover and manage the available pool (Data Table)\nsearch_workflows reads your instance API and extracts each workflow description + input schema. add_workflow / remove_workflow / list_workflows manage one row per workflow in the \"mcp_available_workflows\" Data Table - built into n8n, no Redis needed."
      },
      "typeVersion": 1
    },
    {
      "id": "e2eb6117-051d-47dc-a6d3-b124b5db12aa",
      "name": "Sticky Note 9d726266",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        1248
      ],
      "parameters": {
        "color": 7,
        "width": 1180,
        "height": 586,
        "content": "## 4. Execute any available workflow\nexecute_workflow checks the pool first, then runs the selected workflow with passthrough parameters.\n\n### \ud83d\udea8 Keep the Execute Sub-workflow inputs EMPTY\nFor passthrough parameters to work, this node must not define any input schema fields. If fields appear, reset the node."
      },
      "typeVersion": 1
    },
    {
      "id": "f339c1fc-7edc-4c6f-9f21-730b6704266b",
      "name": "Sticky Note 4586522a",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        1536
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 500,
        "content": "## 5. Test with the built-in agent\nPaste the MCP Server Production URL in the MCP Client tool, then chat: \"Which workflows are available?\". Remove this section once Claude Desktop is connected."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "8f3428f1-462f-40f1-b1e3-a641a431c0a9",
  "nodeGroups": [],
  "connections": {
    "add_workflow": {
      "ai_tool": [
        [
          {
            "node": "n8n workflows MCP server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Route by operation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "list_workflows": {
      "ai_tool": [
        [
          {
            "node": "n8n workflows MCP server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "remove_workflow": {
      "ai_tool": [
        [
          {
            "node": "n8n workflows MCP server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "execute_workflow": {
      "ai_tool": [
        [
          {
            "node": "n8n workflows MCP server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "search_workflows": {
      "ai_tool": [
        [
          {
            "node": "n8n workflows MCP server",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Workflow runner agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Route by operation": {
      "main": [
        [
          {
            "node": "Get MCP-tagged workflows",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get MCP-tagged workflows for add",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split workflow IDs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get available workflows",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check workflow is available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split workflow IDs": {
      "main": [
        [
          {
            "node": "One item per workflow ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Conversation memory": {
      "ai_memory": [
        [
          {
            "node": "Workflow runner agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Workflow available?": {
      "main": [
        [
          {
            "node": "Prepare input parameters",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Report execute error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to available pool": {
      "main": [
        [
          {
            "node": "Confirm workflows added",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get available workflows": {
      "main": [
        [
          {
            "node": "Return available pool",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format workflow profiles": {
      "main": [
        [
          {
            "node": "Return search results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get MCP-tagged workflows": {
      "main": [
        [
          {
            "node": "Format workflow profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per workflow ID": {
      "main": [
        [
          {
            "node": "Remove from available pool",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare input parameters": {
      "main": [
        [
          {
            "node": "Run the selected workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n workflows MCP client": {
      "ai_tool": [
        [
          {
            "node": "Workflow runner agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Run the selected workflow": {
      "main": [
        [
          {
            "node": "Return execution result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When executed by MCP tool": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove from available pool": {
      "main": [
        [
          {
            "node": "Confirm workflows removed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Requested workflows found?": {
      "main": [
        [
          {
            "node": "Format workflow profiles for add",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Report add error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Workflow runner agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check workflow is available": {
      "main": [
        [
          {
            "node": "Workflow available?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep only requested workflows": {
      "main": [
        [
          {
            "node": "Requested workflows found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format workflow profiles for add": {
      "main": [
        [
          {
            "node": "Save to available pool",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get MCP-tagged workflows for add": {
      "main": [
        [
          {
            "node": "Keep only requested workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow exposes selected n8n workflows as Model Context Protocol (MCP) tools, letting MCP clients (like Claude Desktop) discover, allowlist, and execute tagged workflows. It uses the n8n API to list workflows and an n8n Data Table to manage an “available” execution pool,…

Source: https://n8n.io/workflows/17314/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

The AI-Powered Shopify SEO Content Automation is an enterprise-grade workflow that transforms product content creation for e-commerce stores. This sophisticated multi-agent system integrates GPT-4o, C

Perplexity Tool, Memory Buffer Window, Agent +15
AI & RAG

Template Nodes Example. Uses CUSTOM, formTrigger, executeWorkflowTrigger, chatTrigger. Event-driven trigger; 70 nodes.

Custom, Form Trigger, Execute Workflow Trigger +23
AI & RAG

Splitout Redis. Uses executeWorkflowTrigger, n8n, redis, splitOut. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, n8n, Redis +7
AI & RAG

3770. Uses executeWorkflowTrigger, n8n, redis, agent. Event-driven trigger; 46 nodes.

Execute Workflow Trigger, n8n, Redis +7
AI & RAG

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 amo

Execute Workflow Trigger, n8n, Redis +7