The n8n MCP Server enables AI assistants to interact with n8n workflows through natural language, acting as a bridge between AI assistants and the n8n workflow automation tool. It allows programmatic management of workflows and executions using conversational commands.
You can install the n8n MCP Server using one of these methods:
npm install -g @leonardsellem/n8n-mcp-server
# 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 .
# Pull the image
docker pull leonardsellem/n8n-mcp-server
# Run the container with your n8n API configuration
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
Create a .env
file in the directory where you'll run the server:
cp .env.example .env
Configure these environment variables:
Variable | Description | Example |
---|---|---|
N8N_API_URL |
Full URL of the n8n API, including /api/v1 |
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 |
.env
fileOnce installed, you can run the server:
n8n-mcp-server
npm install -g @leonardsellem/n8n-mcp-server@latest
cd path/to/n8n-mcp-server
git pull origin main
npm install
npm run build
npm install -g . # If you installed globally before
docker pull leonardsellem/n8n-mcp-server:latest
docker stop <your_container_name_or_id>
docker rm <your_container_name_or_id>
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:latest
Configure your AI assistant to run the MCP server by editing its configuration file:
{
"mcpServers": {
"n8n-local": {
"command": "node",
"args": [
"/path/to/your/cloned/n8n-mcp-server/build/index.js"
],
"env": {
"N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
"N8N_API_KEY": "YOUR_N8N_API_KEY"
},
"disabled": false,
"autoApprove": []
}
}
}
Important notes:
C:\\path\\to\\file
)npm run build
before configuring the assistantThe server provides various tools for workflow and execution management:
workflow_list
: List all workflowsworkflow_get
: Get details of a specific workflowworkflow_create
: Create a new workflowworkflow_update
: Update an existing workflowworkflow_delete
: Delete a workflowworkflow_activate
: Activate a workflowworkflow_deactivate
: Deactivate a workflowexecution_run
: Execute a workflow via the APIrun_webhook
: Execute a workflow via a webhookexecution_get
: Get details of a specific executionexecution_list
: List executions for a workflowexecution_stop
: Stop a running executionTo use webhook functionality:
run_webhook
tool, providing the workflow nameExample:
const result = await useRunWebhook({
workflowName: "hello-world", // Will call <n8n-url>/webhook/hello-world
data: {
prompt: "Hello from AI assistant!"
}
});
The server provides these resources:
n8n://workflows/list
: List of all workflowsn8n://workflow/{id}
: Details of a specific workflown8n://executions/{workflowId}
: List of executions for a workflown8n://execution/{id}
: Details of a specific executionTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "n8n-local" '{"command":"node","args":["/path/to/your/cloned/n8n-mcp-server/build/index.js"],"env":{"N8N_API_URL":"http://your-n8n-instance:5678/api/v1","N8N_API_KEY":"YOUR_N8N_API_KEY"},"disabled":false,"autoApprove":[]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"n8n-local": {
"command": "node",
"args": [
"/path/to/your/cloned/n8n-mcp-server/build/index.js"
],
"env": {
"N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
"N8N_API_KEY": "YOUR_N8N_API_KEY"
},
"disabled": false,
"autoApprove": []
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"n8n-local": {
"command": "node",
"args": [
"/path/to/your/cloned/n8n-mcp-server/build/index.js"
],
"env": {
"N8N_API_URL": "http://your-n8n-instance:5678/api/v1",
"N8N_API_KEY": "YOUR_N8N_API_KEY"
},
"disabled": false,
"autoApprove": []
}
}
}
3. Restart Claude Desktop for the changes to take effect