VectleSkillsNotion MCP 401 in n8n/Docker: {"code":"unauthorized","message":"API token is invalid."} with tools list working

Notion MCP 401 in n8n/Docker: {"code":"unauthorized","message":"API token is invalid."} with tools list working

Export

Fixes the Notion MCP server listing tools fine but 401ing on every call in n8n or Docker. Use when tools/list works and only tool calls fail. Not for tokens that fail everywhere.

Notion MCP 401 in n8n/Docker: {"code":"unauthorized","message":"API token is invalid."} with tools list working

TL;DR: Your OPENAPIMCPHEADERS env value is misquoted, so the Authorization header never reaches the server even though tools list works. Escape the inner quotes: OPENAPIMCPHEADERS as a JSON string with backslash-escaped quotes. Restart the n8n container so the corrected env takes effect.

The error

{"status":401,"object":"error","code":"unauthorized","message":"API token is invalid."}

Fix it

  1. Inspect the OPENAPIMCPHEADERS value in your docker-compose file or n8n env.

Expected: The quotes around the JSON are unescaped or the value is split.

  1. Set it as a single properly escaped string, e.g. OPENAPIMCPHEADERS with escaped inner quotes around Authorization and Notion-Version.

Expected: The value parses as valid JSON with both headers.

  1. Restart the container.

Expected: Tool calls authenticate and return data.

When this applies

Notion MCP tools/list succeeds but every tool call 401s with unauthorized/API token is invalid, in n8n or Docker Compose.

When this does NOT apply

If tools/list also fails, the token or URL is wrong. If the token fails in curl, regenerate it.

Tool compatibility

makenotion/notion-mcp-server via n8n or Docker Compose

Also seen as

  • notion MCP n8n API token is invalid
  • OPENAPIMCPHEADERS 401
  • notion MCP docker unauthorized tool calls

Why it happens

tools/list does not need the Notion credential, but every tool call does. A misquoted OPENAPIMCPHEADERS means the server never forwards the Authorization header, so Notion 401s each call while listing tools works fine.

Edge cases

  • YAML quoting rules differ between compose file styles; test with a JSON parse.
  • n8n community packages need N8NCOMMUNITYPACKAGESALLOWTOOL_USAGE=true for tool use at all.
  • Restarting the container matters; compose does not re-read env on its own.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=Notion+MCP+401+in+n8n%2FDocker%3A+%7B%22code%22%3A%22unauthorized%22%2C%22message%22%3A%22API+token+is+invalid.%22%7D+with+tools+list+working&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.