Skip to content

Ask users to connect a provider before the call (authorization pending) #2592

Open

Description

@ChrisJBurns

Depends on: "Connect provider accounts at the embedded gateway" (#2537); "Connect link for a missing provider connection, through the gateway's URL elicitation" (#2973); "vMCP: answer a call for an unconnected provider with a URL elicitation carrying the connect link" (stacklok/toolhive#7188); "vMCP: keep a delegated session and route calls when the user has not connected a backend's provider" (stacklok/toolhive#7189)

Removes shortcut: a missing provider connection fails the call with a connect link instead of asking the user before the call (#2451, #2537)

Problem

In phase 1, when a user has not connected a provider (GitHub, Google, and so on) at the gateway, the agent's tool call fails with an error telling the user to connect. The design asks for the mcp_authorization_pending outcome instead: the user is asked to connect before the call, and the call continues afterwards. Phase 1 cannot do this, because the gateway only says "needs authorization" when a call reaches it, and the MCP broker's pending outcome comes from the engine's authorization step, which runs before the tool executes.

Design

Requirements

  • Decided: MCP URL-mode elicitation, in both gateway modes. MCP broker authorizes gateway calls and sends them to the configured gateway #2536's sending path fails the call closed with the connect link (connection_required), and Connect provider accounts at the embedded gateway #2537 makes a missing connection reach it; this ticket changes that row to mcp_authorization_pending and completes the flow (asking before the call where possible, resuming the call after the user connects).
  • A link-only pending transaction in the MCP broker. The broker turns that signal into the existing mcp_authorization_pending outcome with the gateway's link. Unlike today's pending transactions, it completes without a callback of its own: the call is retried once the user has connected. Connecting does not approve the pending call by itself ("Pauses and restart").
  • Where possible, before the call. If the broker's own state already shows the connection is missing, return the pending outcome before dispatch; otherwise use the gateway's signal at call time.
  • Scope: only the missing-connection answer (-32042). Requests a gateway sends during a call, such as elicitations, are Ask the user when a gateway tool needs input during a call #2821's.
  • Engine and wire. Returning a pending outcome from a call that is already running needs an engine change. Include the wire API compatibility assessment.
  • Record the remaining deviation from step (9), if any, in the design.

How it fits

Restores the design's user experience for missing connections, which phase 1 replaced with a fail-closed error (#2537).

Done when

A user without a connection is asked to connect, with the gateway's link, and the call continues after they connect, in embedded mode. A gateway that sends no structured signal still fails closed with the connect error. With the flag off, nothing changes.

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