# n8n-mcp-server

> MCP Server

The n8n MCP Server enables AI assistants to interact with n8n workflows using natural language. It allows assistants to manage workflows, execute them, and access related information, facilitating AI-driven automation.

## Overview

- **Category:** Productivity
- **Language:** TypeScript
- **Stars:** 1636
- **Forks:** 12
- **Owner:** leonardsellem
- **GitHub:** https://github.com/leonardsellem/n8n-mcp-server
- **Created:** 2025-03-12T15:56:12+00:00
- **Updated:** 2025-03-28T23:10:01+00:00
- **Source:** https://model-context-protocol.com/servers/n8n-api-ai-workflow-automation-server

## Setup

## Setup

1.  **Prerequisites:** Node.js 18 or later, and an n8n instance with API access enabled.
2.  **Install from npm:**

    ```bash
    npm install -g n8n-mcp-server
    ```

3.  **Install from source:**

    ```bash
    # 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 .
    ```

4.  **Configuration:** Create a `.env` file using `.env.example` as a template and configure the environment variables.

    ```bash
    cp .env.example .env
    ```

    Configure the following environment variables:

    | Variable | Description | Example |
    |----------|-------------|---------|
    | `N8N_API_URL` | URL of the n8n API | `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` |

5.  **Generating an n8n API Key:** Follow the instructions to create and copy an API key from your n8n instance to your `.env` file.
6.  **Running the Server:** Execute `n8n-mcp-server` from the installation directory or globally.
7.  **Integrating with AI Assistants:** Register the server with your AI assistant platform, using the MCP installer as an example.

    ```bash
    npx @anaisbetts/mcp-installer
    ```

    Then register the server:

    ```
    install_local_mcp_server path/to/n8n-mcp-server
    ```

## Tools

## Available Tools

1.  **Using Webhooks** (Execute workflows through n8n webhooks with Basic Authentication).
2.  **`workflow_list`** (List all workflows).
3.  **`workflow_get`** (Get details of a specific workflow).
4.  **`workflow_create`** (Create a new workflow).
5.  **`workflow_update`** (Update an existing workflow).
6.  **`workflow_delete`** (Delete a workflow).
7.  **`workflow_activate`** (Activate a workflow).
8.  **`workflow_deactivate`** (Deactivate a workflow).
9.  **`execution_run`** (Execute a workflow via the API).
10. **`run_webhook`** (Execute a workflow via a webhook).
11. **`execution_get`** (Get details of a specific execution).
12. **`execution_list`** (List executions for a workflow).
13. **`execution_stop`** (Stop a running execution).
