ateeyak_n8n_nodes_mcp

ateeyak_n8n_nodes_mcp

by ateeyak
Enables interaction with Model Context Protocol (MCP) servers within n8n workflows for AI model integration.

n8n MCP Client Integration

Overview

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.

Installation

To install the n8n MCP Client node, follow the installation guide in the n8n community nodes documentation.

Credentials

The MCP Client node supports two types of credentials to connect to an MCP server:

Command-line Based Transport (STDIO)

  • 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.

MCP Client STDIO Credentials

Server-Sent Events (SSE) Transport

  • 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).

MCP Client SSE Credentials

Environment Variables

The MCP Client node supports passing environment variables to MCP servers using the command-line based transport in two ways:

1. Using the Credentials UI

You can add environment variables directly in the credentials configuration.

Environment Variables in Credentials

2. Using Docker Environment Variables

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...

Usage

Example: Using Brave Search MCP Server

  1. Install the Brave Search MCP server:
    shell npm install -g @modelcontextprotocol/server-brave-search
  2. Configure MCP Client credentials:
  3. Command: npx
  4. Arguments: -y @modelcontextprotocol/server-brave-search
  5. Environment Variables: BRAVE_API_KEY=your-api-key
  6. Create a workflow that uses the MCP Client node:
  7. Add an MCP Client node.
  8. Select the "List Tools" operation to see available search tools.
  9. Add another MCP Client node.
  10. Select the "Execute Tool" operation.
  11. Choose the brave_search tool.
  12. Set Parameters to: {"query": "latest AI news"}.

Brave Search Example

Example: Multi-Server Setup with AI Agent

  1. Configure your docker-compose.yml file:
    ```yaml
    version: '3'

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.

Multi-Server Setup

Example: Using a Local MCP Server with SSE

  1. Start a local MCP server that supports SSE:
    shell npx @modelcontextprotocol/server-example-sse
  2. Configure MCP Client credentials:
  3. Select Connection Type: Server-Sent Events (SSE).
  4. Set SSE URL: http://localhost:3001/sse.
  5. Create a workflow that uses the MCP Client node.

SSE Example

Operations

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.

MCP Client Operations

Example: List Tools Operation

List Tools Example

Example: Execute Tool Operation

Execute Tool Example

Using as a Tool

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.

Setting the Environment Variable

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

AI Agent Example

Compatibility

  • 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.

Resources

License

MIT License

Features & Capabilities

Categories
mcp_server model_context_protocol javascript typescript api_integration docker search n8n workflow_automation

Implementation Details

Stats

0 Views
1 GitHub Stars

Repository Info

ateeyak Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300