microsoft / microsoft/agent-host-protocol

authenticate / auth-required can't model per-session, request-correlated OAuth (e.g. MCP server OAuth)

Open
#221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
344
Forks
122
Avg merge
14h 12m
Merged PRs (30d)
22

Description

Summary

AHP's authentication flow (auth/required + the authenticate command) models agent-level, statically-declared protected resources via RFC 6750 bearer-token push. It can't model a per-session, request-correlated OAuth flow — the shape MCP servers use — so a host bridging such a flow to AHP clients has no surface to express it.

Current model
  • auth/required (server → client) carries a channel and a resource (an OAuth-protected resource identifier per RFC 9728).
  • authenticate (client → server) pushes a Bearer token for that resource. AuthenticateParams.channel is narrowed to 'ahp-root://', and resource MUST match a ProtectedResourceMetadata.resource declared in AgentInfo.protectedResources:
export interface AuthenticateParams extends BaseParams {
  channel: 'ahp-root://';
  resource: string; // must match AgentInfo.protectedResources
  token: string;    // bearer token the client already obtained
}

So the model is "push me a bearer token for this declared, agent-level resource."

The gap

This can't represent an OAuth flow that is per-session and correlated to a specific pending request. As a concrete, publicly-available example, the github/copilot-sdk runtime emits an mcp.oauth_required event:

  • it carries an oauthRequestId ("used to respond via session.respondToMcpOAuth()"), the MCP server name/URL, and an optional static client config (grant type, etc.);
  • the client is expected to respond correlated by that request id, potentially completing an interactive authorization-code grant rather than just handing back a pre-obtained bearer token.

A host bridging such a backend to AHP clients has nowhere to:

  1. advertise the pending request on the session channelauth/required is geared to root-channel, agent-declared resources, and authenticate.channel is 'ahp-root://'-only; and
  2. receive a request-correlated completionauthenticate carries only { resource, token }, with no field to echo back a specific request/correlation id, and assumes the client already holds a bearer token rather than completing a pending authorization tied to a particular request.
Suggested direction

Consider extending the authentication surface to cover per-session, request-correlated OAuth — for example:

  • a session-channel auth/required variant carrying an opaque request/correlation id (and optional client-config hints), and
  • an authenticate (or sibling) command variant that echoes that id and can carry an authorization result, not only a pre-obtained bearer token.

Happy to help shape this if it's useful — it's the one authentication shape that doesn't map onto the current commands.

Contributor guide

Open the 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.

Research direction

Start by reading the current auth/required and authenticate definitions, including their channel, resource, and token fields. Compare them with the per-session, request-correlated OAuth flow described from the Copilot SDK and determine the protocol shape needed; done means the project agrees on an implementable extension and its correlation and authorization-result semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.