Howto configure n8n selfhosted for Claude.ai connector with cloudflare

Hello everyone,

I have a self-hosted n8n 2.13.2 instance with Docker Compose, here is the docker-compose.yml:

services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: unless-stopped
environment:

  • N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
  • N8N_RESTRICT_FILE_ACCESS_TO=‘/files’
  • N8N_HOST=n8n.myurl.com
  • N8N_PORT=5678
  • N8N_PROTOCOL=https
  • NODE_ENV=production
  • N8N_PROXY_HOPS=1
  • WEBHOOK_URL=https://n8n.myurl.com/
  • GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
  • TZ=${GENERIC_TIMEZONE}
    volumes:
  • ./n8n_data:/home/node/.n8n
  • ./local_files:/files
    networks:
  • traefik
  • backend

networks:
traefik:
external: true
backend:
name: mynw_backend

I would like to use the n8n connector offered on Claude.ai, but I’m running into a problem after granting the Claude.ai connector permission to use my instance, with the following message:

Authorization with the MCP server failed. You can check your credentials and permissions. If this persists, share this reference with support: “ofid_1728793076d22151”

To allow Claude.ai to access my instance, I set up a Cloudflare tunnel with, for now, a very open configuration in terms of access rules:

Policies

In the logs of my n8n container, I can clearly see the connection request and its acceptance:

n8n-1 | Consent approved
n8n-1 | Authorization code exchanged for tokens

And the request shows up in the connected clients on the n8n interface:

But on the Claude.ai side, the connector is still not… connected.

I have read the n8n MCP documentation on instance-level mode several times, but I haven’t found any specific information that could help me identify the cause of the problem.

Do you have any leads?

Thanks in advance.

Information on your n8n setup

  • n8n version: 2.13.2
  • Database : SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via : Docker
  • Operating system: Linux

Hey, I just tested with my Mistral account using the OAuth 2.1 method and had no problem authorizing the connection to my n8n instance without changing any settings. So the problem is with the connection using Claude.ai.

The problem originates from Claude.ai and is referenced :

Good detective work finding those GitHub issues — that confirms the problem is on the Claude.ai side, not your n8n setup.

Your n8n logs are actually ideal: “Consent approved” + “Authorization code exchanged for tokens” means the OAuth flow completed correctly. The connector just isn’t picking up the established session on Claude.ai’s end.

A couple of things worth checking while you wait for Anthropic to patch this:

  • Make sure your Cloudflare tunnel isn’t stripping or modifying Authorization or MCP-Session-Id headers on responses back to Claude.ai — some tunnel configs silently drop custom headers
  • Double-check that N8N_PROXY_HOPS=1 matches your actual proxy stack (Cloudflare tunnel = 1 hop). If the hop count is off, token validation can fail silently

The Mistral OAuth test you ran is a great data point — it rules out your n8n config entirely and points squarely at the Claude.ai connector. Worth adding a comment to issue #62 with your setup details to help Anthropic reproduce it.