Skip to content
Latest (currently 2026.11.0) has the newest features, bug fixes, and CVE patches of Solo Enterprise for agentgateway.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Set up brokered elicitation

Page as Markdown

Prepare the shared identity provider, STS, and OAuth issuer for brokered elicitation.

Prepare the identity provider (IdP), security token service (STS), and OAuth issuer shared by the brokered elicitation guides. This setup creates a Keycloak realm and a confidential agw-issuer client, enables the controller’s STS, routes OAuth requests through the gateway, and registers an Everything MCP sample resource.

Before you begin

  1. Install Solo Enterprise for agentgateway, including the controller and a gateway proxy.
  2. Have a load balancer implementation for the example Keycloak Service. For a local kind cluster, you can use cloud-provider-kind. The Keycloak URL must be reachable from both your browser and the controller pod.
  3. Install kubectl, Helm, curl, and jq.

The example uses HTTP and test credentials. Use HTTPS and your organization’s IdP for a production deployment. Note that brokered elicitation for downstream-only logins does not require the Solo Enterprise for agentgateway UI, a GitHub OAuth app, or httpbin.

Step 1: Set the public gateway URL

All brokered resources share one issuer base URL. Use the same public URL, written the same way, for client registration, issuer configuration, and MCP resource metadata. MCP clients compare issuer values as exact strings.

  1. Set the name of your installed Gateway and its proxy Service. If you installed the proxy with a different name, use that name.

    export GATEWAY_NAME=agentgateway-proxy
  2. Choose how clients reach the gateway. Keep any port-forward process running while completing the guides.

    Use an HTTPS endpoint without a default port for a LoadBalancer, or use the port-forward option. MCP Inspector sends tokens only to an HTTPS endpoint or to a localhost address. Clients remove the default port from their requests. The issuer metadata then does not match the URL that the client expects, and the login fails.

    kubectl -n agentgateway-system wait --for=jsonpath='{.status.loadBalancer.ingress}' "service/$GATEWAY_NAME" --timeout=120s
    export INGRESS_GW_ADDRESS=$(kubectl get svc -n agentgateway-system "$GATEWAY_NAME" -o json | jq -r '.status.loadBalancer.ingress[0] | .hostname // .ip')
    export GATEWAY_URL="https://${INGRESS_GW_ADDRESS}"
    echo "$GATEWAY_URL"
    kubectl port-forward -n agentgateway-system "svc/$GATEWAY_NAME" 3000:80

    In the terminal where you run the remaining commands, export the public URL. Export GATEWAY_NAME in this terminal as well.

    export GATEWAY_NAME=agentgateway-proxy
    export GATEWAY_URL=http://localhost:3000

Step 2: Set up Keycloak

