Skip to content

fix: use /mcp base_url for OAuth metadata endpoints#3

Open
TMogdans wants to merge 1 commit intomayflower:mainfrom
TMogdans:fix/mcp-oauth-base-url
Open

fix: use /mcp base_url for OAuth metadata endpoints#3
TMogdans wants to merge 1 commit intomayflower:mainfrom
TMogdans:fix/mcp-oauth-base-url

Conversation

@TMogdans
Copy link

Summary

  • Fix OAuth base_url in ContextMineGitHubProvider to use /mcp instead of /api
  • OAuth metadata now returns correct endpoint URLs matching the MCP mount point

Problem

The OAuth authorization server metadata returned endpoint URLs under /api/...:

{
  "authorization_endpoint": "http://localhost:8000/api/authorize",
  "token_endpoint": "http://localhost:8000/api/token",
  "registration_endpoint": "http://localhost:8000/api/register"
}

But the actual endpoints served by FastMCP are at /mcp/... (where the MCP sub-app is mounted). This caused MCP clients to fail during OAuth client registration:

POST /api/register → 405 Method Not Allowed
POST /mcp/register → Works correctly

Fix

Changed base_url from {mcp_oauth_base_url}/api to {mcp_oauth_base_url}/mcp in apps/api/app/mcp_auth.py.

Test plan

  • Start ContextMine with GitHub OAuth configured
  • Verify GET /mcp/.well-known/oauth-authorization-server returns URLs under /mcp/...
  • Verify POST /mcp/register works with the metadata-advertised URL
  • Verify MCP client (mcp-remote) can complete OAuth registration step

Fixes #1

🤖 Generated with Claude Code

The OAuth authorization server metadata was returning endpoint URLs
under /api/ (authorize, token, register), but FastMCP serves these
endpoints under /mcp/ where the MCP sub-app is mounted.

This caused MCP clients (mcp-remote, Claude Code) to fail during
OAuth client registration because POST /api/register returned 405
while the actual endpoint is at POST /mcp/register.

Fixes mayflower#1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TMogdans
Copy link
Author

Note: The Semgrep CI failure is pre-existing on the main branch and unrelated to this change. Lint, type check, and tests all pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP OAuth metadata contains wrong endpoint URLs (/api/ instead of /mcp/)

1 participant