Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bearer challenge points resource_metadata to a 404 when resourceUri has a path

Closed Beginner friendly
#207 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #232 by @mcollina — merged

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Read src/auth/prehandler.ts and src/routes/well-known.ts to trace how the challenge URL and metadata resource are built. Use the reproduction with resourceUri: 'https://mcp.example.com/mcp' to verify the behavior; done means the metadata URL follows RFC 9728 §3.1 and the advertised resource exactly matches resourceUri.

Written by the indexing model from the issue text.

Description

When authorization.resourceUri includes a path (for example https://mcp.example.com/mcp, which authorization.md lists as a valid canonical URI), protected-resource discovery breaks:

  • src/auth/prehandler.ts builds the 401 challenge as resource_metadata="${resourceUri}/.well-known/oauth-protected-resource". That gives https://mcp.example.com/mcp/.well-known/oauth-protected-resource, which returns 404.
  • src/routes/well-known.ts only serves /.well-known/oauth-protected-resource and /.well-known/oauth-protected-resource/mcp. The /mcp variant appends /mcp again and advertises resource: "https://mcp.example.com/mcp/mcp".

Expected (RFC 9728 §3.1): the metadata URL is the origin plus /.well-known/oauth-protected-resource plus the resource path, and the advertised resource equals resourceUri exactly.

Repro: configure resourceUri: 'https://mcp.example.com/mcp', send an unauthenticated request to /mcp, then fetch the URL in the resource_metadata parameter. The fetch returns 404.

Found while reviewing #170. Already present on main.

Dominant language
TypeScript
Stars
58
Forks
15
Avg merge
1d 6h
Merged PRs (30d)
54

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from platformatic/mcp

All issues in platformatic/mcp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.