For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
About brokered elicitation
Learn how the gateway’s OAuth issuer brokers a user’s downstream login and upstream authorization when an MCP client connects.
In brokered elicitation, the gateway gets each user’s credential for an upstream service, such as GitHub or Atlassian, when that user connects an MCP client. The gateway’s OAuth issuer does this work. The same issuer also serves agents that already have a token from your identity provider. For these agents, only the upstream authorization runs.
To the MCP client, the issuer is an ordinary OAuth authorization server. Behind that facade, the issuer is an OAuth client of two other servers. Your identity provider (IdP) proves who the user is. The upstream OAuth provider issues the user’s credential. The issuer runs the two logins one after the other, then sends the user back to the MCP client.
The MCP server never sees the upstream credential flow. The MCP server receives requests that already carry the user’s upstream token.
When to use brokered elicitation
Use the chained flow, entElicitation.brokered.chainedAuth, when the following are true:
- Every user of an MCP server needs their own credential for the same upstream service.
- A prompt in the middle of an MCP session is not acceptable. Each user completes authorization one time, when the user connects.
The following table compares the chained flow with the other ways that the gateway can authorize a user for an MCP server.
| Flow | Field | Who completes the OAuth flow, and when | Use case |
|---|---|---|---|
| Brokered, chained | entElicitation.brokered.chainedAuth | The user, in the browser, when the MCP client connects. The downstream login and the upstream authorization run one after the other. | Per-user credentials for one upstream service, with no mid-session prompt. |
| Brokered, agent (upstream-only) | entElicitation.brokered.chainedAuth | The user, in the browser, the first time that the agent calls the resource. The agent already has an IdP token, so only the upstream authorization runs. | A local or headless agent gets its own IdP token ahead of time, through its own login or automation. The agent calls the MCP server directly and does not run the OAuth flow as an MCP client. |
| Brokered, downstream only | agentgateway.dev/issuer-proxy in the MCP authentication resourceMetadata of an EnterpriseAgentgatewayBackend or EnterpriseAgentgatewayPolicy, with no chainedAuth for the resource path | The user, in the browser, when the MCP client connects. Only the downstream login runs. | Users must log in to your IdP, but the MCP server needs no per-user upstream credential. |
| Interactive | entElicitation.interactive | The user, in the Solo Enterprise for agentgateway UI, after the first request that has no stored credential. | The user already has a token from your IdP, and you want the UI to show and drive pending authorizations. |
The issuer as an OAuth facade
The issuer has three OAuth roles at the same time. Downstream is the login that identifies the user. Upstream is the authorization that gets the user’s credential for the service.
The two servers behind the issuer do different jobs, so these pages use different names for them.
- The downstream IdP proves who the user is. The IdP must support OpenID Connect, because the issuer reads the user’s identity from the ID token. Examples are Keycloak, Okta, and Microsoft Entra ID.
- The upstream OAuth provider issues access tokens for its own API, such as GitHub or Atlassian. The provider is not an identity provider. The issuer gets no ID token from the provider, and does not use the provider to identify the user.
| Party | What the issuer is to that party | What the issuer gets from it |
|---|---|---|
| The MCP client | The authorization server. The client discovers the issuer, registers with the issuer, sends the user to the issuer’s /authorize endpoint, and redeems a code at the issuer’s /token endpoint. | A request to authorize one MCP resource for one user. |
| The downstream IdP | An OAuth client, with one client registration that you create. | An ID token that identifies the user, and the access token that the MCP client uses to call the gateway. |
| The upstream provider | An OAuth client, with a client registration that you create or that the issuer creates through dynamic client registration. | The user’s access token, and a refresh token if the provider issues one, for the upstream service. |
The issuer does not sign tokens of its own. At the issuer’s /token endpoint, the issuer gives the MCP client the token that your IdP issued. The gateway validates that token on each MCP request, the same way the gateway validates any other IdP token.
The upstream token never goes to the MCP client. The security token service (STS) encrypts the upstream token and stores the token for the user and the MCP resource.
The issuer runs in the Solo Enterprise for agentgateway controller, as part of the STS, on port 7777. Clients and browsers reach the issuer through a gateway route for the /oauth-issuer path. Kubernetes and standalone differences lists where you set the issuer configuration.
The chained flow
The chained flow runs when an MCP client connects to an MCP resource that has an upstream OAuth configuration. The user completes both logins in one browser session. The MCP client gets its token only after the upstream authorization succeeds.
The following diagram shows that session, from the client’s first request through later MCP traffic.
sequenceDiagram
participant Client as MCP client
participant Proxy as agentgateway proxy
participant Issuer as OAuth issuer (STS)
participant IdP as Downstream IdP
participant Upstream as Upstream OAuth provider
participant Server as MCP server
Note over Client,Issuer: 1. Discovery
Client->>Proxy: Connect to /mcp/github
Proxy-->>Client: 401 + protected resource metadata
Client->>Proxy: GET authorization server metadata
Proxy-->>Client: Issuer endpoints under /oauth-issuer
Note over Client,Upstream: 2. Authorization, in the browser
Client->>Issuer: /authorize (resource, redirect_uri, PKCE)
Issuer->>IdP: Redirect for downstream login
IdP-->>Issuer: Code to /callback/downstream
Issuer->>IdP: Exchange code for ID token and access token
Issuer-->>Client: Optional consent screen
Issuer->>Upstream: Redirect for upstream authorization
Upstream-->>Issuer: Code to /callback/upstream
Issuer->>Upstream: Exchange code for upstream token
Issuer->>Issuer: Encrypt and store upstream token<br/>for the user and the resource
Issuer-->>Client: Redirect with issuer authorization code
Note over Client,Server: 3. MCP traffic
Client->>Issuer: /token (code, PKCE verifier)
Issuer-->>Client: Downstream IdP access token
Client->>Proxy: MCP request with IdP token
Proxy->>Proxy: Validate IdP token
Proxy->>Issuer: Token exchange for the resource
Issuer-->>Proxy: Stored upstream token
Proxy->>Server: MCP request with upstream token
Read the diagram in three phases.
- Discovery. The MCP client sends a request without a token. The client gets a
401response that points to the protected resource metadata for the MCP path. That metadata names the resource URL as the client’s authorization server. The gateway answers the authorization server metadata request with the issuer’s endpoints. The client then sends the user to the issuer, not directly to your IdP. - Authorization. The issuer sends the user to your IdP to log in. The issuer exchanges the code at the IdP’s token endpoint. The issuer reads the user’s identity from the ID token. If the consent screen is on, the issuer shows the screen. The issuer then sends the user to the upstream provider. The issuer exchanges the upstream code for the user’s upstream token. The issuer stores that token. Last, the issuer redirects the browser back to the MCP client with an authorization code of its own.
- MCP traffic. The MCP client redeems the issuer’s code and gets the IdP access token. On each MCP request, the proxy validates the IdP token. The proxy exchanges that token at the STS for the stored upstream token. The proxy then sends the upstream token to the MCP server.
The issuer keeps the state of each authorization attempt for 15 minutes. A user who takes longer to complete both logins must connect again.
The agent flow (upstream-only)
The agent flow is the upstream-only variant of the chained flow, and the opposite of the downstream-only flow. Many agents do not act as MCP OAuth clients. A local agent or a headless agent often gets its own token from your IdP when it starts, and then sends that token on every request. Because the agent already has a valid IdP token, the issuer does not need to run the downstream login. Only the upstream authorization runs, and only one time for each user and resource.
The agent flow uses the same brokered.chainedAuth configuration as the chained flow. No setting selects it. The STS starts the agent flow when the proxy’s token exchange reaches the STS elicitation endpoint, /elicitations/oauth2/token, with a valid IdP token, and the STS has no stored upstream token for that user and resource. The STS returns the upstream provider’s authorization URL, and the proxy returns that URL to the agent in a 400 response.
sequenceDiagram
participant Agent as Agent
participant IdP as Downstream IdP
participant Proxy as agentgateway proxy
participant Issuer as OAuth issuer (STS)
participant Upstream as Upstream OAuth provider
participant Server as MCP server
Note over Agent,IdP: 1. Before the first call
Agent->>IdP: Get an IdP token
IdP-->>Agent: IdP access token
Note over Agent,Issuer: 2. First call
Agent->>Proxy: MCP request with IdP token
Proxy->>Proxy: Validate IdP token
Proxy->>Issuer: Token exchange for the resource<br/>(POST /elicitations/oauth2/token)
Issuer-->>Proxy: No stored token: upstream authorization URL
Proxy-->>Agent: 400 {"url": "..."}
Note over Agent,Upstream: 3. Authorization, in the browser
Agent->>Upstream: User opens the URL and authorizes
Upstream-->>Issuer: Code to /callback/upstream
Issuer->>Upstream: Exchange code for upstream token
Issuer->>Issuer: Encrypt and store upstream token<br/>for the user and the resource
Note over Agent,Server: 4. Retry and later calls
Agent->>Proxy: MCP request with IdP token
Proxy->>Issuer: Token exchange for the resource
Issuer-->>Proxy: Stored upstream token
Proxy->>Server: MCP request with upstream token
Compared with the chained flow, the agent flow has the following differences.
- No discovery and no issuer token. The agent does not call
/authorizeor/token. The agent sends the token that it got from your IdP directly. - The user still authorizes in a browser. The agent shows the URL to the user. The user must complete the upstream authorization before the agent retries. After that, the stored token serves the agent’s later calls without a prompt.
- The consent screen still applies. If the consent screen is on, the URL points to the issuer’s
/consentpage, which redirects to the upstream provider after the user accepts. - Use a token that your IdP issues for the user. The STS stores the upstream token for the
subclaim of the agent’s token. With an app-only token,subidentifies the application, so every user of the agent shares one upstream credential.
The agent flow does not need the resource metadata that declares the issuer, because the agent does not use discovery. Add the resource metadata if MCP clients that run the OAuth flow also connect to the same resource.
For the steps, see Agent (upstream-only).
Endpoints
The issuer serves the following endpoints under its base URL, such as https://gateway.example.com/oauth-issuer. The base URL path is always /oauth-issuer.
| Endpoint | Caller | Purpose |
|---|---|---|
/.well-known/oauth-authorization-server | The proxy | The issuer’s metadata. The proxy uses this metadata to answer discovery requests from MCP clients. |
/register | The MCP client | Dynamic client registration. The issuer checks the requested redirect URIs and returns its configured client ID. For more information, see Client authentication. |
/authorize | The MCP client, through the browser | Starts the flow for one MCP resource. |
/par | The MCP client | Pushed authorization requests (RFC 9126), an alternative way to start the flow. |
/callback/downstream | The downstream IdP, through the browser | Receives the downstream authorization code. Register this URL with your IdP. |
/consent | The browser | Shows the consent screen and records the user’s decision. |
/callback/upstream | The upstream provider, through the browser | Receives the upstream authorization code. Register this URL with the upstream provider. |
/token | The MCP client | Redeems the issuer’s authorization code for the downstream IdP token. Also relays refresh_token grants to the IdP. |
/oauth/client-metadata.json | The upstream provider | The gateway’s own client metadata document. Served only when you turn on upstream client ID metadata documents. |
The MCP client does not call the issuer’s /.well-known endpoints directly. The client calls the per-resource discovery paths on the gateway, such as /.well-known/oauth-protected-resource/mcp/github and /.well-known/oauth-authorization-server/mcp/github. The route for each MCP resource must match both paths. Do not give clients the issuer’s /.well-known URL as their authorization server.
How the gateway selects the issuer for a resource
An MCP client reaches the issuer for a resource only when the resource’s MCP authentication settings declare the issuer. Three values in the resource metadata work together.
| Setting | Value | What it does |
|---|---|---|
mcp.authentication.resourceMetadata.agentgateway.dev/issuer-proxy | The issuer address that the proxy can reach, such as the controller Service on port 7777 | Declares that the issuer handles this MCP path. The proxy gets the issuer’s metadata from this address. |
mcp.authentication.resourceMetadata.resource | The public URL of the MCP resource, such as https://gateway.example.com/mcp/github | Identifies the resource in discovery and in the client’s authorization request. |
mcp.authentication.resourceMetadata.authorizationServers | A list with one entry: the same public resource URL | Tells the client where to discover its authorization server. The issuer also returns this value as the RFC 9207 iss parameter on the redirect back to the client. |
When the MCP path also has an upstream OAuth configuration, the issuer runs the chained flow. When the path has no upstream OAuth configuration, the issuer stops after the downstream login. That path is the downstream-only flow.
Important
Set authorizationServers to the resource URL, not to the /oauth-issuer base URL. If you set the base URL, the flow completes, but a client that checks the RFC 9207 iss parameter rejects the result. If you omit authorizationServers, the gateway uses the MCP authentication issuer. Clients then go to your IdP directly and never reach the OAuth issuer.
After the user connects
The stored upstream token serves every later request from the same user to the same resource, in any MCP session, until the token becomes unusable.
- Upstream token refresh. When the provider issued a refresh token, the STS refreshes the upstream token when less than 10 percent of its lifetime remains. If the refresh fails, the user authorizes again. See Missing upstream token in this list.
- Downstream token refresh. The MCP client refreshes its IdP token through the issuer’s
/tokenendpoint. The issuer relays therefresh_tokengrant to your IdP. Your IdP issues a refresh token only when the downstream scopes includeoffline_access, or your IdP’s equivalent scope. A client that identifies itself with a client ID metadata document cannot refresh the IdP token. - Missing upstream token. A failed refresh or an administrator delete can remove the stored upstream token. The next MCP request then fails with a
400response. The response body contains aurl. The user opens that URL in a browser and completes the upstream authorization again. This step does not repeat the downstream login. The user’s IdP token already proves who the user is. This re-authorization uses the same upstream-only path as the agent flow.
For the refresh timing, the metrics, and the errors that the /token endpoint returns, see Token refresh.
The issuer stores the upstream token for the user’s identity. By default, that identity is the sub claim of the ID token. The proxy looks up the stored token with the user’s IdP access token. If your IdP puts a different value in the sub claim of the access token, the lookup fails. Every later request then returns the authorization URL again. To use another claim, see User identity.
Kubernetes and standalone differences
The issuer is the same component in both modes. Its settings have the same names. The following table shows what differs.
| Area | Kubernetes | Standalone |
|---|---|---|
| Where the issuer runs | The controller pod | The agentgateway-sts process |
| Issuer settings | KGW_OAUTH_ISSUER_CONFIG controller environment variable, as JSON | entSts.oauthIssuer section of the configuration file |
| Resource settings | backend.entElicitation.brokered in an EnterpriseAgentgatewayPolicy | entSts.entElicitations.resources.<key>.brokered |
| Connect the backend to the STS | backend.entTokenExchange.solo.elicitation in the same policy | backendAuth.oauthTokenExchange that points to the STS /elicitations/oauth2/token endpoint |
| Client secrets and key pairs | References to Kubernetes Secrets | Inline values or file references |
| Interactive elicitation | Supported | Not supported |
Next steps
- Set up brokered elicitation to run an IdP, the issuer, and a sample MCP resource.
- Add a resource: Downstream-only login for IdP login only, the consent screen guide for a resource with an upstream provider, or Agent (upstream-only) for an agent that already has an IdP token.
To adapt the examples to your own IdP, upstream providers, and MCP clients, see the OAuth issuer settings reference.