n8n MCP server

Integrates with n8n workflow automation platform to enable workflow management, execution monitoring, and task automation through a bridge that connects AI capabilities with n8n's powerful automation tools.
Back to servers
Setup instructions
Provider
Leonard Sellem
Release date
Mar 18, 2025
Language
TypeScript
Package
Stats
8.0K downloads
623 stars

The n8n MCP Server enables AI assistants to interact with n8n workflows through natural language, acting as a bridge between AI assistants and the n8n workflow automation tool. It allows programmatic management of workflows and executions using conversational commands.

Installation

Prerequisites

  • Node.js 20 or later
  • n8n instance with API access enabled

Installing the Server

You can install the n8n MCP Server using one of these methods:

Option 1: Install from npm

npm install -g @leonardsellem/n8n-mcp-server

Option 2: Install from source

# Clone the repository
git clone https://github.com/leonardsellem/n8n-mcp-server.git
cd n8n-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Optional: Install globally
npm install -g .

Option 3: Docker Installation

# Pull the image
docker pull leonardsellem/n8n-mcp-server

# Run the container with your n8n API configuration
docker run -e N8N_API_URL=http://your-n8n:5678/api/v1 \
  -e N8N_API_KEY=your_n8n_api_key \
  -e N8N_WEBHOOK_USERNAME=username \
  -e N8N_WEBHOOK_PASSWORD=password \
  leonardsellem/n8n-mcp-server

Configuration

Create a .env file in the directory where you'll run the server:

cp .env.example .env

Configure these environment variables:

Variable Description Example
N8N_API_URL Full URL of the n8n API, including /api/v1 http://localhost:5678/api/v1
N8N_API_KEY API key for authenticating with n8n n8n_api_...
N8N_WEBHOOK_USERNAME Username for webhook authentication username
N8N_WEBHOOK_PASSWORD Password for webhook authentication password
DEBUG Enable debug logging (optional) true or false

Generating an n8n API Key

  1. Open your n8n instance in a browser
  2. Go to Settings > API > API Keys
  3. Create a new API key with appropriate permissions
  4. Copy the key to your .env file

Running the Server

Once installed, you can run the server:

n8n-mcp-server

Updating the Server

If installed via npm

npm install -g @leonardsellem/n8n-mcp-server@latest

If installed from source

cd path/to/n8n-mcp-server
git pull origin main
npm install
npm run build
npm install -g .  # If you installed globally before

If using Docker

docker pull leonardsellem/n8n-mcp-server:latest
docker stop <your_container_name_or_id>
docker rm <your_container_name_or_id>
docker run -e N8N_API_URL=http://your-n8n:5678/api/v1 \
  -e N8N_API_KEY=your_n8n_api_key \
  -e N8N_WEBHOOK_USERNAME=username \
  -e N8N_WEBHOOK_PASSWORD=password \
  leonardsellem/n8n-mcp-server:latest

Integrating with AI Assistants

Configure your AI assistant to run the MCP server by editing its configuration file:

{
  "mcpServers": {
    "n8n-local": {
      "command": "node",
      "args": [
        "/path/to/your/cloned/n8n-mcp-server/build/index.js"
      ],
      "env": {
        "N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
        "N8N_API_KEY": "YOUR_N8N_API_KEY"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Important notes:

  • Use absolute paths to the built index.js file
  • On Windows, use double backslashes in paths (e.g., C:\\path\\to\\file)
  • Ensure you've built the server with npm run build before configuring the assistant

Available Tools

The server provides various tools for workflow and execution management:

Workflow Management

  • workflow_list: List all workflows
  • workflow_get: Get details of a specific workflow
  • workflow_create: Create a new workflow
  • workflow_update: Update an existing workflow
  • workflow_delete: Delete a workflow
  • workflow_activate: Activate a workflow
  • workflow_deactivate: Deactivate a workflow

Execution Management

  • execution_run: Execute a workflow via the API
  • run_webhook: Execute a workflow via a webhook
  • execution_get: Get details of a specific execution
  • execution_list: List executions for a workflow
  • execution_stop: Stop a running execution

Using Webhooks

To use webhook functionality:

  1. Create a webhook-triggered workflow in n8n
  2. Set up Basic Authentication on your webhook node
  3. Use the run_webhook tool, providing the workflow name

Example:

const result = await useRunWebhook({
  workflowName: "hello-world", // Will call <n8n-url>/webhook/hello-world
  data: {
    prompt: "Hello from AI assistant!"
  }
});

Available Resources

The server provides these resources:

  • n8n://workflows/list: List of all workflows
  • n8n://workflow/{id}: Details of a specific workflow
  • n8n://executions/{workflowId}: List of executions for a workflow
  • n8n://execution/{id}: Details of a specific execution

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "n8n-local" '{"command":"node","args":["/path/to/your/cloned/n8n-mcp-server/build/index.js"],"env":{"N8N_API_URL":"http://your-n8n-instance:5678/api/v1","N8N_API_KEY":"YOUR_N8N_API_KEY"},"disabled":false,"autoApprove":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "n8n-local": {
            "command": "node",
            "args": [
                "/path/to/your/cloned/n8n-mcp-server/build/index.js"
            ],
            "env": {
                "N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
                "N8N_API_KEY": "YOUR_N8N_API_KEY"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "n8n-local": {
            "command": "node",
            "args": [
                "/path/to/your/cloned/n8n-mcp-server/build/index.js"
            ],
            "env": {
                "N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
                "N8N_API_KEY": "YOUR_N8N_API_KEY"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later