You signed in with another tab or window. Reload
to refresh your session. You signed out in another tab or window. Reload
to refresh your session. You switched accounts on another tab or window. Reload
to refresh your session. Dismiss alert
salacoste / mcp-n8n-workflow-builder Public
MCP server for Claude / Cursor building n8n workflow
7 stars
3 forks
Branches
Tags
Activity
Notifications
You must be signed in to change notification settings
main
Go to file
Code
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- |
| Latest commit
-------------
salacoste
update version
Mar 16, 2025
45f2735
· Mar 16, 2025
History
-------
15 Commits
| | |
| docs | | docs | independant rep | Mar 15, 2025 |
| examples | | examples | integrated TAGs mcp tools, added openapi markdown. Improve workflow e… | Mar 16, 2025 |
| src | | src | fixes / pre-0.7.2 | Mar 16, 2025 |
| .env.example | | .env.example | fixes / pre-0.7.2 | Mar 16, 2025 |
| .gitignore | | .gitignore | independant rep | Mar 15, 2025 |
| .npmignore | | .npmignore | npm commit | Mar 16, 2025 |
| LICENSE | | LICENSE | npm | Mar 16, 2025 |
| PUBLISHING.md | | PUBLISHING.md | npm | Mar 16, 2025 |
| README.md | | README.md | fixes / pre-0.7.2 | Mar 16, 2025 |
| claude_desktop_config.md | | claude_desktop_config.md | fixes / pre-0.7.2 | Mar 16, 2025 |
| cline_mcp_settings.example.json | | cline_mcp_settings.example.json | fixes / pre-0.7.2 | Mar 16, 2025 |
| package.json | | package.json | update version | Mar 16, 2025 |
| smithery.yaml | | smithery.yaml | npm | Mar 16, 2025 |
| test-mcp-tools.js | | test-mcp-tools.js | integrated TAGs mcp tools, added openapi markdown. Improve workflow e… | Mar 16, 2025 |
| tsconfig.json | | tsconfig.json | independant rep | Mar 15, 2025 |
| View all files | | |
This project provides an MCP (Model Context Protocol) server for managing n8n workflows. It allows you to create, update, delete, activate, and deactivate workflows through a set of tools available in Claude AI and Cursor IDE.
Key Features:
You can install the package directly from npm:
# Install globally
npm install -g @kernel.salacoste/n8n-workflow-builder
# Or as a local dependency
npm install @kernel.salacoste/n8n-workflow-builder
After installation, you need to configure the environment variables (see step 3).
Alternatively, you can clone the repository from GitHub:
git clone https://github.com/salacoste/mcp-n8n-workflow-builder.git
Then navigate to the project directory:
cd mcp-n8n-workflow-builder
Install the necessary dependencies using npm:
npm install
Create an .env
file in the project root with the following variables:
N8N_HOST=https://your-n8n-instance.com/api/v1/
N8N_API_KEY=your_api_key_here
If you installed via npm globally, you can run the server using the command:
n8n-workflow-builder
Or with JSON-RPC mode:
n8n-workflow-builder --json-rpc
If you cloned the repository or installed as a local dependency, use the following commands:
Build the project:
shell
npm run build
Start the MCP Server in standalone mode:
shell
npm start
Start with JSON-RPC mode for testing:
shell
npm run start -- --json-rpc
The server will start and accept requests via stdio or JSON-RPC depending on the mode.
For integration with Claude App, you need to create a configuration file cline_mcp_settings.json
. You can copy the example from cline_mcp_settings.example.json
and edit it:
cp cline_mcp_settings.example.json cline_mcp_settings.json
Then edit the file, providing the correct environment variable values:
{
"n8n-workflow-builder": {
"command": "node",
"args": ["path/to/your/project/build/index.js"],
"env": {
"N8N_HOST": "https://your-n8n-instance.com/api/v1/",
"N8N_API_KEY": "your_api_key_here",
"MCP_PORT": "58921"
},
"disabled": false,
"alwaysAllow": [\
"list_workflows",\
"get_workflow",\
"list_executions",\
"get_execution"\
],
"autoApprove": [\
"create_workflow",\
"update_workflow",\
"activate_workflow",\
"deactivate_workflow",\
"delete_workflow",\
"delete_execution"\
]
}
}
Important Notes:
MCP_PORT
parameter is optional but recommended to avoid port conflictscline_mcp_settings.json
to the repository as it contains your personal access credentialsThe following tools are available through the MCP protocol:
All tools have been tested and optimized for n8n version 1.82.3. The node types and API structures used are compatible with this version.
When working with n8n version 1.82.3, please note the following important requirements:
scheduleTrigger
(recommended for automation)webhook
(for HTTP-triggered workflows)activate_workflow
tool automatically adds a scheduleTrigger
node when no trigger is detectedmanualTrigger
node type is NOT recognized as a valid trigger by n8n API v1.82The activate_workflow
tool implements intelligent detection of trigger nodes and adds necessary attributes to ensure compatibility with the n8n API.
During testing with n8n version 1.82.3, we've identified several API limitations that users should be aware of:
The n8n API enforces strict requirements for workflow activation that aren't clearly documented:
Status: 400
Error: Workflow has no node to start the workflow - at least one trigger, poller or webhook node is required
Impact:
manualTrigger
node is NOT recognized as a valid trigger despite being usable in the UIgroup: ['trigger']
to manualTrigger
does not solve the issueOur solution:
activate_workflow
function automatically detects missing trigger nodesscheduleTrigger
when neededWhen updating tags that already exist, the API returns a 409 Conflict Error:
Status: 409
Error: Tag with this name already exists
Impact:
Our solution:
The execution API has limitations with certain trigger types:
Recommendation: For workflows that need to be executed via API, use the scheduleTrigger
with your desired interval settings.
The server provides the following resources for more efficient context access:
The server offers predefined workflow templates through the prompts system:
Each prompt has variables that can be customized when generating a workflow, such as workflow name, schedule expression, webhook path, and more.
In the examples
directory, you'll find examples and instructions for setting up and using n8n Workflow Builder with Claude App:
You can use the provided test scripts to verify the functionality:
The test-mcp-tools.js
script provides comprehensive testing of all MCP tools against your n8n instance. This is the recommended way to validate your setup and ensure all functionality works correctly.
# Run all tests
node test-mcp-tools.js
The script performs the following tests:
The test script creates temporary test workflows and tags which are automatically cleaned up after testing. You can customize the test behavior by modifying the test configuration variables at the top of the script.
// Configuration options in test-mcp-tools.js
const config = {
mcpServerUrl: 'http://localhost:3456/mcp',
healthCheckUrl: 'http://localhost:3456/health',
testWorkflowName: 'Test Workflow MCP',
// ... other options
};
// Test flags to enable/disable specific test suites
const testFlags = {
runWorkflowTests: true,
runTagTests: true,
runExecutionTests: true,
runCleanup: true
};
# Test basic functionality with Claude
node test-claude.js
# Test prompts functionality
node test-prompts.js
# Test workflow creation and management
node test-workflow.js
If you encounter problems, try cleaning the build directory and rebuilding the project:
shell
npm run clean && npm run build
Check that your environment variables in .env
and cline_mcp_settings.json
are set correctly.
cline_mcp_settings.json
file.--json-rpc
flag and use curl to send test requests to port 3000.If you see the following error in logs:
Error: listen EADDRINUSE: address already in use :::3456
This means that port 3456 (default for the MCP server) is already in use by another process. To fix:
Option 1: Use a Different Port with Environment Variable
Starting from version 0.7.2, you can specify a custom port using the MCP_PORT
environment variable:
# In your code
MCP_PORT=58921 npm start
# Or when running directly
MCP_PORT=58921 node build/index.js
If using Claude Desktop, update your cline_mcp_settings.json
to include the new port:
{
"n8n-workflow-builder": {
"command": "node",
"args": ["path/to/your/project/build/index.js"],
"env": {
"N8N_HOST": "https://your-n8n-instance.com/api/v1/",
"N8N_API_KEY": "your_api_key_here",
"MCP_PORT": "58921"
},
// ...
}
}
Option 2: Find and kill the process using the port
# On macOS/Linux
lsof -i :3456
kill -9 <PID>
# On Windows
netstat -ano | findstr :3456
taskkill /PID <PID> /F
Note on Version 0.7.2+: Starting with version 0.7.2, the server includes improved handling for port conflicts, automatically detecting when a port is already in use and gracefully continuing operation without throwing errors. This is especially helpful when Claude Desktop attempts to start multiple instances of the same server.
If you need to run multiple instances of the n8n workflow builder server (for example, for different n8n installations), you can do this by configuring separate ports:
Configure different ports for each instance:
```shell
MCP_PORT=58921 node build/index.js
MCP_PORT=58922 node build/index.js
```
Create separate Claude Desktop configurations: For each instance, create a separate entry in your claude_desktop_config.json
file:
json
{
"mcpServers": {
"n8n-workflow-builder-prod": {
"command": "node",
"args": ["path/to/build/index.js"],
"env": {
"N8N_HOST": "https://production-n8n.example.com/api/v1/",
"N8N_API_KEY": "your_prod_api_key",
"MCP_PORT": "58921"
}
},
"n8n-workflow-builder-dev": {
"command": "node",
"args": ["path/to/build/index.js"],
"env": {
"N8N_HOST": "https://dev-n8n.example.com/api/v1/",
"N8N_API_KEY": "your_dev_api_key",
"MCP_PORT": "58922"
}
}
}
}
Access each instance in Claude: After restarting Claude Desktop, you'll see both servers available in your tools list.
If you see errors related to API authentication:
Error: Request failed with status code 401
Check that:
.env
file matches your n8n instanceIf you encounter the error node.parameters.values.map is not a function
when creating workflows:
This usually happens when creating workflows with Set nodes that use the newer n8n parameter structure. Version 0.7.2+ includes a fix that supports both the legacy array format and the newer object-based format for Set node parameters.
This MCP server has been specifically tested and validated with:
If you're using a different version of n8n, some API endpoints or node types may differ. Please report any compatibility issues in the GitHub repository.
node.parameters.values.map is not a function
error for modern n8n node structureThis project is distributed under the MIT License.
MCP server for Claude / Cursor building n8n workflow
No releases published
No packages published
You can’t perform that action at this time.