n8n-mcp behind Cloudflare Access: how to pass CF-Access-Client-Id/Secret headers?
I'm running n8n behind Cloudflare Access and using n8n-mcp (czlonkowski/n8n-mcp) from Claude Desktop. The n8n API requires Cloudflare Access Service Token headers (CF-Access-Client-Id / CF-Access-Client-Secret) in addition to X-N8N-API-KEY, but n8n-mcp only sent X-N8N-API-KEY, so requests through the proxy were rejected with 403 Forbidden. Is there a supported way to pass these headers?
Originally asked on GitHub: https://github.com/czlonkowski/n8n-mcp/issues/148
5 answers
Fixed in v2.64.0. The maintainer confirmed this was a real gap:
src/services/n8n-api-client.tsonly sentX-N8N-API-KEY(line 92), so instances behind Cloudflare Access returned403 Forbiddenbecause theCF-Access-Client-Id/CF-Access-Client-Secretservice-token headers were never injected. The feature was merged as of v2.64.0 via PR #919, building on contributor PR #718.To use it, set both environment variables on the n8n-mcp server process:
bashN8N_CF_CLIENT_ID=your-cf-client-id N8N_CF_CLIENT_SECRET=your-cf-client-secretWhen set, n8n-MCP sends the two CF-Access headers alongside
X-N8N-API-KEYon n8n API requests, version/health probes, and same-origin webhook executions. Per the maintainer, the service token is confined to theN8N_API_URLorigin, so it isn't sent to unrelated hosts.Before the feature landed, the maintainer suggested these workarounds (not tested in the thread): put a reverse proxy in front that adds the CF headers, configure Cloudflare to bypass Access for specific IPs, or wrap the service-token calls in a custom wrapper. Note that PR #718 initially needed a rebase and review; the final merged implementation was #919.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
The reporter looked for a built-in way to set custom HTTP headers for Cloudflare Access authentication in n8n-mcp and found none, so the API inside the Cloudflare proxy was unreachable. The maintainer later confirmed the gap.
Source: https://github.com/czlonkowski/n8n-mcp/issues/148 (opens external site)
Did this work for you?What @czlonkowski tried on GitHub (Outcome unclear)
The maintainer proposed workarounds before the feature existed: use a reverse proxy to add CF headers, configure Cloudflare to bypass Access for specific IPs, or use service tokens in a custom wrapper. These were suggestions and were not tested in the thread.
Source: https://github.com/czlonkowski/n8n-mcp/issues/148#issuecomment-3447732100 (opens external site)
Did this work for you?What @diemol55 tried on GitHub (Outcome unclear)
A contributor opened PR #718 to inject Cloudflare Access headers into version validation and webhook execution calls. The PR needed a rebase onto main and a review pass, and was not the version that ultimately merged.
Source: https://github.com/czlonkowski/n8n-mcp/issues/148#issuecomment-4211458241 (opens external site)
Did this work for you?What @czlonkowski tried on GitHub (Outcome unclear)
The maintainer announced the feature was implemented and merged as of v2.64.0 via #919 and closed the issue, asking the reporter to reopen if anything failed. No one in the thread reported actually testing the new env vars.
Source: https://github.com/czlonkowski/n8n-mcp/issues/148#issuecomment-4927234999 (opens external site)
Did this work for you?
Related questions
- n8n-MCP: complex Claude Desktop workflows won't open in n8n UI — 'propertyValues is not iterable'?
- n8n-mcp partial update fails: 'Cannot convert undefined or null to object' (Claude Desktop/Cursor)
- n8n-mcp n8n_update_partial_workflow updateNode fails with "Cannot convert undefined or null to object"
- n8n-mcp Docker: missing BACKEND_SUPABASE_URL after pulling latest image
- n8n_update_partial_workflow fails: "settings must NOT have additional properties"