feat: add tool picker capability to gateway
Uses the shared auth resolver from #7823, now merged into main. Gateway Code Mode is stacked on this PR in #6978.
Summary
Gateways (Meta MCP) get the consent-screen tool picker that single MCP servers already have, for project gateways and the organization gateway.
Gateway consent verifies members and captures their tool definitions before approval. All tools (live) refreshes approved members; All tools (frozen) and Specific tools serve the immutable Redis catalogue, so tool access is much faster, without upstream discovery or token refresh. New members and members unavailable at consent require new consent in every mode. Calls check current authorization, configuration and the auth-client choice persisted through the shared resolver.
The shared checkAuthClientPermission helper also checks mapped auth clients when serving falls back to a registration or current server headers, including direct single-server endpoints. The default permitter still allows these requests; when per-client grants in AIM-589 are enforced, a denied mapped client returns 403 instead of serving through the fallback. Unmapped legacy selections keep their existing behavior.
The consent list and picker share one capture and distinguish access, setup, reconnect and outage states. Members are grouped into one section per server. Custom-domain lockdown directs users to reconnect their client at the verified, active domain's MCP URL.
Motivation
Upstream handshakes and credential resolution make gateway connection and discovery slow. Capturing that work at consent keeps protocol setup and cached discovery fast while preserving live authorization for execution and an explicit boundary for future members. Users also need to narrow a gateway connection to the tools they trust, per server, the same way they can for a single MCP server.
Gutternote review steps
- Setup: use the seeded gateway with accessible hosted or proxied members.
- Connect an OAuth MCP client. On consent, compare All tools (live), All tools (frozen) and Specific tools. Check that the server list and picker agree. Choose tools and give access; Direct and Progressive discovery must expose the same approved boundary.
- Add a member, or restore a member unavailable at consent. Existing browser consents must exclude it until new consent. Frozen tool definitions stay fixed; live mode may discover new tools on approved members. Revoked access must stop calls.
- Repeat against the organization gateway (
/mcp/gateway/<org>). - Check partial availability, zero verified members, reload and token refresh. With custom-domain lockdown, the platform-host consent page must block approval and show the custom-domain MCP URL for reconnecting the client.
๐ Preview Environment (PR #6816)
Preview URL: https://pr-6816.dev.getgram.ai
| Component | Status | Details | Updated (UTC) |
|---|---|---|---|
| โ Database | Ready | Existing database reused | 2026-10-22 23:00:41. |
| โ Images | Available | Container images ready | 2026-10-22 23:03:51. |
Gram Preview Bot