Skip to main content

MCP server for n8n workflow automation

Project description

n8n MCP Server

PyPI version Python License: MIT

Connect your AI assistant to n8n workflow automation platform through the Model Context Protocol. This server provides direct access to n8n's entire REST API, enabling AI-powered workflow management, execution monitoring, and automation control.

Quick Start

  1. Install with uvx: uvx n8n-mcp-server
  2. Add to your Claude Desktop config:
{
  "mcpServers": {
    "n8n": {
      "command": "uvx",
      "args": ["n8n-mcp-server"],
      "env": {
        "N8N_HOST": "https://your-n8n.com",
        "N8N_API_KEY": "your-api-key"
      }
    }
  }
}
  1. Restart Claude Desktop and start automating!

Features

  • 40+ Auto-generated Tools - Full access to n8n's REST API
  • Smart JSON Handling - Automatically fixes JSON serialization issues
  • Custom Lightweight Tools - Optimized tools for working within token limits
  • Full Authentication - Secure API key authentication
  • Built with FastMCP - Reliable, high-performance MCP implementation

Custom Tools for Large Workflows

The server includes custom tools designed for handling large workflows that might exceed token limits:

  • list_workflows_minimal - Lists workflows with only essential metadata (id, name, active, dates, tags)
  • get_workflow_summary - Gets workflow info with node/connection counts instead of full data
  • partial_update_workflow - Updates specific nodes without sending the entire workflow
  • add_nodes_to_workflow - Adds new nodes and automatically handles connection rewiring

Prerequisites

  • Python 3.8 or higher
  • An n8n instance with API access enabled
  • n8n API key

Installation

Using uvx (Recommended)

The easiest way to use n8n MCP Server is with uvx, which runs the server in an isolated environment:

{
  "mcpServers": {
    "n8n": {
      "command": "uvx",
      "args": ["n8n-mcp-server"],
      "env": {
        "N8N_HOST": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your-api-key-here"
      }
    }
  }
}

Using pip

pip install n8n-mcp-server

From Source

  1. Clone this repository:
git clone https://github.com/andrewlwn77/n8n-mcp-server.git
cd n8n-mcp-server
  1. Install in development mode:
pip install -e .

Configuration

The server requires two environment variables:

You can provide these through:

  1. Environment variables in your MCP client configuration (recommended for uvx)
  2. A .env file in your working directory:
N8N_HOST=https://your-n8n-instance.com
N8N_API_KEY=your-api-key-here

Usage

Running the Server

Start the MCP server:

n8n-mcp-server

Or if running from source:

python -m n8n_mcp

The server will:

  1. Connect to your n8n instance
  2. Fetch the OpenAPI specification
  3. Generate MCP tools for all available endpoints
  4. Start listening for MCP requests

What Can You Do?

With n8n MCP Server, your AI assistant can:

  • Manage Workflows - Create, update, delete, and organize automation workflows
  • Execute Workflows - Trigger workflow runs and pass custom data
  • Monitor Executions - Check workflow status, review logs, and handle errors
  • Work with Credentials - Safely manage authentication for external services
  • Handle Large Workflows - Use optimized tools designed for token limits
  • Update Specific Nodes - Modify individual workflow nodes without affecting others
  • Add Nodes Dynamically - Insert new nodes and automatically rewire connections

Important Note on Workflow Creation: The Create_a_workflow tool should only be used for complete workflows. Never use it to create partial workflows or incomplete structures. For large workflows that exceed token limits, either copy/paste the complete JSON directly into n8n or use the add_nodes_to_workflow tool to build up an existing workflow incrementally.

Example commands you can give your AI assistant:

  • "List all my active workflows"
  • "Execute the 'Daily Report' workflow with today's date"
  • "Show me failed executions from the last 24 hours"
  • "Add a Slack notification node to my error handling workflow"
  • "Update the schedule trigger to run every hour instead of daily"

MCP Client Configuration

Claude Desktop

Add to your Claude Desktop configuration:

Using uvx (Recommended)

{
  "mcpServers": {
    "n8n": {
      "command": "uvx",
      "args": ["n8n-mcp-server"],
      "env": {
        "N8N_HOST": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your-api-key-here"
      }
    }
  }
}

Using pip installation

{
  "mcpServers": {
    "n8n": {
      "command": "n8n-mcp-server",
      "env": {
        "N8N_HOST": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your-api-key-here"
      }
    }
  }
}

Using .env file

If you have a .env file in your working directory:

{
  "mcpServers": {
    "n8n": {
      "command": "n8n-mcp-server"
    }
  }
}

Security Notes

  • Keep your .env file secure and never commit it to version control
  • Use environment-specific API keys with minimal required permissions
  • Consider using read-only API keys for development/testing

Troubleshooting

No Tools Showing in MCP Client

  • Ensure the server started successfully
  • Check that your n8n credentials are correct
  • Verify the MCP client can connect to the server

Connection Failed

  • Verify your n8n instance URL is correct and includes the protocol (https://)
  • Check that your API key is valid and has the necessary permissions
  • Ensure your n8n instance has API access enabled
  • Make sure the n8n instance is accessible from your network

Missing Tools

  • The available tools depend on your n8n instance version and configuration
  • Some endpoints may require admin permissions
  • Check the server logs for any errors during initialization

Related Documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

n8n_mcp_server-0.1.11.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

n8n_mcp_server-0.1.11-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file n8n_mcp_server-0.1.11.tar.gz.

File metadata

  • Download URL: n8n_mcp_server-0.1.11.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for n8n_mcp_server-0.1.11.tar.gz
Algorithm Hash digest
SHA256 cbc99d988ede9d8ca29c84e3bc3da60aaef2474eb02cf5fa156c1803c9d62b04
MD5 8528c67a17b901930e1a94f5878b58ad
BLAKE2b-256 382e70eaffbbe81a71751d74fd7e5cfaa98989165708f728b4c879ae364fbb16

See more details on using hashes here.

File details

Details for the file n8n_mcp_server-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for n8n_mcp_server-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 3793f591478f5e24a8b56f0dc6de08798bcb81ced2f5e6948c0ce0d8477ad4c7
MD5 e074224bf7e761ca0e1e07d245f8d111
BLAKE2b-256 9a801f3d99d5be5614cc345fd5b8580f2e5d63793815ce905de74113565efc2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page