- N8n Workflow Builder
N8n Workflow Builder
n8n Workflow Builder MCP
This project provides a Model Context Protocol (MCP) server for building and manipulating n8n workflows JSON in Cursor IDE. It's a way to build n8n workflows just by prompting with AI in chat.
DEMO VIDEO:
Current status of implementation
It's in early development stage. Basically, it's working - MCP server creates JSON file with n8n workflow that you can copy and paste to workflow editor in n8n UI. Current problems:
- sometimes llm agents put wrong parameters in the request. I plan to find a way to fix this.
- sometimes connection between nodes is not setting. I'm working to resolve it.
- not all types of node are checked working. I'm working to resolve it.
- initial prompt does matter. If it's not clear, the agent will go wrong way. I plan to find a way to fix this.
Key Features
- Workflow Management: Create, update, and execute n8n workflows programmatically (execute is not implemented yet)
- Node Discovery: Explore available n8n nodes and their capabilities
- Connection Management: Create connections between workflow nodes
- AI Integration: Special tools for connecting AI components in workflows
- AI-Friendly Interface: Designed specifically for interaction with AI agents
Prerequisites
- Node.js (v14 or higher)
- Cursor IDE (v0.48 or newer)
- npm or yarn
- TypeScript compiler (installed as a dev dependency via
npm install)
Installation
-
Clone the repository:
git clone https://github.com/ifmelate/n8n-workflow-builder-mcp.git cd n8n-workflow-builder-mcp -
Install dependencies:
npm install -
Build the TypeScript project:
npm run build -
Make the MCP server script executable (if needed):
chmod +x dist/index.js
Running the Server
Start the MCP server:
npm start
This will run the compiled code from dist/index.js.
For development with auto-rebuild and restart on changes:
npm run dev
Cursor IDE Integration
There are two ways to set up the MCP server with Cursor:
Method 1: Using Cursor Settings UI (Recommended)
- Start Cursor IDE
- Go to Settings > Features > MCP Servers
- Click "Add Server" and provide the absolute path to the
dist/index.jsfile (e.g.,/Users/yourname/n8n-workflow-builder-mcp/dist/index.js) - Make sure the server is enabled
- Restart Cursor IDE for changes to take effect
Method 2: Manual Configuration
-
Ensure the
.cursordirectory exists:mkdir -p .cursor -
Create the MCP configuration file:
cat > .cursor/mcp.json << 'EOF' { "mcpServers": { "n8n-workflow-builder": { "command": "node", "args": ["/absolute/path/to/n8n-workflow-builder-mcp/dist/index.js"] } } } EOFMake sure to replace
/absolute/path/towith the actual path on your system. -
Restart Cursor IDE for changes to take effect
Available MCP Tools
The server provides the following tools for working with n8n workflows:
| Tool Name | Description | Key Parameters |
|---|---|---|
| create_workflow | Create a new n8n workflow | workflow_name, workspace_dir |
| list_workflows | List all existing workflows | (no parameters) |
| get_workflow_details | Get detailed information about a specific workflow | workflow_name |
| add_node | Add a new node to a workflow | workflow_name, node_type, position, parameters, node_name, typeVersion |
| edit_node | Edit an existing node in a workflow | workflow_name, node_id, node_type, node_name, position, parameters |
| delete_node | Delete a node from a workflow | workflow_name, node_id |
| add_connection | Add a connection between nodes | workflow_name, source_node_id, source_node_output_name, target_node_id, target_node_input_name |
| add_ai_connections | Add AI connections for LangChain nodes | workflow_name, agent_node_id, model_node_id, tool_node_ids |
| list_available_nodes | List available node types with optional filtering | search_term (optional) |
Troubleshooting Cursor Integration
If you're having trouble getting the MCP server to work with Cursor, try these steps:
-
Restart Cursor: After setting up the MCP configuration, completely close and restart Cursor.
-
Check Cursor MCP settings:
- Open Cursor Settings
- Go to Features > MCP Servers
- Make sure your server is listed and enabled
- If it's listed but not working, try clicking the refresh button
-
Check server logs: Look for errors in the terminal where you're running the server or in the Cursor Output panel. Select "Cursor MCP" from the dropdown in the Output panel to see MCP-specific logs.
-
Verify file permissions: Make sure the
dist/index.jsfile has execution permissions. -
Check for port conflicts: If there are other MCP servers running, they might conflict. Check for other processes using the same ports.
-
Try global installation: Instead of using a local path, you can try installing the server globally:
npm install -g n8n-workflow-builder-mcpThen update the
.cursor/mcp.jsonfile to use the global command.
Common Issues and Solutions
"Failed to create client"
This usually happens when:
- The MCP server isn't running
- There's a connectivity issue between Cursor and the server
- The server crashed during initialization
Try:
- Running the test script to make sure the server works correctly
- Checking for errors in the server logs
- Restarting Cursor
MCP Server is not showing up in Cursor
This can happen if:
- The
.cursor/mcp.jsonfile is not properly formatted - Cursor hasn't detected the configuration change
Try:
- Validating the JSON format of your
.cursor/mcp.jsonfile - Restarting Cursor
- Manually selecting the server in Cursor settings (if it appears there)
MCP Server shows up but tools aren't available
This can happen if:
- The server isn't properly registering its tools
- There's an issue with the ListOfferings request/response
Try:
- Running the test script to check if tools are properly registered
- Clicking the refresh button in the MCP server settings in Cursor
- Checking the server logs for any errors
Project Structure
/src: Main source code/src/tools: MCP tools implementation/src/models: Data models/src/utils: Utility functions/src/middleware: Authentication and middleware/config: Configuration files/tests: Test files/workflow_nodes: n8n node definitions/docs: Additional documentation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Working on licence - need to have confirmation from n8n team
Server Config
{
"mcpServers": {
"n8n-workflow-builder": {
"command": "node",
"args": [
"/absolute/path/to/n8n-workflow-builder-mcp/dist/index.js"
]
}
}
}