N8n MCP Client
Подключайте n8n к MCP-серверам! Легко получайте доступ к ИИ-ресурсам, выполняйте инструменты и используйте промпты. Автоматизируйте рабочие процессы с Model Context Protocol.
Узел n8n MCP Client позволяет подключаться к MCP-серверам внутри ваших рабочих процессов n8n, обеспечивая бесшовную интеграцию с AI-моделями и внешними источниками данных. Используя Model Context Protocol, этот узел даёт вам доступ к ресурсам, выполнение инструментов и использование промптов, расширяя возможности автоматизации рабочих процессов. Он поддерживает как транспорт на основе командной строки (STDIO), так и транспорт через события, отправляемые сервером (SSE), что обеспечивает гибкость при подключении к различным настройкам MCP-серверов. С помощью этого узла вы можете создавать сложные AI-агенты и оркестрировать комплексные задачи на различных платформах и сервисах.
Ключевые особенности
This is an n8n community node that lets you interact with Model Context Protocol (MCP) servers in your n8n workflows.
MCP is a protocol that enables AI models to interact with external tools and data sources in a standardized way. This node allows you to connect to MCP servers, access resources, execute tools, and use prompts.
n8n is a fair-code licensed workflow automation platform.
Installation
Credentials
Environment Variables
Operations
Using as a Tool [
Compatibility
Resources
Official Quickstart Video:
Shoutout to all the creators of the following n8n community videos that are great resources for learning how to use this node:
- Is MCP the Future of N8N AI Agents? (Fully Tested!)
- Connect N8N AI Agents to EVERYTHING using MCP?
- Build an AI Agent That Can Use Any Tool (MCP in n8n Tutorial)
- The NEW N8N MCP is an Absolute Game-Changer (Brave Search MCP)
- MCP & n8n Automation: The Ultimate Guide for MCP AI Agents (2025)
- REVOLUÇÃO na criação de AGENTES no N8N com o MCP Server!!! (Portuguese)
If you have a great video that you'd like to share, please let me know and I'll add it to the list!
Check out my YouTube Series MCP Explained for more information about the Model Context Protocol.
Follow the installation guide in the n8n community nodes documentation.
Also pay attention to Environment Variables for using tools in AI Agents. It's mandatory to set the N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE environment variable to true if you want to use the MCP Client node as a tool in AI Agents.
The MCP Client node supports two types of credentials to connect to an MCP server:
- 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
- SSE URL: The URL of the SSE endpoint (default: http://localhost:3001/sse)
- Messages Post Endpoint: Optional custom endpoint for posting messages if different from the SSE URL
- Additional Headers: Optional headers to send with requests (format: 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:
This method is useful for individual setups and testing. The values are stored securely as credentials in n8n.
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...These environment variables will be automatically passed to your MCP servers when they are executed.
This example shows how to set up and use the Brave Search MCP server:
-
Install the Brave Search MCP server:
npm install -g @modelcontextprotocol/server-brave-search
-
Configure MCP Client credentials:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-brave-search - Environment Variables:
BRAVE_API_KEY=your-api-keyAdd a variables (space comma or newline separated)
- Command:
-
Create a workflow that uses the MCP Client node:
- Add an MCP Client node
- Select the "List Tools" operation to see available search tools
- Add another MCP Client node
- Select the "Execute Tool" operation
- Choose the "brave_search" tool
- Set Parameters to:
{"query": "latest AI news"}
The node will execute the search and return the results in the output.
This example demonstrates how to set up multiple MCP servers in a production environment and use them with an AI agent:
- Configure your docker-compose.yml file:
version: '3'
services:
n8n:
image: n8nio/n8n
environment:
# MCP server environment variables
- 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
# Enable community nodes as tools
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
ports:
- "5678:5678"
volumes:
- ~/.n8n:/home/node/.n8n-
Create multiple MCP Client credentials in n8n:
Brave Search Credentials:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-brave-search
OpenAI Tools Credentials:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-openai
Web Search Credentials:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-serper
Weather API Credentials:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-weather
- Command:
-
Create an AI Agent workflow:
- Add an AI Agent node
- Enable MCP Client as a tool
- Configure different MCP Client nodes with different credentials
- Create a prompt that uses multiple data sources
Example AI Agent prompt:
I need you to help me plan a trip. First, search for popular destinations in {destination_country}.
Then, check the current weather in the top 3 cities.
Finally, find some recent news about travel restrictions for these places.
With this setup, the AI agent can use multiple MCP tools across different servers, all using environment variables configured in your Docker deployment.
This example shows how to connect to a locally running MCP server using Server-Sent Events (SSE):
-
Start a local MCP server that supports SSE:
npx @modelcontextprotocol/server-example-sse
Or run your own custom MCP server with SSE support on port 3001.
-
Configure MCP Client credentials:
- In the node settings, select Connection Type:
Server-Sent Events (SSE) - Create new credentials of type MCP Client (SSE) API
- Set SSE URL:
http://localhost:3001/sse - Add any required headers if your server needs authentication
- In the node settings, select Connection Type:
-
Create a workflow that uses the MCP Client node:
- Add an MCP Client node
- Set the Connection Type to
Server-Sent Events (SSE) - Select your SSE credentials
- Select the "List Tools" operation to see available tools
- Execute the workflow to see the results
This method is particularly useful when:
- Your MCP server is running as a standalone service
- You're connecting to a remote MCP server
- Your server requires special authentication headers
- You need to separate the transport channel from the message channel
The MCP Client node supports the following operations:
- 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
The List Tools operation returns all available tools from the MCP server, including their names, descriptions, and parameter schemas.
The Execute Tool operation allows you to execute a specific tool with parameters. Make sure to select the tool you want to execute from the dropdown menu.
This node can be used as a tool in n8n AI Agents. To enable community nodes as tools, you need to set the N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE environment variable to true.
If you're using a bash/zsh shell:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
n8n startIf you're using Docker: Add to your docker-compose.yml file:
environment:
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=trueIf you're using the desktop app:
Create a .env file in the n8n directory:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
If you want to set it permanently on Mac/Linux:
Add to your ~/.zshrc or ~/.bash_profile:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=trueExample of an AI Agent workflow results:
After setting this environment variable and restarting n8n, your MCP Client node will be available as a tool in AI Agent nodes.
- Requires n8n version 1.0.0 or later
- Compatible with MCP Protocol version 1.0.0 or later
- Supports both STDIO and SSE transports for connecting to MCP servers
- SSE transport requires a server that implements the MCP Server-Sent Events specification
N8n MCP Client — Интеграция MCP-серверов в n8n
N8n MCP Client — это community-узел для n8n, который позволяет подключаться к серверам, работающим по протоколу MCP (Model Context Protocol), и использовать их инструменты, ресурсы и промпты внутри рабочих процессов. MCP стандартизирует взаимодействие AI-моделей с внешними данными и инструментами, а этот узел даёт вам прямой доступ к таким возможностам прямо из n8n.
Официальный сайт n8n
Лицензия n8n
Установка
Установите узел через менеджер community-узлов n8n. Подробная инструкция — в документации n8n.
Важно: чтобы использовать MCP Client как инструмент в AI-агентах, установите переменную окружения N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true. Без этого узел не появится в списке инструментов агента.
Типы подключения (Credentials)
Узел поддерживает два транспорта:
STDIO (командная строка)
- Command — команда запуска MCP-сервера (например,
npx). - Arguments — аргументы для команды.
- Environment Variables — переменные в формате
ИМЯ=значение.
SSE (Server-Sent Events)
- SSE URL — адрес SSE-эндпоинта (по умолчанию
http://localhost:3001/sse). - Messages Post Endpoint — опциональный эндпоинт для отправки сообщений (если отличается от SSE URL).
- Additional Headers — дополнительные заголовки (формат:
имя:значение, по одному на строку).
Переменные окружения
Вы можете передавать переменные MCP-серверу двумя способами:
- Через UI credentials — переменные задаются прямо в настройках учётных данных и хранятся в n8n.
- Через Docker-переменные — в
docker-compose.ymlдобавьте переменные с префиксомMCP_:
services:
n8n:
image: n8nio/n8n
environment:
- MCP_BRAVE_API_KEY=your-api-key-here
- MCP_OPENAI_API_KEY=your-openai-key-here
Эти переменные будут автоматически переданы MCP-серверу при запуске.
Доступные операции (Operations)
- Execute Tool — выполнить конкретный инструмент с параметрами.
- Get Prompt — получить шаблон промпта.
- List Prompts — список доступных промптов.
- List Resources — список ресурсов, предоставляемых MCP-сервером.
- List Tools — список всех доступных инструментов (имена, описания, схемы параметров).
- Read Resource — прочитать ресурс по URI.
Примеры использования
Пример 1: Подключение Brave Search через STDIO
- Установите MCP-сервер:
npm install -g @modelcontextprotocol/server-brave-search - Создайте credentials со стандартным транспортом:
- Command:
npx - Arguments:
-y @modelcontextprotocol/server-brave-search - Environment Variables:
BRAVE_API_KEY=ваш-ключ
- Command:
- В workflow добавьте MCP Client, выберите операцию List Tools — увидите инструмент
brave_search. - Добавьте ещё один MCP Client с операцией Execute Tool, выберите
brave_search, задайте параметры:
{"query": "latest AI news"}
Узел вернёт результаты поиска.
Пример 2: Несколько MCP-серверов c AI-агентом (Docker)
В docker-compose.yml укажите переменные для нескольких сервисов:
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
Создайте отдельные credentials для каждого сервера (Brave Search, OpenAI, Serper, Weather и т.д.). В workflow AI-агента добавьте MCP Client как инструмент и задайте промпт, использующий данные из разных источников, например:
«Найди популярные направления в {destination_country}, проверь погоду в трёх лучших городах и найди последние новости об ограничениях на поездки.»
Пример 3: Подключение к локальному MCP-серверу через SSE
- Запустите MCP-сервер с поддержкой SSE, например:
npx @modelcontextprotocol/server-example-sse
- Создайте credentials типа SSE:
- SSE URL:
http://localhost:3001/sse - При необходимости добавьте заголовки аутентификации.
- SSE URL:
- Выберите операцию List Tools — узел покажет доступные инструменты сервера.
Этот способ удобен, когда сервер работает как отдельный сервис, требует аутентификации или транспорт отделён от канала сообщений.
Использование в AI-агентах
Чтобы MCP Client стал доступен как инструмент для AI-агента, установите переменную окружения:
- bash/zsh:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true - Docker: добавьте в
environmentконтейнера. - Desktop-приложение: создайте
.envфайл в директории n8n с этой строкой. - Постоянно (Mac/Linux): добавьте в
~/.zshrcили~/.bash_profile.
После перезапуска n8n узел появится в списке инструментов агента.
Совместимость
- Требуется n8n версии 1.0.0 или выше.
- MCP-протокол версии 1.0.0 и выше.
- Поддерживаются оба транспорта: STDIO и SSE.
- Для SSE необходим сервер, реализующий спецификацию MCP Server-Sent Events.
Полезные ссылки
- Документация community-узлов n8n
- Документация Model Context Protocol
- MCP TypeScript SDK
- Транспорты MCP
- Реализация SSE в MCP
Видеоресурсы: рекомендуем посмотреть плейлист «MCP Explained» на YouTube — серия видео, глубоко разбирающих протокол MCP: MCP Explained.
Какие операции поддерживает MCP Client?
Нода поддерживает такие операции, как выполнение инструментов, получение/список промптов, список ресурсов и чтение конкретных ресурсов с MCP-сервера.
Как установить N8n MCP Client?
Следуйте стандартному руководству по установке n8n community node. Вам также потребуется задать переменную окружения `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE` в значение `true`, если вы планируете использовать её как инструмент в AI Agents.
Как использовать N8n MCP Client с AI Agents?
После установки и включения community nodes в качестве
Комментарии
Комментариев пока нет. Будьте первым.