Skip to content

Investigate: 400 error on MCP endpoint - empty grantedSkills after SDK upgrade #756

@dcramer

Description

@dcramer

Problem

After upgrading @modelcontextprotocol/sdk from 1.22.0 to 1.25.3 (PR #752), Claude Code authentication appeared to fail with a 400 error.

Observed:

  • 400 on POST https://mcp.sentry.dev/mcp/sentry/mcp-server?experimental=1 (2026-01-30 15:59:21 PST)

Likely Cause

The 400 response comes from mcp-handler.ts:149-152:

if (validSkills.size === 0) {
  return new Response(
    "Authorization failed: No valid skills were granted. Please re-authorize and select at least one permission.",
    { status: 400 },
  );
}

This suggests the grantedSkills field was either:

  1. Empty or not passed correctly after the SDK upgrade
  2. Skill parsing failed due to format changes
  3. OAuth token didn't include skills due to SDK changes

MCP SDK Changes (1.22.0 → 1.25.3)

Potentially relevant changes:

  • v1.25.0: "SPEC COMPLIANCE: Remove loose/passthrough types not allowed/defined by MCP spec"
  • v1.24.0: Added invalid_target OAuth error (RFC 8707), client credentials OAuth flow
  • v1.23.0: "Support upscoping on insufficient_scope 403", "Adjust scope management to line up with SEP-835"

Investigation Steps

  1. Check if scope/skill format changed in MCP SDK 1.25.x
  2. Review OAuth token contents before/after upgrade
  3. Test authentication flow with SDK 1.25.3 and capture actual error
  4. Check if grantedSkills parsing needs to be updated

Context

Files

  • packages/mcp-cloudflare/src/server/lib/mcp-handler.ts
  • packages/mcp-cloudflare/src/server/oauth/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions