Skip to content

n8n MCP + Cursor

Connect Cursor to the self-hosted n8n instance so agents can search, run, and build workflows marked Available in MCP.

1. Enable MCP in n8n

  1. Log in to n8n as instance owner/admin.
  2. Settings → Instance-level MCP → enable MCP access.
  3. Connection details → Access Token → generate/copy token (store in Bitwarden).
  4. Per workflow you want Cursor to use: Workflow menu (…) → Settings → Available in MCP.

2. Cursor configuration (this repo)

Copy the template and paste your token locally (file is gitignored):

copy .cursor\mcp.json.example .cursor\mcp.json

Edit .cursor/mcp.json and replace PASTE_YOUR_N8N_MCP_TOKEN_HERE with the token from n8n.

{
  "mcpServers": {
    "n8n-mcp": {
      "url": "https://n8n.lage-beauty.de/mcp-server/http",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}

Restart Cursor completely after saving.

Why not .env?

Cursor resolves ${env:VAR} from the OS environment when it starts, not from the project .env file. Pasting the token in .cursor/mcp.json is the simplest project-local option; that file is listed in .gitignore so it will not be committed.

Alternative: set a Windows user variable and use ${env:N8N_MCP_TOKEN} in mcp.json instead of a literal token (see mcp.json.example — swap the header value if you prefer that).

Verify

  1. Cursor Settings → Tools & MCPn8n-mcp should show connected.
  2. View → Output → MCP — check logs if connection fails.
  3. Open a new Agent chat so tools reload.

3. Nginx / Nginx Proxy Manager

n8n MCP uses Streamable HTTP / SSE. Default proxy buffering or gzip breaks Cursor clients.

Snippet: docker/nginx/n8n-mcp-server.conf

  1. Hosts → Proxy Hosts → edit n8n.lage-beauty.de.
  2. Forward hostname/IP: n8n (or container IP), port 5678.
  3. Advanced tab → Custom Nginx Configuration — paste the location /mcp-server/ { ... } block from docker/nginx/n8n-mcp-server.conf.
  4. Save and test.

Test from your PC

curl -sS -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $N8N_MCP_TOKEN" \
  -H "Accept: application/json, text/event-stream" \
  https://n8n.lage-beauty.de/mcp-server/http

Expect 200 or 405 (not 502 / connection reset). Exact code depends on MCP handshake; check MCP logs in Cursor if unsure.

4. Security

  • Never commit the MCP access token — .cursor/mcp.json is gitignored; only commit mcp.json.example.
  • Rotate the token in n8n if it was ever pasted in chat or logs.
  • MCP exposes workflows you enable; use n8n user permissions and workflow-level Available in MCP deliberately.

5. Invoice automation

Shared invoice storage for n8n workflows:

Service Path
n8n / runners /home/node/.n8n-files/invoices
service-invoice /app/invoices
file-manager /srv/invoices

Suggested layout: buchhaltung-YYYY/MM-supplier/invoice.pdf

See also File Manager.

Troubleshooting

Symptom Fix
MCP shows disconnected Token pasted in .cursor/mcp.json? Cursor restarted?
401 Unauthorized Regenerate token in n8n; update .cursor/mcp.json
502 / hangs / SSE errors Add n8n-mcp-server.conf location; disable gzip/buffering on /mcp-server/
Tools missing in chat New chat session; enable MCP on workflows in n8n
No transport found for sessionId Nginx proxy buffering — use snippet above