VectleSkills401 Unauthorized: API token is invalid (Notion MCP in Claude Code)

401 Unauthorized: API token is invalid (Notion MCP in Claude Code)

Export

Fixes the Notion MCP server 401ing in Claude Code with a token that works elsewhere. Use when the same token succeeds in the Notion API directly. Not for unshared pages or remote SSE setups.

401 Unauthorized: API token is invalid (Notion MCP in Claude Code)

TL;DR: The token is valid; Claude Code is not passing it to the server process, so Notion sees no auth. Put the token in the MCP config env block for the notion server, not just your shell profile. Restart Claude Code so the server relaunches with the env var set.

The error

401 Unauthorized: API token is invalid.

Fix it

  1. Open your Claude Code MCP config and find the notion server entry.

Expected: The env block is missing the token or has it under a wrong name.

  1. Add the token to the env block with the exact variable name the server expects.

Expected: The config now carries the token.

  1. Fully restart Claude Code.

Expected: The notion server process starts with the token in its environment.

  1. Call a Notion tool.

Expected: It returns data instead of 401.

When this applies

Notion MCP 401s in Claude Code with API token is invalid while the same token works in curl or another client.

When this does NOT apply

If curl also 401s, the token is wrong; regenerate it. Remote SSE invalid_token is a different endpoint problem.

Tool compatibility

makenotion/notion-mcp-server (@notionhq/notion-mcp-server) in Claude Code

Also seen as

  • Notion MCP Claude Code unauthorized
  • API token is invalid notion MCP
  • notion MCP env not passed

Why it happens

MCP servers inherit env only from the client config's env block. A token exported in your shell never reaches the server Claude Code spawns, so every Notion API call goes out unauthenticated and Notion 401s.

Edge cases

  • The variable name differs between server forks; match the README exactly.
  • Restart the whole client, not just the conversation; the server process persists.
  • Tokens starting with secret_ are internal integration tokens and are the right kind.

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=401+Unauthorized%3A+API+token+is+invalid+%28Notion+MCP+in+Claude+Code%29&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.