The example imports the same downstream-mcp realm, agw-issuer client, and alice user as the standalone guide. The Keycloak hostname is fixed to its public URL so that browser login and token validation use the same issuer.

  1. Create a Service for the example Keycloak deployment.

    kubectl apply -f- <<EOF
    apiVersion: v1
    kind: Service
    metadata:
      name: brokered-keycloak
      namespace: agentgateway-system
    spec:
      type: LoadBalancer
      selector:
        app: brokered-keycloak
      ports:
      - name: http
        port: 8080
        targetPort: 8080
    EOF
    kubectl -n agentgateway-system wait --for=jsonpath='{.status.loadBalancer.ingress}' service/brokered-keycloak --timeout=120s
  2. Export the Keycloak URL and the example client credentials. Keep these variables in the terminal where you create the remaining resources.

    export KEYCLOAK_HOST=$(kubectl get svc -n agentgateway-system brokered-keycloak -o json | jq -r '.status.loadBalancer.ingress[0] | .hostname // .ip')
    export KEYCLOAK_URL="http://${KEYCLOAK_HOST}:8080"
    export KEYCLOAK_ISSUER="${KEYCLOAK_URL}/realms/downstream-mcp"
    export KEYCLOAK_JWKS_URI="${KEYCLOAK_ISSUER}/protocol/openid-connect/certs"
    export ISSUER_CLIENT_ID=agw-issuer
    export ISSUER_CLIENT_SECRET=local-issuer-secret
    echo "$KEYCLOAK_ISSUER"
  3. Create the realm configuration and Keycloak deployment. The shell substitutes GATEWAY_URL in the client callback and KEYCLOAK_URL in the deployment.

    kubectl apply -f- <<EOF
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: brokered-keycloak-realm
      namespace: agentgateway-system
    data:
      downstream-mcp-realm.json: |
        {
          "realm": "downstream-mcp",
          "enabled": true,
          "sslRequired": "none",
          "clients": [
            {
              "clientId": "agw-issuer",
              "secret": "local-issuer-secret",
              "publicClient": false,
              "standardFlowEnabled": true,
              "directAccessGrantsEnabled": false,
              "redirectUris": [
                "${GATEWAY_URL}/oauth-issuer/callback/downstream"
              ],
              "protocolMappers": [
                {
                  "name": "gateway-audience",
                  "protocol": "openid-connect",
                  "protocolMapper": "oidc-audience-mapper",
                  "config": {
                    "included.client.audience": "agw-issuer",
                    "access.token.claim": "true",
                    "id.token.claim": "true"
                  }
                }
              ]
            }
          ],
          "users": [
            {
              "username": "alice",
              "enabled": true,
              "email": "alice@example.com",
              "emailVerified": true,
              "firstName": "Alice",
              "lastName": "Example",
              "credentials": [
                {
                  "type": "password",
                  "value": "alice-password",
                  "temporary": false
                }
              ]
            }
          ]
        }
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: brokered-keycloak
      namespace: agentgateway-system
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: brokered-keycloak
      template:
        metadata:
          labels:
            app: brokered-keycloak
        spec:
          containers:
          - name: keycloak
            image: quay.io/keycloak/keycloak:26.7.1
            args: ["start-dev", "--import-realm"]
            env:
            - name: KC_BOOTSTRAP_ADMIN_USERNAME
              value: admin
            - name: KC_BOOTSTRAP_ADMIN_PASSWORD
              value: admin
            - name: KC_HOSTNAME
              value: "${KEYCLOAK_URL}"
            ports:
            - containerPort: 8080
            readinessProbe:
              httpGet:
                path: /realms/downstream-mcp/.well-known/openid-configuration
                port: 8080
              initialDelaySeconds: 10
              periodSeconds: 5
            volumeMounts:
            - name: realm
              mountPath: /opt/keycloak/data/import
              readOnly: true
          volumes:
          - name: realm
            configMap:
              name: brokered-keycloak-realm
    EOF
    SettingDescription
    redirectUrisThe issuer’s downstream callback, ${GATEWAY_URL}/oauth-issuer/callback/downstream. Keycloak matches this value exactly, so it must use the same form as GATEWAY_URL.
    protocolMappersAdds agw-issuer to the token audience so that the MCP authentication policy can require it explicitly.
    usersCreates alice with password alice-password for browser login.
    KC_HOSTNAMEPublic Keycloak URL, reachable by the controller and browser. A Keycloak port-forward to your laptop is not reachable as localhost from the controller pod.
    --import-realmImports the realm on startup. This development example has no persistent database volume.
  4. Wait for Keycloak and inspect its discovery document.

    kubectl -n agentgateway-system rollout status deployment/brokered-keycloak --timeout=180s
    curl -fsS "${KEYCLOAK_ISSUER}/.well-known/openid-configuration" | jq '{issuer, authorization_endpoint, token_endpoint}'

    The returned issuer must equal $KEYCLOAK_ISSUER. If you use an existing IdP, substitute its client credentials, issuer, and endpoints in the remaining configuration.

Step 3: Enable STS and configure the OAuth issuer

The tokenExchange Helm feature starts the shared STS component that hosts the OAuth issuer. Configure downstream login once, then reuse the issuer for each MCP resource.

