MCP Bearer Authorization

Trying to authenticate to MCP server in n8n workflow using npx.

Testing this using MCP Inspector v0.11.0 and all works with no issues but cannot get this to work using Claude desktop.

This is my config in claude_desktop_config.json

{
“mcpServers”: {
“n8n”: {
“command”: “npx”,
“args”: [
“-y”,
“supergateway”,
“–sse”,
https://thirdwave.app.n8n.cloud/mcp/d58a4a1b-b8be-424c-90c7-2f1xd71d5a1/sse”,
“–Header”,
“Authorization: Bearer Dsfgsfgssfg”
]
}
}
}

When I try using npx in command prompt

npx --sse “https://thirdwave.app.n8n.cloud/mcp/d5adfadfdfb-b8be-424c-90c7-2f165e71d5a1/sse” --Header"Authorization: Bearer adfasdfadfasdfsad"

Get this every time

npm error code E403
npm error 403 403 Forbidden - GET https://thirdwave.app.n8n.cloud/mcp/***/sse
npm error 403 In most cases, you or one of your dependencies are requesting
npm error 403 a package version that is forbidden by your security policy, or
npm error 403 on a server you do not have access to.

You have to use --header instead of --Header. Case sensitivity is very important in these.

So your final config would be:

{
  "mcpServers": {
    "n8n": {
      "command": "npx",
      "args": [
        "-y",
        "supergateway",
        "--sse",
        "https://thirdwave.app.n8n.cloud/mcp/d58a4a1b-b8be-424c-90c7-2f1xd71d5a1/sse",
        "--header",
        "Authorization: Bearer Dsfgsfgssfg"
      ]
    }
  }
}

I tried all these settings 100 times. I finally found the supergateway github page. This is what works

{
 "mcpServers": {
   "n8n": {
    "command": "npx",
    "args": [
    "-y",
    "supergateway",
    "--sse",
    "https://site1.app.n8n.cloud/mcp/d58a4a1d-b8be-424c-90c72f165e71d5a1/sse",
    "--oauth2Bearer",
    "D7sdfsdfsdffQtMQh"
   ]
  }
 }
}
2 Likes

Nice, good to know :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.