n8n MCP
n8n
n8n-mcp lets LLMs drive your own n8n instance (self-hosted or SaaS) — list workflows, trigger webhooks, query execution logs, create/edit nodes. The go-to for 'LLM writes strategy → n8n executes the automation'.
Why client-side
An n8n API key is a high-privilege credential — create/edit/delete any workflow, read any execution. twinkle-hub does not store it. It lives in your local MCP client's config; Claude Desktop spawns a child process carrying that env var, connecting directly to your n8n.
Prerequisites
- Node.js ≥ 18
- Your own n8n instance (not someone else's) — e.g. https://your-name.app.n8n.cloud or self-hosted https://10.0.x.x:5678
- MCP-capable client
Get a token
- 1Log into your n8n instance
- 2Click your avatar top-right → Settings (n8n < 1.0 has no API — upgrade)
- 3Pick n8n API in the left nav
- 4Click Create API Key, label it (e.g. "claude-mcp")
- 5Copy the key — shown once, gone forever after closing
- 6Scope — recommended: workflow:read / workflow:execute / execution:read. Add workflow:create / workflow:update if you need writes
Install
Claude Desktop (macOS)
~/Library/Application Support/Claude/claude_desktop_config.json
N8N_API_URL must end with /api/v1. SaaS example: https://abc.app.n8n.cloud/api/v1. Self-hosted: http://192.168.x.x:5678/api/v1
{
"mcpServers": {
"n8n": {
"command": "npx",
"args": ["-y", "n8n-mcp"],
"env": {
"N8N_API_URL": "<your_n8n_api_url>",
"N8N_API_KEY": "<your_n8n_api_key>"
}
}
}
}First run
Try this prompt
List every workflow on my n8n
Common tools
list_workflows()— list all workflowsget_workflow(id)— full definitionexecute_workflow(id, data)— trigger runlist_executions(workflowId)— execution historycreate_workflow(definition)— LLM writes a new workflowupdate_workflow(id, definition)— LLM edits existing workflow
Troubleshooting
| Symptom | Fix |
|---|---|
| 401 Unauthorized | API key expired or scope insufficient |
| ECONNREFUSED | n8n URL correct? On self-hosted, is /api/v1 enabled (N8N_PUBLIC_API_DISABLED=false)? |
| Partial workflow list | API key scope too narrow — add scopes in n8n settings |
| Self-signed cert | Self-hosted HTTPS with self-signed cert fails — use HTTP or fix the cert chain |
Security notes
- Keep the API key in local config only — never commit to git
- Don't install on shared machines (other users can read the config)
- Narrow the scope for the LLM token — start read-only, expand only after watching behaviour