The controller manages the STS signing key and encryption keyring in Secrets. Keep those Secrets when upgrading or restarting the controller. The default SQLite database uses an in-memory emptyDir volume, so stored OAuth state and credentials are lost when the pod is replaced. Use persistent database storage for a production deployment. This sample uses the chart defaults and needs no separate signing key. Consent screen and pushed authorization requests (PAR) are optional settings that you can set later.

  1. Save the current Helm values so that the upgrade retains your installation settings.

    helm get values enterprise-agentgateway -n agentgateway-system -o yaml > values.yaml
  2. Create an overlay with STS and issuer settings. The unquoted heredoc substitutes the exported variables before Helm reads the file. If STS already serves other IdPs, retain their validators when adding this realm.

    cat > brokered-values.yaml <<EOF
    tokenExchange:
      enabled: true
      issuer: "${GATEWAY_URL}/oauth-issuer"
      subjectValidators:
      - validatorType: remote
        issuer: "${KEYCLOAK_ISSUER}"
        remoteConfig:
          url: "${KEYCLOAK_JWKS_URI}"
      actorValidators:
      - validatorType: k8s
      apiValidators:
      - validatorType: remote
        issuer: "${KEYCLOAK_ISSUER}"
        remoteConfig:
          url: "${KEYCLOAK_JWKS_URI}"
      maintenance:
        enabled: true
    controller:
      extraEnv:
        KGW_OAUTH_ISSUER_CONFIG: |
          {
            "downstream_server": {
              "name": "keycloak",
              "client_id": "${ISSUER_CLIENT_ID}",
              "client_secret": "${ISSUER_CLIENT_SECRET}",
              "authorize_url": "${KEYCLOAK_ISSUER}/protocol/openid-connect/auth",
              "token_url": "${KEYCLOAK_ISSUER}/protocol/openid-connect/token",
              "scopes": ["openid", "profile"]
            },
            "gateway_config": {
              "base_url": "${GATEWAY_URL}/oauth-issuer"
            },
            "incoming_clients": {
              "allowed_redirect_uris": [
                "http://localhost:6274/oauth/callback",
                "http://localhost:6274/oauth/callback/debug",
                "http://127.0.0.1:6274/oauth/callback",
                "http://127.0.0.1:6274/oauth/callback/debug"
              ]
            }
          }
    EOF

    For every issuer setting, including the client authentication options for your own IdP, see the OAuth issuer settings reference.

    SettingDescription
    tokenExchange.enabledEnables the STS, including the OAuth issuer. Downstream-only login relays Keycloak tokens without a backend token exchange.
    Validator listsSupply the required STS validators. Kubernetes service account tokens authenticate actors; the example’s users have Keycloak tokens.
    tokenExchange.maintenance.enabledOptional. Enable the periodic janitor that deletes expired, unused tokens and cleans up their related elicitations. Defaults to false. To tune the cleanup interval and retention periods, see Token maintenance.
    downstream_serverConfidential client and downstream OAuth endpoints. The scopes are a JSON array.
    gateway_config.base_urlPublic issuer URL. Its /callback/downstream endpoint must match the Keycloak client registration.
    incoming_clients.allowed_redirect_urisInspector callbacks for both loopback hostnames. localhost does not match 127.0.0.1.
  3. Upgrade the controller and wait for its rollout.

    helm upgrade -i enterprise-agentgateway oci://us-docker.pkg.dev/solo-public/enterprise-agentgateway/charts/enterprise-agentgateway \
      -n agentgateway-system \
      --version v2026.11.0 \
      -f values.yaml -f brokered-values.yaml
    kubectl -n agentgateway-system rollout status deployment/enterprise-agentgateway

Step 4: Route the issuer and configure JWKS access

