For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Elicit a GitHub credential
Configure a GitHub MCP backend, approve the elicitation in the agentgateway UI, and retry the MCP request with the stored credential.
Use interactive elicitation to get a user’s upstream OAuth credential through the Solo Enterprise for agentgateway UI. When a request needs a credential that the Solo security token service (STS) does not have, the user authorizes access in the UI and retries the request.
This guide connects to the GitHub Model Context Protocol (MCP) server. The same flow applies to other backends that accept an OAuth access token in the Authorization header.
How interactive elicitation works
The following diagram shows the initial request, the separate UI authorization, and the retry with the stored credential.
sequenceDiagram
participant Client as MCP client
participant Gateway as Gateway
participant STS as Solo STS
participant User as User and UI
participant Provider as Upstream OAuth provider
participant Backend as MCP server
Client->>Gateway: Request with the user's identity token
Gateway->>STS: Look up the user's upstream credential
STS-->>Gateway: Pending elicitation and UI URL
Gateway-->>Client: Authorization required, with UI URL
User->>Provider: Authorize access in the browser
Provider-->>User: Return authorization code to the UI
User->>STS: Complete the elicitation with the code
STS->>Provider: Exchange code for tokens
Provider-->>STS: Access token and optional refresh token
Client->>Gateway: Retry the request
Gateway->>STS: Look up the stored credential
STS-->>Gateway: Upstream access token
Gateway->>Backend: Request with the upstream access token
Backend-->>Client: Result through the gateway
- The MCP client sends the user’s identity token to the gateway. The STS looks up a credential for that user and backend.
- If no usable credential exists, the request returns the UI URL. This challenge can occur when the client connects, before a tool call.
- The user opens the UI and authorizes the upstream OAuth provider. The STS exchanges the authorization code and stores the resulting tokens.
- The client retries the connection or tool call. The gateway retrieves the upstream token and injects it into the request to the MCP server.
The user must log in to the Solo Enterprise for agentgateway UI with the same identity that the MCP client sends. The STS uses the token’s sub claim to identify the user. The account that the user authorizes at GitHub can differ from the account used to log in to the UI.
Before you begin
Prepare the STS and UI before configuring the backend. The gateway, STS, and UI must agree on the user’s identity.
Set up the following components from Set up interactive elicitation.
- The
agentgateway-proxyGateway in theagentgateway-systemnamespace, with routes allowed from other namespaces. - The STS with credential storage and validators for the user’s identity token.
- The UI with OpenID Connect (OIDC) login and the
/elicitationspage. - The
CALLBACK_URLcontroller setting pointing to that UI page, such ashttp://localhost:8090/elicitations.
- The
If you have not already done so, register a GitHub OAuth app. Set its callback URL to the UI elicitations URL. This example uses the OAuth app’s
read:userscope to read a GitHub profile.Save the app’s credentials for the configuration steps.
export GITHUB_CLIENT_ID='<your-oauth-app-client-id>' export GITHUB_CLIENT_SECRET='<your-oauth-app-client-secret>'Get a valid identity token for the user who will approve the elicitation. For the Keycloak test setup, use the
user1account andKEYCLOAK_URLfrom the setup guide.export USER_TOKEN=$(curl -fsS \ --data-urlencode 'client_id=fe-client-1' \ --data-urlencode 'username=user1' \ --data-urlencode 'password=Password1!' \ --data-urlencode 'grant_type=password' \ "$KEYCLOAK_URL/realms/agentgateway/protocol/openid-connect/token" \ | jq -er '.access_token')Install
kubectl,curl, andjqfor the configuration and verification steps.
Configure the MCP backend
Create a GitHub MCP backend and configure its upstream OAuth provider. The elicitation policy specifies how to get the credential, and the Solo STS token exchange setting enables the gateway to retrieve and inject it.
Create a namespace for the example resources.
kubectl create namespace interactive-elicitationStore the GitHub OAuth client secret in that namespace.
kubectl create secret generic github-oauth-client \ -n interactive-elicitation \ --from-literal=client_secret="$GITHUB_CLIENT_SECRET"Create the GitHub MCP backend. The remote server uses HTTPS at
https://api.githubcopilot.com/mcp/.kubectl apply -f - <<'EOF' apiVersion: enterpriseagentgateway.solo.io/v1alpha1 kind: EnterpriseAgentgatewayBackend metadata: name: github-mcp namespace: interactive-elicitation spec: mcp: targets: - name: github static: host: api.githubcopilot.com port: 443 path: /mcp/ policies: tls: sni: api.githubcopilot.com EOFSetting Description mcp.targets[].staticThe host, port, and path of the remote MCP server. policies.tls.sniThe server name for the TLS connection to GitHub. Configure interactive elicitation for the backend. Replace the redirect URI if your UI uses a different address.
Set exactly one of
entElicitation.interactiveorentElicitation.brokeredon a backend. This example uses the typedentTokenExchangesetting. In the legacytokenExchangesetting,mode: ElicitationOnlychecks elicitation but does not inject the returned credential.kubectl apply -f - <<EOF apiVersion: enterpriseagentgateway.solo.io/v1alpha1 kind: EnterpriseAgentgatewayPolicy metadata: name: github-interactive namespace: interactive-elicitation spec: targetRefs: - group: enterpriseagentgateway.solo.io kind: EnterpriseAgentgatewayBackend name: github-mcp backend: entElicitation: interactive: oauth: clientId: "${GITHUB_CLIENT_ID}" clientSecretRef: name: github-oauth-client scopes: - read:user redirectUri: http://localhost:8090/elicitations authorizeUrl: https://github.com/login/oauth/authorize accessTokenUrl: https://github.com/login/oauth/access_token entTokenExchange: solo: elicitation: {} EOFSetting Description targetRefsThe backend that needs the user’s upstream credential. The policy and backend are in the same namespace. entElicitation.interactive.oauth.clientIdThe client ID of your registered GitHub OAuth application. clientSecretRef.nameThe Secret that holds the OAuth client secret under client_secret. The Secret must be in the policy’s namespace.scopesThe permissions to request. This example requests read:userto read the user’s profile. Choose the scopes that your tools need.redirectUriThe UI callback URL. It must match the callback registered with the OAuth provider. authorizeUrlThe provider’s authorization endpoint, which the browser visits for approval. accessTokenUrlThe provider’s token endpoint, where the STS exchanges the authorization code and refreshes tokens. entTokenExchange.solo.elicitationUses the Solo STS elicitation endpoint to retrieve the upstream credential and inject it into backend requests. An omitted backendRefuses the built-in STS Service.Route
/mcp/githubto the backend.kubectl apply -f - <<'EOF' apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: github-interactive namespace: interactive-elicitation spec: parentRefs: - name: agentgateway-proxy namespace: agentgateway-system rules: - matches: - path: type: PathPrefix value: /mcp/github backendRefs: - group: enterpriseagentgateway.solo.io kind: EnterpriseAgentgatewayBackend name: github-mcp EOFSetting Description parentRefsThe Gateway from the setup guide. Its listener must allow routes from interactive-elicitation.matches.pathThe path that MCP clients use to connect through the gateway. backendRefsThe enterprise MCP backend, including its API group and kind.
Trigger and authorize the elicitation
Connect with your user’s identity token to trigger the credential lookup. Complete the pending elicitation in the UI before retrying the connection.
Get the gateway address for your environment.
export INGRESS_GW_ADDRESS=$(kubectl get svc agentgateway-proxy \ -n agentgateway-system \ -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}") export MCP_URL="http://${INGRESS_GW_ADDRESS}/mcp/github"In a separate terminal, forward the gateway Service.
kubectl port-forward -n agentgateway-system svc/agentgateway-proxy 8080:80In your working terminal, set the MCP URL.
export MCP_URL=http://localhost:8080/mcp/githubInitialize an MCP connection with your user’s identity token.
curl -i "$MCP_URL" \ -H "Authorization: Bearer $USER_TOKEN" \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-03-26", "capabilities": {}, "clientInfo": {"name": "interactive-elicitation-example", "version": "1.0"} } }'If the STS has no credential for this user and backend, the response includes the UI URL. With this policy, the initial connection returns HTTP
400.HTTP/1.1 400 Bad Request ... {"url":"http://localhost:8090/elicitations"}Open the returned URL in your browser. Log in as the same user whose identity token you supplied in
USER_TOKEN.On the Elicitations page, find the entry for
interactive-elicitation/github-mcpwith the Pending status and an Authorize button.

