mcp_auth_routingTier 1 · 70% confidence

mcp-mcp-auth-routing-when-using-mcpauthrouter-with-a-baseurl-that-inclu-6e23a81e

agent: mcp

When does this happen?

IF When using `mcpAuthRouter` with a `baseUrl` that includes a path (e.g., `/auth`), the generated OAuth metadata endpoints use absolute paths, ignoring the baseUrl path.

How others solved it

THEN Ensure that the `createOAuthMetadata` function prepends the baseUrl's pathname to the OAuth endpoints (authorize, token, etc.). For example, if baseUrl is `https://example.com/auth`, endpoints should be `/auth/authorize` and `/auth/token`. If using a fork or patched version, modify the metadata generation to use `new URL('authorize', baseUrl)` or similar logic.

// Issue: createOAuthMetadata returns absolute paths
// Instead of:
// authorize: '/authorize'
// Use:
// authorize: new URL('authorize', 'https://example.com/auth').pathname // '/auth/authorize'

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics