You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extend the existing OAuth2 PKCE flow in forge/routes/auth/oauth.js to handle MCP agent clients. This adds an mcp-agent client path alongside the existing ff-plugin path, with localhost redirect URI validation, MCP-specific scope handling, and token issuance that produces scoped PATs (from #7411).
Add mcp-agent as a recognized client_id in the OAuth flow, following the ff-plugin pattern
No database record, no AuthClient model changes
/account/authorize extension
When client_id=mcp-agent:
Validate redirect_uri is a loopback address: http://localhost or http://127.0.0.1, any port, any path (per RFC 8252 Section 7.3)
Accept an MCP-specific scope value (e.g. mcp-agent)
Redirect to an MCP consent page route (frontend implementation in a separate task). The route pattern should be distinct from the existing /account/request/:requestId and /account/request/:requestId/editor paths.
/account/complete/:code extension
When the request originates from an mcp-agent client:
Skip the project/device ownership checks (MCP is user-scoped, not resource-scoped)
Admin user rejection is still under discussion in Add PAT (Personal Acces Tokens) scopes #7411. The implementation should account for this being toggled on or off depending on the outcome of that decision.
Generate the authorization code and redirect to the client's redirect_uri as normal
/account/token extension
When client_id=mcp-agent and grant_type=authorization_code:
Summary
Extend the existing OAuth2 PKCE flow in
forge/routes/auth/oauth.jsto handle MCP agent clients. This adds anmcp-agentclient path alongside the existingff-pluginpath, with localhost redirect URI validation, MCP-specific scope handling, and token issuance that produces scoped PATs (from #7411).Prerequisites
.well-knowndiscovery endpoints)Requirements
MCP client registration (hardcoded)
mcp-agentas a recognizedclient_idin the OAuth flow, following theff-pluginpatternAuthClientmodel changes/account/authorizeextensionclient_id=mcp-agent:redirect_uriis a loopback address:http://localhostorhttp://127.0.0.1, any port, any path (per RFC 8252 Section 7.3)mcp-agent)/account/request/:requestIdand/account/request/:requestId/editorpaths./account/complete/:codeextensionmcp-agentclient:redirect_urias normal/account/tokenextensionclient_id=mcp-agentandgrant_type=authorization_code:access_token,expires_in,refresh_tokenclient_id=mcp-agentandgrant_type=refresh_token:Tests
ff-pluginand dynamic client flows are unaffectedReferences
forge/routes/auth/oauth.jsff-pluginclient pattern:oauth.js:91-117(authorize),oauth.js:179(complete),oauth.js:407-439(token)