Skip to content

Phase 1, Slice 4: Gateway call — Gateway calls carry a token naming the user and the agent #2455

Open
9 of 11 issues completed

Description

@ChrisJBurns

Order: slice 3's real-AS-1 ticket (#2607) blocks only the tickets that need it, not the whole slice. #2534 has no open dependency and no ToolHive dependency; #2535 after #2534, against the real AS-1 and the real ToolHive AS-2; #2738 (AS-2 startup wiring) has no open dependency; #2533 after #2738, #2535, and its ToolHive issues; #2654 after #2534 and #2607; #2536 after #2738 and #2535 (its slice test also needs #2533); #2537 has no open dependency; #3019 after a ToolHive release with stacklok/toolhive#7347. Operator configuration and keys (#2538) moved to slice 7 (#2815).

Sequence, one person per stream:

Who the user is: see credentials-and-lifecycle.md: Identifying claim (sub_id for ownership, upstream_subject at the gateway) and mcp-gateway-modes.md: How AS-2 resolves the user. Embedded approval is implicit by configuration (the subject mode in stacklok/toolhive#6887); external approval is #2539.

Problem

MCP calls reach the gateway with the MCP broker's own per-session OAuth grants, unchecked by the identity broker and naming no agent, and the gateway has no way to obtain a user's provider credentials without its own sign-in.

Design

Delivers

Every gateway call is authorized by the identity broker and carries a gateway token from a per-call grant naming the user and the agent; without one, the call is refused. mecak8s's MCP client sends the call; the identity broker returns a new gateway token for each call and never sends calls itself. The token is not yet bound to the call; binding it is phase 2 (mcp-authorization.md, "Authorization, credentials, and dispatch"). Users connect provider accounts at the embedded gateway. Running on operator configuration and keys is slice 7 (#2815).

One config-driven gateway path. A gateway is a configuration entry: its authorization server (AS-2), its vMCP resource, and the servers routed to it. The embedded gateway, the ToolHive gateway that runs inside mecak8s while the broker does (its own deployment once the broker is separate; mcp-gateway-modes.md, "Embedded mode"), is one entry. Phase 1 supports only the embedded gateway; a gateway Mecatl does not run is another entry, needing no new dispatch code, and is phase 3 (#2810).

Tickets

Conflicts: #2738, #2533, #2536, and #2537 all change the MCP broker; one person takes them, in order. #2534 and #2535 are identity broker code, but #2535 also changes internal/app/identitybroker.go (the parts struct, the late-bound AS-2 port, shutdown order), as do #2536 (buildMCPBroker), #2538 (the interim configuration) and #2654 (a late-bound validator): #2535's parts struct lands first, and #2654 reuses its late-binding pattern; #2654 registers #2534's validator where mecak8s hosts AS-1. #2538 changes configuration and the Helm chart.

Testable result

Against the real AS-1 with the offline IdP, a real Mecatl session's MCP call gets a grant and a gateway token and reaches the gateway with it; a call for a closed or unowned session, or from an unregistered agent, is refused before dispatch; a reused grant is refused at AS-2; a user with a connected provider gets their own credential, a user who has never signed in at the gateway is parked at tool listing with the connect link, and after signing in their call uses their own credential ("Connect provider accounts at the embedded gateway" (#2537)). The link for a missing connection is phase 2; asking before the call is phase 3 ("Ask users to connect a provider before the call (authorization pending)" (#2592)).

Done when

All the tickets above are merged, the slice test passes, and gateway calls fail closed without a gateway token.

Sub-issues

Sub-issues

9 of 11 Issues completed
Loading 11 sub-issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions