The n8n MCP Server provides a powerful interface that allows AI agents to interact with n8n workflows through natural language. This server implements the Model Context Protocol (MCP) to create a bridge between AI systems and your automated workflows in n8n.
The fastest way to deploy the n8n MCP server is using Railway's one-click deployment:
After clicking the button, you'll be prompted to configure the necessary environment variables (details in the Configuration section below).
For local testing or manual deployment, you can use Docker:
Build the Docker image:
docker build -t n8n-mcp-server-supergateway .
Run the Docker container:
docker run --rm -it -p 8080:8080 \
-e PORT=8080 \
-e N8N_API_URL="YOUR_N8N_API_URL" \
-e N8N_API_KEY="YOUR_N8N_API_KEY" \
-e N8N_WEBHOOK_USERNAME="your_webhook_user" \
-e N8N_WEBHOOK_PASSWORD="your_webhook_password" \
-e DEBUG=true \
n8n-mcp-server-supergateway
The server will be accessible via SSE on http://localhost:8080
with /sse
for the event stream and /message
for posting messages.
The following environment variables are required:
N8N_API_URL
: Your n8n instance API URL (e.g., https://n8n.example.com/api/v1
)N8N_API_KEY
: Your n8n API Key (treated as a secret)N8N_WEBHOOK_USERNAME
: Username for basic authentication on n8n webhook nodes (default: anyname
)N8N_WEBHOOK_PASSWORD
: Password for basic authentication on n8n webhook nodes (default: somepassword
)DEBUG
: Set to true
for verbose logging, false
for production (default: false
)PORT
: The port the application will listen on (default: 8080
)Once running, the server exposes an MCP interface over Server-Sent Events (SSE) at:
http://<server_address>:<port>/sse
http://<server_address>:<port>/message
If deployed on Railway, your server address will be your public Railway URL (e.g., https://my-n8n-mcp.up.railway.app
).
If your MCP client supports connecting to an MCP server via an SSE URL and message endpoint, use this configuration:
{
"n8n_local_docker_sse": {
"url": "https://my-n8n-mcp.up.railway.app/sse",
"disabled": false,
"alwaysAllow": [
"mcp_n8n_docker_direct_list_workflows",
"mcp_n8n_docker_direct_get_workflow",
"mcp_n8n_docker_direct_create_workflow",
"mcp_n8n_docker_direct_update_workflow",
"mcp_n8n_docker_direct_delete_workflow",
"mcp_n8n_docker_direct_activate_workflow",
"mcp_n8n_docker_direct_deactivate_workflow",
"mcp_n8n_docker_direct_list_executions"
],
"timeout": 300
}
}
If your MCP client expects to launch a local command that communicates via stdio, you can use Supergateway as an SSE-to-stdio bridge:
{
"mcpServers": {
"n8n-remote-sse": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse", "http://<server_address>:<port>",
"--outputTransport", "stdio",
"--logLevel", "info"
],
"env": {},
"disabled": false
}
}
}
To use webhook functionality with the MCP server:
run_webhook
tool to trigger the workflowExample:
const result = await mcp.tools.run_webhook({
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 APIexecution_get
: Get details of a specific executionexecution_list
: List executions for a workflowFor direct Node.js execution without Docker:
Clone the repository:
git clone https://github.com/YOUR_USERNAME/YOUR_REPONAME.git
cd YOUR_REPONAME
Install dependencies:
npm install
Build the server:
npm run build
Configure environment variables:
Create a .env
file with your n8n API details and other required variables
Run the stdio MCP server:
node build/index.js
Optional: Exposing via SSE with manual Supergateway setup:
npx -y supergateway --stdio "node build/index.js" --port 8080
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "n8n_local_docker_sse" '{"url":"https://my-n8n-mcp.up.railway.app/sse","disabled":false,"alwaysAllow":["mcp_n8n_docker_direct_list_workflows","mcp_n8n_docker_direct_get_workflow","mcp_n8n_docker_direct_create_workflow","mcp_n8n_docker_direct_update_workflow","mcp_n8n_docker_direct_delete_workflow","mcp_n8n_docker_direct_activate_workflow","mcp_n8n_docker_direct_deactivate_workflow","mcp_n8n_docker_direct_list_executions"],"timeout":300}'
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_docker_sse": {
"url": "https://my-n8n-mcp.up.railway.app/sse",
"disabled": false,
"alwaysAllow": [
"mcp_n8n_docker_direct_list_workflows",
"mcp_n8n_docker_direct_get_workflow",
"mcp_n8n_docker_direct_create_workflow",
"mcp_n8n_docker_direct_update_workflow",
"mcp_n8n_docker_direct_delete_workflow",
"mcp_n8n_docker_direct_activate_workflow",
"mcp_n8n_docker_direct_deactivate_workflow",
"mcp_n8n_docker_direct_list_executions"
],
"timeout": 300
}
}
}
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_docker_sse": {
"url": "https://my-n8n-mcp.up.railway.app/sse",
"disabled": false,
"alwaysAllow": [
"mcp_n8n_docker_direct_list_workflows",
"mcp_n8n_docker_direct_get_workflow",
"mcp_n8n_docker_direct_create_workflow",
"mcp_n8n_docker_direct_update_workflow",
"mcp_n8n_docker_direct_delete_workflow",
"mcp_n8n_docker_direct_activate_workflow",
"mcp_n8n_docker_direct_deactivate_workflow",
"mcp_n8n_docker_direct_list_executions"
],
"timeout": 300
}
}
}
3. Restart Claude Desktop for the changes to take effect