Skip to content

Notion MCP OAuth fails with "Invalid redirect_uri for OAuth client" #52961

Description

@jhaverty1994

Description

Authenticating the hosted Notion MCP server (https://mcp.notion.com/mcp) via /mcp in Claude Code fails with an "Invalid redirect_uri for OAuth client" error returned from Notion's OAuth server. Authentication never completes.

Environment

  • Claude Code version: 2.1.119 (latest as of filing)
  • OS: macOS 15 (Darwin 24.6.0)
  • Install: ~/.local/bin/claude
  • Browsers tried: Brave, Chrome — both fail identically (rules out browser shields / extensions)

Steps to reproduce

  1. claude mcp add --transport http notion https://mcp.notion.com/mcp
  2. /mcp → select Notion → Authenticate
  3. Browser opens the Notion authorize URL
  4. Complete Notion login → Notion rejects with Invalid redirect_uri for OAuth client before redirecting back to localhost

Root cause (from Claude Code debug logs)

Claude Code uses a fixed client_id (a claude.ai-hosted client metadata URL) combined with a randomly-picked localhost callback port. Notion's OAuth server validates the submitted redirect_uri against the metadata document's allowlist and rejects because the random localhost port isn't listed.

From ~/Library/Caches/claude-cli-nodejs/<cwd>/mcp-logs-notion/<timestamp>.jsonl:

Authorization URL: https://mcp.notion.com/authorize
  ?response_type=code
  &client_id=https%3A%2F%2Fclaude.ai%2Foauth%2Fclaude-code-client-metadata
  &code_challenge=[REDACTED]
  &code_challenge_method=S256
  &redirect_uri=http%3A%2F%2Flocalhost%3A55564%2Fcallback
  &state=[REDACTED]
  &resource=https%3A%2F%2Fmcp.notion.com%2Fmcp

The port is randomized per attempt (observed 55564, 60330, etc.). The log also shows "No client info found" immediately prior, suggesting Dynamic Client Registration (RFC 7591) was expected but skipped — the static claude.ai client is being reused instead of registering a fresh one.

Expected behavior

Either:

  • (a) Perform DCR against Notion's authorization server to register a fresh client with the current localhost callback, or
  • (b) Update the claude-code-client-metadata document's redirect_uris to include wildcard localhost entries that Notion will accept.

Workarounds tried

  • Re-running /mcp — fails with a new random port each time
  • claude update — already on latest
  • Different browser (Brave → Chrome) — identical failure, confirms server-side rejection
  • Falling back to @notionhq/notion-mcp-server with an internal integration token — blocked for users whose Notion workspace restricts integration creation to owners

Notes

Notion's connector works fine in the Claude Desktop app (different OAuth client / fixed redirect URI), so the issue is specific to the Claude Code CLI's OAuth flow against mcp.notion.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:autharea:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions