MCP HubMCP Hub
leonardsellem

n8n-mcp-server

by: leonardsellem

MCP server that provides tools and resources for interacting with n8n API

153created 12/03/2025
Visit
n8n
API

📌Overview

Purpose: The main goal of the n8n MCP Server is to facilitate interaction between AI assistants and n8n workflows using natural language commands.

Overview: The n8n MCP Server offers tools and resources that empower AI assistants to effectively manage n8n workflows. It supports a range of operations, making it easier to create, modify, and monitor workflows through an intuitive API.

Key Features:

  • Workflow Management: Enables listing, creating, updating, deleting, activating, and deactivating workflows, streamline management tasks for users.

  • Execution Management: Allows execution of workflows, along with monitoring execution status and accessing detailed execution logs, ensuring better control and oversight of workflows.


n8n MCP Server

A Model Context Protocol (MCP) server that allows AI assistants to interact with n8n workflows through natural language.

Overview

This MCP server provides tools and resources for AI assistants to manage n8n workflows and executions. It allows assistants to:

  • List, create, update, and delete workflows
  • Activate and deactivate workflows
  • Execute workflows and monitor their status
  • Access workflow information and execution statistics

Installation

Prerequisites

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

Install from npm

npm install -g n8n-mcp-server

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 .

Configuration

Create a .env file in the directory where you'll run the server, using .env.example as a template:

cp .env.example .env

Configure the following environment variables:

VariableDescriptionExample
N8N_API_URLFull URL of the n8n API, including /api/v1http://localhost:5678/api/v1
N8N_API_KEYAPI key for authenticating with n8nn8n_api_...
N8N_WEBHOOK_USERNAMEUsername for webhook authentication (optional)username
N8N_WEBHOOK_PASSWORDPassword for webhook authentication (optional)password
DEBUGEnable 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

Usage

Running the Server

From the installation directory or globally:

n8n-mcp-server

Integrating with AI Assistants

After building the server (npm run build), configure your AI assistant (e.g., VS Code with the Claude extension or the Claude Desktop app) to run it by editing a JSON configuration file.

Example Configuration:

{
  "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"
        // Add webhook credentials only if needed
        // "N8N_WEBHOOK_USERNAME": "your_webhook_user",
        // "N8N_WEBHOOK_PASSWORD": "your_webhook_password"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Key Points:

  • Replace /path/to/your/cloned/n8n-mcp-server/ with the actual absolute path.
  • Use the correct path separator for your OS (/ for macOS/Linux, \\ for Windows).
  • Provide the correct N8N_API_URL (including /api/v1) and N8N_API_KEY.
  • Build the server before running (npm run build).

Available Tools

Using Webhooks

This MCP server supports executing workflows through n8n webhooks. To use this functionality:

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

Example:

const result = await useRunWebhook({
  workflowName: "hello-world",
  data: {
    prompt: "Hello from AI assistant!"
  }
});

Webhook authentication uses the N8N_WEBHOOK_USERNAME and N8N_WEBHOOK_PASSWORD environment variables.

Workflow Management Tools

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

  • 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

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

Development

Building

npm run build

Running in Development Mode

npm run dev

Testing

npm test

Linting

npm run lint

License

MIT