Skip to main content

MCP server for n8n workflow automation

Project description

n8n MCP Server

PyPI version Python License: MIT

An MCP (Model Context Protocol) server that provides seamless integration with n8n workflow automation platform. This server automatically exposes all n8n API endpoints as MCP tools based on the OpenAPI specification.

The server includes 40+ tools covering all n8n API operations including workflows, executions, credentials, tags, users, projects, variables, and more.

Note: The server automatically handles JSON string serialization issues that can occur with some MCP clients, ensuring that object fields like settings and connections are properly formatted for the n8n API.

Custom Lightweight Tools

In addition to the standard n8n API tools, the server provides custom lightweight alternatives for working within MCP 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

These tools are useful when the standard API responses are too large for MCP clients.

Features

  • Automatic tool generation from n8n OpenAPI spec
  • Full authentication support via API key
  • Access to all n8n API endpoints (workflows, executions, credentials, etc.)
  • Built with FastMCP for reliable performance

Prerequisites

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

Installation

From PyPI (Recommended)

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

  1. Create a .env file in the project root:
N8N_HOST=https://your-n8n-instance.com
N8N_API_KEY=your-api-key-here

Replace the values with your actual n8n instance URL and API key.

Usage

Running the Server

Start the MCP server:

n8n-mcp

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

Testing Connection

Before running the server, you can test your connection:

python test_connection.py

This will verify that your n8n instance is accessible and the API key is valid.

Available Tools

Once running, the MCP server exposes all n8n API endpoints as tools, including:

  • Workflows: Create, read, update, delete, and execute workflows
  • Executions: Monitor and manage workflow executions
  • Credentials: Manage credentials (with appropriate permissions)
  • Nodes: Access node information
  • Users: User management (admin only)
  • And many more based on your n8n instance's API

MCP Client Configuration

To use this server with an MCP client, add it to your client's configuration.

Option 1: Using .env file (recommended)

If you have already configured your .env file:

{
  "servers": {
    "n8n": {
      "command": "n8n-mcp"
    }
  }
}

Option 2: Using environment variables in config

If you prefer to specify credentials in the MCP config:

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

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 is running (you should see "Created FastMCP OpenAPI server with 40 routes")
  • Check that the openapi_spec.json file exists in the server directory
  • Verify the MCP client configuration includes the correct cwd path

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
  • Test with python test_connection.py first

Missing Tools

  • The available tools depend on your n8n instance version and configuration
  • Some endpoints may require admin permissions

License

MIT

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.0.tar.gz (36.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.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: n8n_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 36.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.0.tar.gz
Algorithm Hash digest
SHA256 9e759cdc17a701e59765fca5cce45f6aed3db2963cd769c0954a258a1cedb4ba
MD5 9f0d905c021d56179f9c6d2bcea4043f
BLAKE2b-256 db5605664d0e7d10597e84fe3e9224b6fcebf7ef226f05cded6efc1341fdc8a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: n8n_mcp_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for n8n_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc4eca32db6497d82ecbfa757cf5d6349f779aab68a577fae4456a75416f8b37
MD5 1d20800403b271dd8d317835b40e51de
BLAKE2b-256 5d28fc17e3edfdb96813e300c1cd9805f73ebc16eab196ba0939067d0203f50e

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