The n8n MCP Server allows AI assistants to interact with n8n workflows through natural language. This server bridges the gap between AI systems and n8n, enabling assistants to manage workflows, trigger executions, and monitor results without requiring direct n8n API knowledge.
npm install -g 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 .
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 (if using webhooks) | username |
N8N_WEBHOOK_PASSWORD |
Password for webhook authentication | password |
DEBUG |
Enable debug logging (optional) | true or false |
.env
fileFrom the installation directory:
n8n-mcp-server
Or if installed globally:
n8n-mcp-server
After building the server, configure your AI assistant (like VS Code with Claude extension or Claude Desktop app) to run it.
Example Configuration:
{
"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": []
}
}
}
Key Points:
/
for macOS/Linux, double backslashes \\
for Windows)npm run build
)This MCP server supports executing workflows through n8n webhooks:
run_webhook
tool to trigger the workflowExample:
const result = await useRunWebhook({
workflowName: "hello-world", // Will call <n8n-url>/webhook/hello-world
data: {
prompt: "Hello from AI assistant!"
}
});
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 executionThe 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 executionThere 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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.