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 :

Unsure if you both had figured this out already as the answer was in the linked github issue (THANK YOU), but I was having exactly the same issue. It appears that by default, cloudflare tunnels block AI crawling, which is understandable. Once I had disabled that, this started to work.