# Integrate Model Context Protocol (#mcp) in n8n ## Metadata - **Published:** 3/13/2025 - **Duration:** 16 minutes - **YouTube URL:** https://youtube.com/watch?v=1t8DQL-jUJk - **Channel:** nerding.io ## Description Join the Community: https://nas.io/vibe-coding-retreat 50% off One-click remote hosted MCP servers use NERDINGIO at Supermachine.ai https://supermachine.ai/ ๐Ÿ“ž Book a Call: https://calendar.app.google/vx62Asp9DTk7dRLW7 In this video, I'll introduce a new n8n community node I built that allows you to integrate Model Context Protocol (MCP) into your n8n workflows. What is MCP? MCP is a protocol that enables AI models to interact with external tools, APIs, and data sources in a standardized way. With this new n8n node, you can: โœ… Connect to MCP servers directly within n8n โœ… Execute AI tools and access external resources โœ… Send prompts to AI models and receive structured responses โœ… Automate AI-powered workflows without writing custom code ๐Ÿ’ก Why This Matters This node makes it easier than ever to integrate LLMs, AI agents, and external APIs into your automation workflowsโ€”expanding whatโ€™s possible with n8n and AI-powered automation. ๐Ÿ”ง What Youโ€™ll Learn in This Video: ๐Ÿ“Œ How MCP works and why itโ€™s important for AI-driven workflows ๐Ÿ“Œ Setting up the n8n community node for MCP ๐Ÿ“Œ Connecting to an MCP server and interacting with AI models ๐Ÿ“Œ Executing tools and retrieving AI-generated data ๐Ÿ“Œ Building end-to-end AI automation with n8n ๐Ÿ‘‰๐Ÿป Text Yourself: https://textyourself.app ๐Ÿ“ฐ Newsletter: https://sendfox.com/nerdingio ๐ŸŽฅ Chapters 00:00 Introduction 00:23 What is MCP 02:28 Config - Important! 03:18 Install 04:08 Credentials 06:06 Command Line Example 07:41 AI Agent 10:53 Server Side Events 14:43 Multiple tools 16:22 Conculsion ๐Ÿ”— Links Source: https://github.com/nerding-io/n8n-nodes-mcp Registry: https://www.npmjs.com/package/n8n-nodes-mcp โคต๏ธ Let's Connect https://everefficient.ai https://nerding.io https://twitter.com/nerding_io https://www.linkedin.com/in/jdfiscus/ https://www.linkedin.com/company/ever-efficient-ai/ ## Key Highlights ### 1. mCP: Lego Blocks for AI mCP (Model Context Protocol) is a standard enabling plug-and-play integration of diverse data sources and prompts into AI applications, simplifying complex workflows. It allows combining different servers, tools and resources into AI workflows. ### 2. n8n + mCP Node = Automation Power The custom n8n node facilitates direct interaction with mCP servers, enabling various automation scenarios within the n8n platform. It enables n8n to leverage data accessed through mCP connections. ### 3. Community Package Setup is Key Enabling community packages within n8n is crucial for utilizing the mCP node, especially when incorporating it as a tool within AI agents. Environment variables must be set correctly for community tool usage. ### 4. SSSE vs. Command Line The video demonstrates connecting to mCP servers using both command-line and Server-Sent Events (SSSE) methods, showcasing the flexibility of the n8n node to handle different connection types. ### 5. AI Agent Integration with mCP The mCP node allows AI agents within n8n to access and execute tools defined by mCP servers, enabling sophisticated tasks such as searching repositories or using web search, with parameter handling by the model. ## Summary ## n8n & Model Context Protocol (MCP) Integration: Video Summary **1. Executive Summary:** This video introduces a new n8n community node developed by JD (NerdingIO) that enables seamless integration of Model Context Protocol (MCP) into n8n workflows. By using this node, users can easily connect to MCP servers, execute AI tools, access external resources, and automate AI-powered workflows without extensive custom coding. **2. Main Topics Covered:** * **Introduction to MCP:** Defining MCP as a standard for AI models to interact with external tools, APIs, and data sources. * **n8n Community Node Setup:** Step-by-step guide on installing and configuring the n8n community node for MCP, including enabling community packages. * **MCP Server Connection:** Demonstrating connection to MCP servers using both command-line (standard in/standard out) and Server-Sent Events (SSSE) methods within n8n. * **Workflow Examples:** Building workflows to list available tools from MCP servers and executing tools to retrieve AI-generated data, specifically using GitHub and Brave search examples. * **AI Agent Integration:** Incorporating the MCP node as a tool within n8n AI agents, allowing agents to access and execute tools defined by MCP servers. **3. Key Takeaways:** * MCP simplifies integration of diverse data sources and prompts into AI applications by acting as "Lego blocks." * The n8n community node offers a user-friendly way to connect to MCP servers and leverage AI tools within n8n workflows. * Enabling community packages within n8n is essential for utilizing the MCP node, especially with AI agents; environment variables must be properly configured. * The node supports both command-line and Server-Sent Events (SSSE) for connecting to MCP servers. * AI agents in n8n can utilize the MCP node to access and execute tools defined by MCP servers, enabling complex tasks such as repository searching or web searches. **4. Notable Quotes or Examples:** * "mCP is model context protocol and basically what that is is it's a protocol and a standard that allows you to interact with different servers and data sources and prompts and pull them into your AI application whether that be an agent or or uh some other a model." * "It [MCP] almost acts as like Lego blocks where you can take pieces or different servers and different tools prompts resources pull them into your code and uh Plug and Play very quickly." * "In na specifically since this is a community package you actually have to allow Community package for Tool usage if you want to use this in an AI agent and a tool." * Example workflows include querying GitHub repositories using an MCP connection and querying Brave Search to find local tools. * Demonstration of passing dynamically defined parameters to tools through the AI agent to make the process fully automated. **5. Target Audience:** * n8n users looking to integrate AI models and external data sources into their automation workflows. * Developers and data scientists interested in leveraging Model Context Protocol (MCP) for AI applications. * Individuals exploring AI agent development and integration within automation platforms like n8n. * Anyone looking to automate AI-powered tasks without requiring extensive coding knowledge. ## Full Transcript hey everyone welcome to nering IO I'm JD and today what we're going to go through is a mCP NN node that allows you to do model context protocol directly in NE for different types of automation all right so I wrote this n8n nodes mCP client specifically because I needed to take mCP servers and pull them into na so let's talk about specifically what mCP is is so mCP is model context protocol and basically what that is is it's a protocol and a standard that allows you to interact with different servers and data sources and prompts and pull them into your AI application whether that be an agent or or uh some other a model the reason that this is super important is because it it almost acts as like Lego blocks where you can take pieces or different servers and different tools prompts resources pull them into your code and uh Plug and Play very quickly again it's the standard that's really important so put together by Claude and anthropic but it is a open-source uh standard so what we're doing is we're taking these servers and we're actually going to put them into our client which is n8n and allow n8n through either the workflow or the AI agent itself to actually leverage whatever data we're getting um these connections can either be command line based so standard in standard out and then uh serers side events which can be configured almost very similar to like an API again it's a different standard though so what we're going to do today is uh actually go through setting all this up however it's really important to know that there are a few operations that you can do you can execute On Tools list prompts read from those things as well as uh execute the tools so this would be actually running whatever that tool is could be a GitHub command or whatever then we're going to take that and um process it in our AI but first and foremost one of the things that uh has been really important is in na specifically since this is a community package you actually have to allow Community package for Tool usage if you want to use this in an AI agent and a tool basically down here then you need to actually run these environments for your deployment not your mCP environments this is your actual uh inate end deployment so if I was to run this locally what I would do is I would just copy the uh the environment variables here I can just pull in my terminal I can just paste them in and this is actually going to start my instance of nn with the community tool enabled so again this is super important if you want to be able to use this as an AI agent tool right let's dive into the rest of it so the first thing that we're going to do is you need to go into your settings and in order to get the community nodes you have to install the community node from here so in order to do that you would just browse and then you can look for mCP one right here and then you can just copy and paste this uh portion direct the package name you understand the risks and you're going to go ahead and install and once that's done then you should be all set as far as the uh N8 end and you even have the version number to know that you're uh once this is in here then we can actually go in and actually build out flow so let's go ahead and get started that so now I'm back here in in my credentials which is where we're going to start so the way that these mCP servers work is you have to actually connect to them and that's it's a little bit different in how we're uh between standard in standard out uh and uh server side events so we're just going to take a look at these types of examples and the way that I built this was you just have your command you have your arguments they're the way mCP works is you actually have these arguments are array so all you have to do is put in your command line and it will actually separate based on space into that array same thing with environments the reason that it's showing uh the value is you can actually type in for instance like Brave G key and then whatever values are you can do that via comma via space or you can even do new line all of that will work and then it parses this on the back end so the way it's looking for it same uh it needs to actually break this uh this up into an array for well an array of objects actually or just objects so a record um and it will take the name and then the value so we're going to go ahead and close without saving for each server you have to create your own uh credential and then once you have those credentials you can actually use them in multiple different ways so we're going to go through and actually look at the the command line first as a full workflow and then we'll go through and we'll actually build out the uh server side uh rendering or server side events so if we go back over here to flow we're actually going to look at our standard example so what this is doing is we are going to look at our GitHub tools and you can see that we have our credential here that we can pick from our list or we can actually create a new credential from our operations we have all these different operations where we can do tools or prompts and resources and we're going to go ahead and just test this event and see what actual tools we can get back from GitHub so now you can see that tools that are being uh sent back to the to the mCP client is an array of tools that has our name what the the tool actually does and then how the schema operates so we can actually go through these and actually use them in the next execution this is if we're just using a standard flow we're going to actually go through an AI agent so what this is doing is saying based on those tools I'm just going to grab the uh search repositories and then I'm going to actually query that based on the tool parameters which you could do technically dynamically and then we're going to search for mCP and now we have our result coming back where we have our text our type is a text our text object our text string is basically an object of different mCP Ser uh repos that are actually out there on GitHub right now so now let's go take a look at an example for an AI agent so the way that the AI agent works is a little bit different so we have our clickthrough but we also have the ability to put in our prompt and then we have the ability to actually set up tools so you want to come in here and press tool you can actually search for mCP I'll give you the client again you have to select your credential and then you can either set the tool manually or you can uh set the description then you have to pick your your operations right so you can specifically say you want to list the tools or you can execute and you're just going to give the AI agent access to all the tools that you see available and then it'll actually try and connect to it so in this example going to go ahead and delete this one we have our list tools which is our GitHub connection we have our list we have another uh automatic tool so this is again we set up Brave rather than actually setting the parameters by uh we're going to actually let the AI model try and Define this so the way you can do that is if you had fixed you could actually Define what your parameters were or we can come in here and we can click this let the model Define the parameter and then it will automatically set what those things are and then we can actually test so right now what this prompt is going to say is go out and find local tools we're actually going to switch this search with brave and we'll still stick with model context protocol and we're just going to go ahead and test the step sometimes this can error because it's looking for the uh opening eye to come back with a valid Json request cool and so it on this one it definitely didn't fail it came back with our output it came back with the information that it went out and found so it's pulling from the anthropic uh which is the company that released mCP and and uh basically giving us a bunch of article information that we can then pull back into our agent and you can see this one failed uh that's because we're not actually we haven't connected this yet but that's what we're going to go through next is we're going to actually build a ssse connection point that is different than a command line Point um and you can see that the GitHub list tools didn't execute but it tried to execute on both of the Braves because spe specifically said here could also tell it to define the best tool uh and see what it comes back with in this case if we sold it to say what the best tool is it could search repos it could search uh through Brave and it would try to pull back those information from those tools let's go back and we'll go ahead and create a SS example instead of going in here we actually go credentials so create credential and we're just going to type in mCP and so now we can type in SS continue you can see that it defaults to this URL so all you would need to do is change this URL but I actually have an SS running globally which I'll show you how to do in an upcoming video uh and we can actually see that in the mCP inspector so come over here do an mCP inspector I have this running globally we're going to go ahead and connect real quick everyone if you haven't already please remember to like And subscribe it helps more than you know also please go check out text yourself it's a simple application that I built that helps keep me on track all you have to do is SMS different tasks and reminders that you need to be sent back to yourself with that let's get back to it all right so we have our inspector up and now we have our uh back end up so if we go ahead and click connect we've now connected and in our inspector we can go ahead and list tools we can actually see what these tools are uh and this is representing an SS you can also do uh standard and standard uh and so I just wanted to show this as we know that we have an an active mCP locally so we're going to go take this and go back into any n and actually add our uh endpoint so this is mandatory you have to have whatever your ssse is then you have you you don't necessarily have to have uh an a messages endpoint most of them are just going to end up being messages uh which is default and then you have the option to put in additional uh headers and basically that goes like name and value and the reason for this is uh for instance if you wanted to do streaming uh you could actually do that with an additional header of uh a stream so but we're going to go ahead and just leave it like this go ahead and save we're going to go back to our workflows now we'll look at creating an SS example so we come in here and we say client and we want to list available to tools we're going to grab our SSE account we'll go ahead and test this we'll see that we're getting the exact same thing that we saw in inspector we can click and we're going to go ahead and add another and we're going to say execute and in this instance we will say uh search query p and count and five there and then we will go ahead and execute our tool name which is right here actually just drag that if you want and we'll go ahead and uh give this test and see if that works cool and so now we're actually getting our mCP uh Brave search back here in our node so now if we actually save this and then we'll go back to our uh overall agent you can see that this is ex should be able to execute we don't have our credential selected so we're going to have to come up here click MCB mCP ssse account go ahead and save that and now if we try and search we should be able to uh select both these we're going to go ahead and delete delete this connection though CU I just want to see if this one cool and now we already know that it's going back and pulling back that information and we'll see what uh the output is cool and now that that is complete we know that it worked and just for fun let's do a uh another tool here okay so we've now got all connected and let's TR try search with search for information protocols repos we'll just try that and see if we pull back uh both GitHub and uh some Brave information so it's going back and just pulling from this tool this time so it probably thought that this was the best one to select from but also we have a success so again what we went through is you have the ability to add mCP directly to your agents you also have the ability to put them into uh single threads if you want uh so for instance if you wanted to go out call something and then put it back into an a AI agent outside of just the cool tool calling functionality all right everyone that's it for us today what we went through was a custom node that I built specifically in n8n that allows you to connect to the model context protocol and with that happy nering --- *Generated for LLM consumption from nerding.io video library*