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
Provider
Leonard Sellem
Release date
Mar 18, 2025
Language
TypeScript
Package
Stats
6.8K downloads
214 stars

The n8n MCP Server allows AI assistants to interact with n8n workflows through natural language. This server bridges the gap between AI systems and n8n, enabling assistants to manage workflows, trigger executions, and monitor results without requiring direct n8n API knowledge.

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:

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 (if using webhooks) 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

Usage

Running the Server

From the installation directory:

n8n-mcp-server

Or if installed globally:

n8n-mcp-server

Integrating with AI Assistants

After building the server, configure your AI assistant (like VS Code with Claude extension or Claude Desktop app) to run it.

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"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Key Points:

  • Replace the path with your actual absolute path
  • Use correct path separator for your OS (forward slashes / for macOS/Linux, double backslashes \\ for Windows)
  • The server must be built first (npm run build)

Available Tools

Using Webhooks

This MCP server supports executing workflows through n8n webhooks:

  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

Example:

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

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

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 add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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