Getting Started with Model Context Protocol (MCP) on n8n
In case you have been under a rock, MCP is all the rage when it comes to extending your AI agents power within n8n. MCP stands for Model Context Protocol. This protocol was released at the end of 2024 as an open source project by Anthropic.
In this guide I'll walk you through setting up your first MCP tool within n8n!
First Install Community Node n8n-nodes-mcp
This is the custom community node that empowers MPC in n8n. The current docs can be found below, if you want to understand what you are installing before you do!
From your n8n instance visit the Settings page.
- Click on the 3 dots near your user name
- Click settings (the url will resolve to https://n8ndomainname/settings/usage

- Next select Community Nodes
- Click Install
- Within the Install community nodes popup, add
n8n-nodes-mcp
in the npm Package Name section and click that you understand the risks of installing checkbox. - When you hit install, the node will be installed and you are well on your way!

If for some reason it fails, you may need to add an environment variable to your n8n configuration.
NODE_FUNCTION_ALLOW_EXTERNAL= '*'
The next section will walk you through the basics of setting environment variables to enable the community tools, if you're unsure how to proceed.
Setting the Environment Variable
The below section we will be setting up 2 different environme
Depending on how you are hosting n8n, you may have different types of configurations. If you are running it on your local machine or are running n8n with the n8n start
command you use the bash/zsh shell command.
# bash/zsh shell
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
For those of you using a docker-compose file you can add the following environment variable
# docker-compose.yml
environment:
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
If you are using a hosting service you may have an UI interface where you can add KEY value pairs for environment variables (or env variables).
Once added and a reboot has been complete you should be able to move to the next step!
Creating MCP Credentials For Brave
Typically when you think of credentials you think of private api keys or passwords. For MCP nodes, this is a little different As these credentials are what allow you to connect/interact with the MCP server itself, though there can also be "secret" things as well. We'll be setting up the Brave Search API tool.
Visit the credentials page (https://n8ndomain/home/credentials)

- Click Overview
- Click Credentials
- Select Down arrow on Create Workflow button
- Click Create Credential
- Search MCP and select
STDIO
API

The STDIO API contains 3 values that are important to us.
- Command: The command to start the MCP server
- Arguments: Optional arguments to pass to the server command
- Environment Variables: Variables to pass to the server in NAME=VALUE format. Note you can use comma separation or even new lines here.
For the Brave API MCP Server, The configuration from the Brave Search API tool shows this is the details

We can enter the above details into n8n like (see the screenshot below), notice I combined the arguments above that were within an array (-y
and @model.....
) into 1 line separated by a space in n8n. For the Environments, when you type these will show up as *** by default, if you hover over the box and select "Expression" this will allow you to see your Environment variables. Be sure to use you're real Brave Api Key, if you don't have one you can signup here - https://brave.com/search/api/.
Last but not least let's go ahead and rename the Credential, this can be done by clicking the title (in blue square) and naming it MCP Brave
. This little tip will save you a lot of headache as you begin to create multiple MCP credentials!
Now save it!

Let's Create our AI Agent with MCP
Create a Chat bot, with an Advanced AI agent, and go ahead and add an Open AI node to the Chat model, I used gpt-4o-mini
for my model, and now we can go and add a tool. Search MCP and choose MCP Client Tool
- Set the Brave Credential
- Choose Operation "List Tools"
- Rename the title of the Tool to "Brave List Tools"

Once this is added you should be able to test your chat functionality, and ask the question. What tools are available?
and get a similar answer
- Brave Web Search
- Brave Local Search

The reason we have this info returned is because the operation we chose for the MCP server was "List Tools". You can think of this Operation as the "documentation" of the Tool.
Where this gets really interesting is we can build out our ai agent to be able to "Check the Docs" and know what it's capable of prior to running. So It will be a smart 🤖!
Side Note: Tool Operations
The below operations are available with the n8n-nodes-mcp implementation.
- Execute Tool - Execute a specific tool with parameters
- Get Prompt - Get a specific prompt template
- List Prompts - Get a list of available prompts
- List Resources - Get a list of available resources from the MCP server
- List Tools - Get a list of available tools
- Read Resource - Read a specific resource by URI
Not all operations will be available for every MCP server.
Implement the Brave API "Tool"
Let's go ahead and add another tool Let's name it Brave Tool.
- Rename the tool to
Brave Tool
- Select the
MCP Brave
credential - Operation:
Execute Tool
- Tool Name:
{{ $fromAI("tool", "the selected tool to use") }}
- We will give the AI agent a prompt and allow us to dynamically choose which
tool
eitherBrave Web Search
orBrave Local Search
based on the chat request
- We will give the AI agent a prompt and allow us to dynamically choose which
- Tool Parameters: These have to be JSON format, Let's click the sparkle button "Let the model define this parameter"

The final configuration should look like this

Let's Build Out Our System Prompt AI Agent
Below you can see that I've clearly given a Tool name and description, Along with some directions (use the list tools job to decide what type of tool
should be used.
You are an AI Agent with access to MCP Servers.
Available Tools:
Brave List Tools – Use this to retrieve a list of available tools.
Brave Tool – Executes a function based on the tool name retrieved from Brave List Tools.
Instructions:
Always use Brave List Tools first to fetch the available tools.
Extract the correct tool name from the response.
Use the retrieved tool name when executing Brave Tool.

When asking this agent a question
What local coffee shops are in Birmingham, AL, are there any still open?
The brave_local_search
was selected to be used

And I got back results for 5 different local coffee shops!
Endless Possibilities MCP Servers
Now that you have your instance configured you can start shopping for what type of MCP integration you want to use from the GitHub repo below.
Big thanks to Nerding I/O who is the creator of the n8n-nodes-mcp community node. He has a ton of resources on his youtube channel. Check him out!
My Exported Workflow
Did I miss something or is something out of date? I'd love to hear about it, signup and comment below. You can also connect with me LinkedIn.