# n8n

> MCP Server

**Concise Description:**

Workflow automation platform. Visual builder, custom code, AI, 400+ integrations. Self-host/cloud. Automate tasks & connect apps.

## Overview

- **Category:** AI
- **Language:** TypeScript
- **Stars:** 198265
- **Forks:** 34323
- **Owner:** n8n-io
- **GitHub:** https://github.com/n8n-io/n8n
- **Homepage:** https://n8n.io
- **Created:** 2019-06-22T09:24:21+00:00
- **Updated:** 2025-07-07T16:55:55+00:00
- **Source:** https://model-context-protocol.com/servers/n8n

## Setup

## Setup

n8n can be quickly set up using either `npx` or Docker. Choose the method that best suits your needs.

### Prerequisites

*   **Node.js (for npx):** Ensure you have Node.js installed. It is recommended to use the latest LTS version. You can download it from [nodejs.org](https://nodejs.org/en/).
*   **Docker (for Docker):** Ensure you have Docker installed. You can download it from [docker.com](https://www.docker.com/get-started).

### Installation

#### Using npx (for quick testing)

1.  Open your terminal.
2.  Run the following command:

    ```bash
    npx n8n
    ```

    This will download and start n8n.

#### Using Docker (for persistent deployments)

1.  Open your terminal.
2.  Create a Docker volume to persist your n8n data:

    ```bash
    docker volume create n8n_data
    ```

3.  Run the n8n Docker container:

    ```bash
    docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
    ```

    *   `-it`: Runs the container in interactive mode.
    *   `--rm`: Automatically removes the container when it exits.
    *   `--name n8n`: Assigns the name "n8n" to the container.
    *   `-p 5678:5678`: Maps port 5678 on your host machine to port 5678 in the container.  This is the default port n8n uses.
    *   `-v n8n_data:/home/node/.n8n`: Mounts the `n8n_data` volume to the n8n data directory inside the container, ensuring your data persists between container restarts.
    *   `docker.n8n.io/n8nio/n8n`: Specifies the n8n Docker image to use.

### Accessing n8n

After running either the `npx` or Docker command, n8n will be accessible in your web browser at:

```
http://localhost:5678
```

### Configuration (Docker - Optional)

For more advanced configurations (e.g., setting up a database, configuring email, or setting environment variables), refer to the [n8n documentation](https://docs.n8n.io).  You can pass environment variables to the Docker container using the `-e` flag.

For example:

```bash
docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n -e N8N_PORT=5678 -e N8N_HOST=localhost docker.n8n.io/n8nio/n8n
```

### Environment Variables (Docker - Common Examples)

Here are some commonly used environment variables for configuring n8n when using Docker:

*   `N8N_PORT`: The port n8n will listen on (default: `5678`).
*   `N8N_HOST`: The hostname n8n will use (default: `localhost`).
*   `N8N_PROTOCOL`: The protocol n8n will use (default: `http`).  Use `https` for secure connections.
*   `N8N_BASIC_AUTH_ACTIVE`: Set to `true` to enable basic authentication.
*   `N8N_BASIC_AUTH_USER`: The username for basic authentication.
*   `N8N_BASIC_AUTH_PASSWORD`: The password for basic authentication.
*   `DB_TYPE`: The database type to use (e.g., `postgres`, `mysql`, `sqlite`).  Defaults to `sqlite`.
*   `DB_POSTGRESQL_HOST`: The hostname of the PostgreSQL database.
*   `DB_POSTGRESQL_PORT`: The port of the PostgreSQL database.
*   `DB_POSTGRESQL_DATABASE`: The name of the PostgreSQL database.
*   `DB_POSTGRESQL_USER`: The username for the PostgreSQL database.
*   `DB_POSTGRESQL_PASSWORD`: The password for the PostgreSQL database.

Refer to the [n8n documentation](https://docs.n8n.io) for a complete list of available environment variables and their descriptions.

## Tools

## Available Tools

Here's a breakdown of n8n's key capabilities, presented as tools and features:

*   **Visual Workflow Editor:**
    *   **What it does:** Provides a drag-and-drop interface to design and build automation workflows without writing code. Connect nodes representing different services and operations to create complex automation logic.
    *   **Usage:** Drag and drop nodes, connect them visually, configure each node's settings, and execute the workflow.

*   **Code Execution (JavaScript/Python):**
    *   **What it does:** Allows you to incorporate custom JavaScript or Python code directly into your workflows for advanced logic, data manipulation, or integration with services that don't have dedicated nodes.
    *   **Usage:** Use the Function node to write JavaScript code or the Python Script node to execute Python code within your workflow.

*   **npm Package Integration:**
    *   **What it does:** Enables the use of npm packages within JavaScript code nodes, extending the functionality and capabilities of your workflows.
    *   **Usage:** `require('your-npm-package')` within a Function node to use the package.

*   **AI-Native Platform (LangChain):**
    *   **What it does:** Facilitates the creation of AI agent workflows using LangChain. Allows you to integrate your own data and models for custom AI-powered automations.
    *   **Usage:** Utilize LangChain nodes to build AI agents that can perform tasks such as natural language processing, data analysis, and decision-making. Refer to the [AI & LangChain Guide](https://docs.n8n.io/langchain/) for detailed instructions.

*   **400+ Integrations:**
    *   **What it does:** Provides pre-built nodes for connecting to a wide range of popular services and applications, including CRMs, marketing automation platforms, databases, and more.
    *   **Usage:** Search for the desired service in the node library and add it to your workflow. Configure the node with your credentials and settings.

*   **Workflow Templates:**
    *   **What it does:** Offers a library of pre-built workflow templates that you can use as a starting point for your automations. These templates cover common use cases and can be customized to fit your specific needs.
    *   **Usage:** Browse the [templates](https://n8n.io/workflows) and import the one that best suits your needs. Modify the nodes and settings to match your requirements.

*   **Self-Hosting:**
    *   **What it does:** Allows you to deploy n8n on your own infrastructure, giving you full control over your data and security.
    *   **Usage:** Install n8n using Docker, npm, or other methods as described in the [documentation](https://docs.n8n.io).

*   **Cloud Offering:**
    *   **What it does:** Provides a managed cloud environment for running n8n workflows, eliminating the need for self-hosting.
    *   **Usage:** Sign up for an account on [n8n cloud](https://app.n8n.cloud/login) and start building workflows.

*   **Enterprise Features:**
    *   **What it does:** Offers advanced features for enterprise users, such as advanced permissions, SSO (Single Sign-On), and air-gapped deployments.
    *   **Usage:** Contact n8n sales for more information on enterprise features and pricing.

*   **Fair-Code License:**
    *   **What it does:** Provides transparency and flexibility with a source-available license that allows self-hosting, modification, and extension.
    *   **Usage:** Review the [Sustainable Use License](https://github.com/n8n-io/n8n/blob/master/LICENSE.md) for details on usage rights and restrictions.

## Related Articles

- [n8n: Visual AI Agent Workflows & MCP Server for Automation](https://model-context-protocol.com/blog/n8n-visual-ai-agent-workflows-mcp-server-for-automation-mcp-server-guide)
