n8n-mcp-server

MCP server that provides tools and resources for interacting with n8n API

GitHub Stars

1,308

User Rating

Not Rated

Favorites

0

Views

46

Forks

225

Issues

23

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Node.js 20以上
n8n APIアクセスが有効なインスタンス

Installation

Installation

Prerequisites

Node.js: 20 or later
n8n: Instance with API access enabled

Installation Steps

Install from npm

bash
npm install -g @leonardsellem/n8n-mcp-server

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 .

Docker Installation

bash

Pull the image

docker pull leonardsellem/n8n-mcp-server

Run the container

docker run -e N8N_API_URL=http://your-n8n:5678/api/v1 \ -e N8N_API_KEY=your_n8n_api_key \ -e N8N_WEBHOOK_USERNAME=username \ -e N8N_WEBHOOK_PASSWORD=password \ leonardsellem/n8n-mcp-server

Troubleshooting

If the server won't start, check the Node.js version and reinstall dependencies.

Configuration

Configuration

Basic Configuration

Environment Variables

You need to set the following environment variables:
bash
echo 'export N8N_API_URL=http://your-n8n:5678/api/v1' >> ~/.bashrc
source ~/.bashrc

Configuration Example

Basic Configuration

json
{
  "mcpServers": {
    "n8n-mcp": {
      "command": "node",
      "args": ["server.js"],
      "env": {
        "N8N_API_URL": "http://your-n8n:5678/api/v1",
        "N8N_API_KEY": "your_n8n_api_key"
      }
    }
  }
}

Examples

Examples

Basic Usage

Programmatic Usage

javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');

const client = new MCPClient();
await client.connect();

// Execute tool
const result = await client.callTool('toolName', {
  parameter1: 'value1',
  parameter2: 'value2'
});

console.log(result);

API Integration

python

Python example

import requests def call_mcp_tool(tool_name, params): response = requests.post( 'http://localhost:3000/mcp/call', json={ 'tool': tool_name, 'parameters': params } ) return response.json()

Usage example

result = call_mcp_tool('analyze', { 'input': 'sample data', 'options': {'format': 'json'} })

Use Cases

Trigger workflows using natural language commands from AI assistants.
Execute automated data processing tasks within n8n workflows.
Integrate multiple APIs for data retrieval and processing.
Automate the generation of periodic reports using n8n.

Additional Resources