Click Authorize to open GitHub’s authorization page.
Log in to GitHub and approve the requested permissions. GitHub redirects your browser to the UI callback URL.
Confirm that the elicitation shows Complete. The STS can now retrieve the stored GitHub credential for this user and backend.


Retry the MCP request
Start a new MCP connection after approval. The gateway now retrieves the stored token and sends the GitHub credential to the MCP server.
Initialize the connection again and save the response headers.
curl -sS -D /tmp/interactive-mcp-headers "$MCP_URL" \ -H "Authorization: Bearer $USER_TOKEN" \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2025-03-26", "capabilities": {}, "clientInfo": {"name": "interactive-elicitation-example", "version": "1.0"} } }'Example output: HTTP
200and an MCP initialization result. The headers include anmcp-session-idfor subsequent requests.event: message data: {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"completions":{},"prompts":{},"resources":{},"tools":{}},"serverInfo":{"name":"github-mcp-server","title":"GitHub MCP Server","version":"github-mcp-server/remote-6498d50a63c4b907a13d30f95a55a107b4e6f9ac" ...Save the session ID.
export MCP_SESSION_ID=$(awk 'tolower($1) == "mcp-session-id:" {gsub("\r", "", $2); print $2}' /tmp/interactive-mcp-headers) echo $MCP_SESSION_IDExample output:
eyJ0Ijo...Notify the gateway that initialization is complete.
curl -sS "$MCP_URL" \ -H "Authorization: Bearer $USER_TOKEN" \ -H "Mcp-Session-Id: $MCP_SESSION_ID" \ -H 'MCP-Protocol-Version: 2025-03-26' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'Call the GitHub
get_metool to read the authorized user’s profile.curl -sS "$MCP_URL" \ -H "Authorization: Bearer $USER_TOKEN" \ -H "Mcp-Session-Id: $MCP_SESSION_ID" \ -H 'MCP-Protocol-Version: 2025-03-26' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json, text/event-stream' \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_me","arguments":{}}}'Example output: Expect a successful tool result with your GitHub profile. Later requests use the stored credential without another UI approval while that credential remains usable.
event: message data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{\"login\":\"<username>\",\"id\":<id>,\"profile_url\":\"https://github.com/<username>\",\"avatar_url\":\"https://avatars.githubusercontent.com/u/<user-id>?v=4\",\"details\":{\"name\":\"<name>\",\"company\":\"@<company> \", ...
Token refresh
Upstream token refresh is automatic for interactive elicitation. When the OAuth provider returns a refresh token with the access token, the STS stores both. No separate refresh setting exists under entElicitation.interactive.oauth.
The STS checks token expiry when it retrieves a stored credential. It attempts a refresh when less than 10 percent of the access token’s lifetime remains, or when the token has expired. Refresh runs during a credential lookup, rather than on a background timer. When the provider omits a positive expires_in, the STS assumes a one-hour lifetime.
If the provider requires a scope to issue refresh tokens, include that scope in interactive.oauth.scopes. For example, some providers require offline_access. Use the provider’s requirements for your application. For GitHub OAuth apps, see Authorizing OAuth apps.
When a refresh response includes a new refresh token, the STS stores the replacement. When the response omits a refresh token, the STS retains the existing refresh token. If refresh fails, or an expired credential has no refresh token, the elicitation returns to Pending. The user must authorize access in the UI again and retry the request.
The identity token in USER_TOKEN has its own lifetime. Renew that token through your identity provider when it expires. Interactive elicitation does not require the brokered OAuth issuer’s KGW_OAUTH_ISSUER_CONFIG settings to refresh an upstream credential.
Clean up
Remove the example resources when you finish. Delete the elicitation while its policy still exists so that the entry remains available in the UI.
In the Elicitations page in the UI, open the Actions menu for the
interactive-elicitation/github-mcpelicitation and click Delete.Delete the namespace that you created for this guide.
kubectl delete namespace interactive-elicitationRemove the saved MCP response headers.
rm /tmp/interactive-mcp-headers