The gateway forwards public OAuth requests to the controller on port 7777. A separate backend lets the proxy fetch Keycloak’s public keys over the cluster network.

  1. Create the issuer backend, HTTPRoute, and JWKS backend. Keep discovery, login, and callbacks reachable before a client has a token. The issuer handles OAuth client authentication itself; a bearer-token policy across /oauth-issuer/* would block browser login and callbacks.

    kubectl apply -f- <<EOF
    apiVersion: agentgateway.dev/v1alpha1
    kind: AgentgatewayBackend
    metadata:
      name: oauth-issuer-backend
      namespace: agentgateway-system
    spec:
      static:
        host: enterprise-agentgateway.agentgateway-system.svc.cluster.local
        port: 7777
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: oauth-issuer
      namespace: agentgateway-system
    spec:
      parentRefs:
      - name: ${GATEWAY_NAME}
      rules:
      - matches:
        - path:
            type: PathPrefix
            value: /oauth-issuer
        backendRefs:
        - group: agentgateway.dev
          kind: AgentgatewayBackend
          name: oauth-issuer-backend
    ---
    apiVersion: agentgateway.dev/v1alpha1
    kind: AgentgatewayBackend
    metadata:
      name: keycloak-jwks
      namespace: agentgateway-system
    spec:
      static:
        host: brokered-keycloak.agentgateway-system.svc.cluster.local
        port: 8080
    EOF
    ResourcePurpose
    oauth-issuer-backendConnects the proxy to the controller’s STS listener.
    oauth-issuerPublishes /oauth-issuer/* through the gateway identified by GATEWAY_NAME.
    keycloak-jwksConnects to Keycloak inside the cluster. MCP policies still validate the public KEYCLOAK_ISSUER value in tokens.
  2. Check the issuer’s discovery endpoint through the gateway.

    curl -fsS "${GATEWAY_URL}/oauth-issuer/.well-known/oauth-authorization-server" | jq '{authorization_endpoint, token_endpoint, registration_endpoint}'

    The endpoint URLs must start with ${GATEWAY_URL}/oauth-issuer. Step 6 adds the protected resource metadata that starts a client login.

Step 5: Start the MCP server

Deploy the sample Everything MCP server in the gateway namespace. The server provides an Echo tool and does not require authentication; the gateway enforces downstream login.

  1. Create the Deployment and Service.

    kubectl apply -f- <<EOF
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: downstream-mcp
      namespace: agentgateway-system
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: downstream-mcp
      template:
        metadata:
          labels:
            app: downstream-mcp
        spec:
          containers:
          - name: everything
            image: node:22-alpine
            command: ["npx"]
            args: ["-y", "@modelcontextprotocol/server-everything@2026.8.31", "streamableHttp"]
            ports:
            - containerPort: 3001
            readinessProbe:
              tcpSocket:
                port: 3001
              initialDelaySeconds: 5
              periodSeconds: 5
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: downstream-mcp
      namespace: agentgateway-system
    spec:
      selector:
        app: downstream-mcp
      ports:
      - name: mcp
        port: 3001
        targetPort: 3001
    EOF
    SettingDescription
    argsStarts the same pinned Everything MCP server version as the standalone guide with the Streamable HTTP transport. The pod needs access to the npm registry on first start.
    Service port 3001Exposes the MCP endpoint inside the cluster. Client traffic enters through the gateway.
    readinessProbeWaits for the MCP server’s listener before the Service routes traffic to the pod.
  2. Wait for the server to become available.

    kubectl -n agentgateway-system rollout status deployment/downstream-mcp --timeout=180s

Step 6: Register the MCP resource

Every brokered MCP flow targets a resource with its own public URL. Register the sample at ${GATEWAY_URL}/mcp so that clients can discover the shared issuer. Additional guides add resource-specific backends, paths, and upstream OAuth mappings; one sample resource does not register other MCP servers automatically.

  1. Create the MCP backend and HTTPRoute.

    kubectl apply -f- <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayBackend
    metadata:
      name: downstream-mcp
      namespace: agentgateway-system
    spec:
      mcp:
        targets:
        - name: everything
          static:
            host: downstream-mcp.agentgateway-system.svc.cluster.local
            port: 3001
            path: /mcp
            protocol: StreamableHTTP
      policies:
        mcp:
          authentication:
            mode: Strict
            issuer: "${KEYCLOAK_ISSUER}"
            audiences: [agw-issuer]
            jwks:
              backendRef:
                group: agentgateway.dev
                kind: AgentgatewayBackend
                name: keycloak-jwks
              cacheDuration: 5m
              jwksPath: /realms/downstream-mcp/protocol/openid-connect/certs
            resourceMetadata:
              agentgateway.dev/issuer-proxy: "http://enterprise-agentgateway.agentgateway-system.svc.cluster.local:7777/oauth-issuer"
              resource: "${GATEWAY_URL}/mcp"
              authorizationServers: ["${GATEWAY_URL}/mcp"]
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: downstream-mcp
      namespace: agentgateway-system
    spec:
      parentRefs:
      - name: ${GATEWAY_NAME}
      rules:
      - matches:
        - path:
            type: PathPrefix
            value: /mcp
        - path:
            type: Exact
            value: /.well-known/oauth-protected-resource/mcp
        - path:
            type: Exact
            value: /.well-known/oauth-authorization-server/mcp
        backendRefs:
        - group: enterpriseagentgateway.solo.io
          kind: EnterpriseAgentgatewayBackend
          name: downstream-mcp
    EOF
    SettingDescription
    kind: EnterpriseAgentgatewayBackendThe OAuth issuer registers MCP resources only from an EnterpriseAgentgatewayBackend or an EnterpriseAgentgatewayPolicy. If you use an AgentgatewayBackend, the discovery checks in Step 7 pass, but the login fails at /authorize because the resource is not registered.
    spec.mcp.targetsConnects to the native MCP server. No OpenAPI schema is needed.
    authentication.modeRequires a valid bearer token before allowing MCP requests.
    issuer, audiences, and jwksValidate the token issuer, the explicit agw-issuer audience, and the signature. The audience matches the mapper from brokered setup.
    resourceMetadata.agentgateway.dev/issuer-proxyDeclares that the gateway’s OAuth issuer handles this resource. The proxy retrieves issuer metadata through the controller’s internal address.
    resource and authorizationServersBoth use the public MCP URL, including a non-default port such as 3000. This keeps the discovery issuer consistent with the OAuth callback’s iss value.
    HTTPRoute matchesServe /mcp and both discovery documents so clients can discover authentication before sending MCP traffic.
  2. Confirm that the route resolved its backend reference.

    kubectl -n agentgateway-system get httproute downstream-mcp \
      -o jsonpath='{.status.parents[0].conditions[?(@.type=="ResolvedRefs")].status}'

    Expected output:

    True
    

Step 7: Check authentication discovery

Check that the gateway protects the sample MCP resource and advertises the shared issuer. These checks confirm that the foundation is ready before you continue to a brokered guide.

  1. Send a request without a bearer token, which is expected to fail with a 401 Unauthorized message.

    curl -i "${GATEWAY_URL}/mcp"

    Example output:

    HTTP/1.1 401 Unauthorized
    www-authenticate: Bearer resource_metadata="http://localhost:3000/.well-known/oauth-protected-resource/mcp"
    content-type: application/json
    content-length: 65
    date: Wed, 07 Oct 2026 21:18:40 GMT
    
    {"error":"unauthorized","error_description":"JWT token required"}
  2. Read the protected resource metadata. Both values must identify ${GATEWAY_URL}/mcp.

    curl -fsS "${GATEWAY_URL}/.well-known/oauth-protected-resource/mcp" | jq '{resource, authorization_servers}'

    Example output for the local port-forward:

    {
      "resource": "http://localhost:3000/mcp",
      "authorization_servers": ["http://localhost:3000/mcp"]
    }
  3. Read the authorization server metadata. The issuer must identify ${GATEWAY_URL}/mcp. The endpoint URLs use ${GATEWAY_URL}/oauth-issuer.

    curl -fsS "${GATEWAY_URL}/.well-known/oauth-authorization-server/mcp" | jq '{issuer, authorization_endpoint, token_endpoint, registration_endpoint}'

    Example output for the local port-forward:

    {
      "issuer": "http://localhost:3000/mcp",
      "authorization_endpoint": "http://localhost:3000/oauth-issuer/authorize",
      "token_endpoint": "http://localhost:3000/oauth-issuer/token",
      "registration_endpoint": "http://localhost:3000/oauth-issuer/register"
    }

Optional issuer settings

The same issuer supports downstream-only login and flows with upstream OAuth. The sample resource uses downstream login only, and each guide adds the resource configuration that it needs. For upstream OAuth providers, the consent screen, pushed authorization requests (PAR), client ID metadata documents, and pre-issuance authorization, see the OAuth issuer settings reference.

An agent that already has a downstream token can skip the downstream login and start the upstream authorization directly. The agent sends its token with each MCP request, and the STS selects the flow when no upstream credential is stored. Requiring a bearer token on the issuer route does not select that flow, and the issuer’s browser callbacks must remain reachable. See Agent (upstream-only).

Next steps

Continue with Downstream-only login to sign in through MCP Inspector and call the sample’s Echo tool. For an upstream provider, follow the consent screen guide. For an agent that already has a downstream token, follow Agent (upstream-only).

Clean up shared infrastructure

Keep these resources while another brokered guide uses them. When you finish all brokered examples, remove the issuer configuration before deleting the example IdP and shared routes.

  1. Save the current Helm values, including any changes from other guides.

    helm get values enterprise-agentgateway -n agentgateway-system -o yaml > brokered-cleanup-values.yaml
  2. Edit brokered-cleanup-values.yaml. Remove controller.extraEnv.KGW_OAUTH_ISSUER_CONFIG and restore the tokenExchange.issuer and validator settings that you used before this example. Retain settings that other resources need. Set tokenExchange.enabled to false only if no other feature uses STS.

  3. Apply the updated values and wait for the controller rollout. Use the cleanup file as the only values file so that the brokered overlay does not restore the removed settings.

    helm upgrade -i enterprise-agentgateway oci://us-docker.pkg.dev/solo-public/enterprise-agentgateway/charts/enterprise-agentgateway \
      -n agentgateway-system \
      --version v2026.11.0 \
      -f brokered-cleanup-values.yaml
    kubectl -n agentgateway-system rollout status deployment/enterprise-agentgateway
  4. Delete the sample MCP resource, shared routes, and example IdP.

    kubectl delete httproute downstream-mcp oauth-issuer -n agentgateway-system
    kubectl delete enterpriseagentgatewaybackend downstream-mcp -n agentgateway-system
    kubectl delete agentgatewaybackend oauth-issuer-backend keycloak-jwks -n agentgateway-system
    kubectl delete deployment,service downstream-mcp brokered-keycloak -n agentgateway-system
    kubectl delete configmap brokered-keycloak-realm -n agentgateway-system