The n8n MCP Client Integration is a community node for n8n that enables interaction with Model Context Protocol (MCP) servers within n8n workflows. MCP is a protocol that allows AI models to interact with external tools and data sources in a standardized way. This node provides capabilities to connect to MCP servers, access resources, execute tools, and use prompts.
To install the n8n MCP Client node, follow the installation guide in the n8n community nodes documentation.
The MCP Client node supports two types of credentials to connect to an MCP server:
NAME=VALUE
format.http://localhost:3001/sse
).name:value
, one per line).The MCP Client node supports passing environment variables to MCP servers using the command-line based transport in two ways:
You can add environment variables directly in the credentials configuration.
For Docker deployments, you can pass environment variables directly to your MCP servers by prefixing them with MCP_
.
version: '3'
services:
n8n:
image: n8nio/n8n
environment:
- MCP_BRAVE_API_KEY=your-api-key-here
- MCP_OPENAI_API_KEY=your-openai-key-here
- MCP_CUSTOM_SETTING=some-value
# other configuration...
shell
npm install -g @modelcontextprotocol/server-brave-search
npx
-y @modelcontextprotocol/server-brave-search
BRAVE_API_KEY=your-api-key
brave_search
tool.{"query": "latest AI news"}
.docker-compose.yml
file:services:
n8n:
image: n8nio/n8n
environment:
- MCP_BRAVE_API_KEY=your-brave-api-key
- MCP_OPENAI_API_KEY=your-openai-key
- MCP_SERPER_API_KEY=your-serper-key
- MCP_WEATHER_API_KEY=your-weather-api-key
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
ports:
- "5678:5678"
volumes:
- ~/.n8n:/home/node/.n8n
```
2. Create multiple MCP Client credentials in n8n.
3. Create an AI Agent workflow that uses multiple MCP tools.
shell
npx @modelcontextprotocol/server-example-sse
Server-Sent Events (SSE)
.http://localhost:3001/sse
.The MCP Client node supports the following operations:
This node can be used as a tool in n8n AI Agents. To enable community nodes as tools, set the N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE
environment variable to true
.
Bash/Zsh Shell:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
n8n start
Docker:
environment:
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
Desktop App:
Create a .env
file in the n8n directory:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
Permanent on Mac/Linux:
Add to ~/.zshrc
or ~/.bash_profile
:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true