fix(mcp): send Org-Id/Workspace-Id tenancy headers on platform token requests#334
Merged
Merged
Conversation
…aders A deployed agent's auth.type=platform read failed at startup with 'platform token endpoint returned 401: missing org-id header'. The platform verifies a PER-ORG HS256 token, so it needs Org-Id to select the signing secret BEFORE it can validate the bearer — and Workspace-Id to authorize the request against the registry entry (entitlement). The token request sent only the bearer. Now sends both from the standard FORGE_ORG_ID / FORGE_WORKSPACE_ID env the platform injects (omitted when empty), exactly as the admission and remote-session-store clients already do. Test asserts the resolver receives them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…th types, DEFER, OAuth discovery) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The MCP platform-token resolver (
forge-core/mcp/platform_token.go) fetched short-lived agent-principal tokens from agent-builderPOST /api/v1/mcp/tokensending onlyAuthorization: Bearer ${FORGE_PLATFORM_TOKEN}— no tenancy headers. The platform verifies a per-org HS256 token and needsOrg-Idto select the signing secret before it can validate the bearer, so the call failed with401 "missing org-id header"(hit live on the FanDuel test env).Change
Org-Id+Workspace-IdfromFORGE_ORG_ID/FORGE_WORKSPACE_IDon every platform-token request, matching the pattern already used byadmission_loader.go/remote_session_store.go.CLAUDE.md(tenancy headers, MCP auth types, DEFER keying<server>__<op>, RFC 9728→8414→7591 path-qualified issuer well-known insertion).Test
cd forge-core && go test ./...green.🤖 Generated with Claude Code