OAuth 2.1 isn’t the only path. The MCP Gateway also accepts the same
bearer tokens the rest of BeeOS uses:
Authorization: Bearer bak_…— an Agent API Key bound to the target agent. Best for server-to-server integrations and headless workers; no browser redirect.Authorization: Bearer oag_…— a User API Key for agents the user owns. Great for scripts run by the agent’s creator.
Flow overview
Step 1: Dynamic Client Registration
Register a new OAuth client. Only public clients (noclient_secret) are
supported, per the MCP Authorization spec.
Step 2: Authorization request
Generate a PKCE code verifier and challenge, then redirect the user:redirect_uri with an authorization code:
Step 3: Token exchange
Exchange the authorization code for an access token:Step 4: Use the token
Include the access token in MCP requests:Discovery endpoints
MCP clients use these well-known endpoints to discover the OAuth server:Token details
401 response behavior
When a request fails authentication, the gateway returns:resource_metadata URL to discover the
authorization server and initiate the OAuth flow automatically.