Repository navigation
fix(mcp): omit gateway redirectURL when authorize has no return_to - #1303
Conversation
🦋 Changeset detectedLatest commit: 4d5449c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Qodex reviewReviewed units u1. The SDK OpenAPI document requires nonempty return_to values and documents omitted-value behavior. Effort: ●●●○○ (3/5) · No findings worth raising. The diff reads clean. Since last review: 0 addressed, 0 new. Scope: the changes since the last review (delta: only what changed since the previously reviewed commit 165139c is reviewed; findings are anchored on the whole change). WalkthroughWhat Qodex checkedLenses (openqodex review with checked answers, all dimensions)
Scanners
Quality filters
Verification (M1b probes against PR preview)
Cross-review dedup
Output
Reviewer: shown 2 of 2 changed hunks, opened 4 files (2 changed files never opened), 16 tool calls served, 11 model calls, 0 correction rounds, 36.1s. The library does not report tool calls asked apart from those it served, or a step cap. Every dimension is reviewed. Bugs, security, and performance post inline; low-severity style and convention notes are collected in the group above rather than dropped. Mark a finding resolved or flag a false positive in the Qodex Pull Requests view. |
Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
return_toonGET /api/v1/mcp-servers/{name}/authorizewas already optional in the schema, but in TrueFoundry mode the store always sent aredirectURLto the MCP gateway, falling back to the TrueForge UI home whenreturn_towas missing. As a result, OAuth-based agents landed on the agent creation page after authentication instead of the gateway's "Authentication successful" page.When
return_tois omitted, noredirectURLis now sent to the gateway. An emptyreturn_tois rejected with 400.Linear: AGE-2694
Changes
TrueFoundryMcpServerStore.authorizeonly builds and forwardsredirectURLwhenreturn_tois given. It also skips the tenant control-plane URL lookup in that case. This also covers the invoke-timeauthorizecall made fromresolveInvokeHeaders, which never passesreturn_to.resolveAuthorizeRedirectURLnow requiresreturnTo.return_toquery description now states that omitting it requests no post-consent redirect.return_toit already stores no landing path, and the callback returns JSON.@truefoundry/trueforge.How was this tested?
return_to(TrueFoundryMcpServerStore.test.ts) and for the 400 on an emptyreturn_to(mcpServers.test.ts).pnpm test -- tests/unit/truefoundry/TrueFoundryMcpServerStore.test.ts tests/unit/apis/mcpServers.test.tspasses (49 tests).pnpm typecheck, ESLint, and Prettier pass on the changed files.Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locally (only the targeted tests, typecheck, and lint were run).env.exampleupdated if configuration or behavior changed (n/a)Note
Medium Risk
Changes default post-OAuth redirect when
return_tois omitted and rejects emptyreturn_towith 400; clients or flows that relied on implicit TrueForge redirects need verification.Reviewed by Cursor Bugbot for commit 4d5449c. Bugbot is set up for automated code reviews on this repo. Configure here.