Skip to content
Latest (currently 2026.10.2) 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.

Microsoft Entra ID

Verified : Automated tests passed for: End-to-end run: Every step ran in a fresh test environment and the results were checked.
Page as Markdown

Set up OBO token exchange with MS Entra ID.

Set up Microsoft Entra ID on-behalf-of (OBO) token exchange in Solo Enterprise for agentgateway. In this guide, you deploy a simple MCP server that calls the Microsoft Graph GET /me endpoint. You use the MCP Inspector as a client, passing along an Entra user access token. After applying an EnterpriseAgentgatewayPolicy for OBO token exchange, agentgateway exchanges the Entra user access token for a Graph-scoped token.

About

The standard OBO token exchange guide uses the RFC 8693 token exchange specification. Microsoft Entra ID does not support RFC 8693. Instead, Entra uses its own OBO flow with the urn:ietf:params:oauth:grant-type:jwt-bearer grant type.

How Entra OBO differs from RFC 8693

Solo Enterprise for agentgateway supports Entra OBO as a dedicated code path. To understand the key differences, review the following table.

AspectRFC 8693 OBOEntra OBO
Grant typeurn:ietf:params:oauth:grant-type:token-exchangeurn:ietf:params:oauth:grant-type:jwt-bearer
EnterpriseAgentgatewayPolicy fieldspec.backend.tokenExchangespec.backend.tokenExchange.entra
Path that the gateway calls on the STS/oauth2/token/exchange/oauth2/token
API validatorNot requiredRequired (remote, Entra JWKS URL)
ElicitationCan be configuredDisabled

Diagram of an exchange

Review the following diagram for an example sequence of token exchange with Microsoft Entra ID. In this guide, the MCP server calls Microsoft Graph GET /me on behalf of the signed-in user.

    sequenceDiagram
    participant Client as MCP Client
    participant Gateway
    participant STS as Gateway STS
    participant Entra as Microsoft Entra ID
    participant MCP as MCP Server
    participant Graph as Microsoft Graph

    Client->>Gateway: MCP request + user access token<br/>(middle-tier audience)
    Gateway->>STS: Exchange token (OBO)
    STS->>Entra: POST /{tenantId}/oauth2/v2.0/token<br/>grant_type=jwt-bearer<br/>+ client credentials + scope
    Entra-->>STS: Access token<br/>(Graph API scope)
    STS-->>Gateway: Exchanged token
    Gateway->>MCP: MCP request + exchanged token
    MCP->>Graph: GET /me + exchanged token
    Graph-->>MCP: User profile
    MCP-->>Client: Graph /me response
  
  1. The MCP client sends a request with the user’s Entra access token. The token’s audience (aud) is the middle-tier app registration, not the Microsoft Graph API.
  2. The gateway’s internal STS validates the JWT and exchanges it with Entra’s token endpoint by using the OBO flow.
  3. Entra returns an access token scoped to the Microsoft Graph API (https://graph.microsoft.com/User.Read).
  4. The gateway forwards the MCP request to the MCP server with the exchanged token.
  5. The MCP server calls Microsoft Graph GET /me with the exchanged token and returns the signed-in user’s profile.

Before you begin

Set up an agentgateway proxy.

Step 1: Set up MS Entra ID

Set up MS Entra ID to use as an identity provider. For more information, see the MS Entra ID as an IdP guide.

  1. Register an app in Entra ID and make sure to create a client secret. Note the following values.

    echo $ENTRA_TENANT_ID
    echo $ENTRA_CLIENT_ID
    echo $ENTRA_CLIENT_SECRET
  2. In the app registration, go to Authentication > Add a platform > Web and add http://localhost as a redirect URI. This redirect URI is needed to complete the consent flow later in this guide.

  3. In the app registration, go to API permissions > Add a permission > Microsoft Graph > Delegated permissions and add the User.Read permission.

  4. Grant consent for the User.Read permission. The steps vary if you are an administrator or user.

    If you have the Global Administrator or Privileged Role Administrator role:

    1. From the API permissions page for your app, click Grant admin consent for ${TENANT}.
    2. Verify that the Status column has a green checkmark.

    As a user, complete the interactive user consent flow.

    1. Open the following URL in a browser, replacing ${ENTRA_TENANT_ID} and ${ENTRA_CLIENT_ID} with your values.

      https://login.microsoftonline.com/${ENTRA_TENANT_ID}/oauth2/v2.0/authorize?client_id=${ENTRA_CLIENT_ID}&response_type=code&redirect_uri=http://localhost&scope=https://graph.microsoft.com/User.Read&prompt=consent
    2. Sign in and accept the permissions.

    You are redirected to http://localhost with a code parameter. The page shows a “site can’t be reached” error because no local server is listening. This is expected. The consent was granted when you signed in.

Step 2: Create the Entra OBO client secret

Create a Kubernetes secret with the app’s client secret. The OBO policy references this secret when it calls Entra’s token endpoint.

kubectl create secret generic entra-obo-client-secret \
  --namespace agentgateway-system \
  --from-literal=client_secret="${ENTRA_CLIENT_SECRET}"

Step 3: Configure token exchange

Configure the Solo Enterprise for agentgateway Helm values to enable the STS with Entra-specific validators.

  1. Get your existing or create a Helm values file.

    helm get values enterprise-agentgateway -n agentgateway-system -o yaml > values.yaml
  2. Add the following gateway parameters and token exchange configuration to the Helm values file. Unlike the RFC 8693 OBO configuration, Entra OBO requires an apiValidator and disables elicitation.

    gatewayClassParametersRefs:
      enterprise-agentgateway:
        group: enterpriseagentgateway.solo.io
        kind: EnterpriseAgentgatewayParameters
        name: agentgateway-params
        namespace: agentgateway-system
    tokenExchange:
      enabled: true
      issuer: "enterprise-agentgateway.agentgateway-system.svc.cluster.local:7777"
      tokenExpiration: 24h
      subjectValidator:
        validatorType: remote
        remoteConfig:
          url: "https://login.microsoftonline.com/${ENTRA_TENANT_ID}/discovery/v2.0/keys"
      apiValidator:
        validatorType: remote
        remoteConfig:
          url: "https://login.microsoftonline.com/${ENTRA_TENANT_ID}/discovery/v2.0/keys"
      actorValidator:
        validatorType: k8s
      elicitation:
        secretName: ""
    Review the following table to understand this configuration.
    SettingDescription
    gatewayClassParametersRefsBinds the enterprise-agentgateway GatewayClass to the EnterpriseAgentgatewayParameters resource that you create in Step 4. Any Gateway that uses this GatewayClass automatically picks up the STS connection details from the parameters.
    tokenExchange.enabledEnable the security token service (STS).
    tokenExchange.issuerThe issuer of the STS, typically the control plane service address on port 7777.
    tokenExchange.tokenExpirationThe expiration time of the STS token, such as 24h.
    subjectValidatorValidates the user’s incoming JWT. Set to remote with the Entra JWKS discovery URL for your tenant.
    apiValidatorRequired for Entra OBO. Validates the API token. Set to the same Entra JWKS discovery URL.
    actorValidatorValidates the agent (actor) token. Set to k8s to use Kubernetes service account tokens.
    elicitation.secretNameSet to an empty string to disable elicitation. Elicitation is not used in the Entra OBO flow.
  3. Install or upgrade Solo Enterprise for agentgateway with the token exchange configuration.

    helm upgrade -i enterprise-agentgateway oci://us-docker.pkg.dev/solo-public/enterprise-agentgateway/charts/enterprise-agentgateway \
      -n agentgateway-system \
      --create-namespace \
      --version v2026.10.2 \
      -f values.yaml
  4. Verify that Solo Enterprise for agentgateway is running and that the control plane service has port 7777 for the STS.

    kubectl get deploy -n agentgateway-system enterprise-agentgateway
    kubectl get svc -n agentgateway-system enterprise-agentgateway

    Example output:

    NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
    enterprise-agentgateway      1/1     1            1           2m
    
    NAME                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
    enterprise-agentgateway   ClusterIP   10.96.195.136   <none>        9978/TCP,9093/TCP,7777/TCP   2m
    

Step 4: Create the gateway parameters

Create the EnterpriseAgentgatewayParameters resource that configures the gateway data plane with the STS connection details. The gatewayClassParametersRefs in the Helm values from Step 3 binds this resource to the enterprise-agentgateway GatewayClass. The existing Gateway from the prerequisites uses this GatewayClass, so it automatically picks up these parameters.

kubectl apply -f- <<EOF
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayParameters
metadata:
  name: agentgateway-params
  namespace: agentgateway-system
spec:
  env:
    - name: STS_URI
      value: http://enterprise-agentgateway.agentgateway-system.svc.cluster.local:7777/oauth2/token
    - name: STS_AUTH_TOKEN
      value: /var/run/secrets/xds-tokens/xds-token
  logging:
    level: info
  rawConfig:
    config:
      logging:
        fields:
          add:
            rq.headers: 'flatten(request.headers)'
            jwt: 'jwt'
        format: json
EOF
Review the following table to understand this configuration.
SettingDescription
STS_URIThe full URL of the STS token endpoint. For Entra OBO, the STS_URI path must be /oauth2/token, not the RFC 8693 /oauth2/token/exchange URL.
STS_AUTH_TOKENThe path to the service account token that the data plane uses to authenticate with the STS.
rawConfig.config.loggingAdds structured logging fields so you can inspect the Authorization header sent to the backend after the OBO exchange, and the validated JWT claims from the incoming token. You can verify the configuration by checking the ConfigMap for the proxy after creating the Gateway: kubectl get configmap agentgateway-proxy -n agentgateway-system -o yaml.

Step 5: Create the JWKS backend

Create the Entra JWKS backend for token validation, as described in MS Entra ID as an IdP.

kubectl apply -f- <<EOF
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
  name: entra-jwks
  namespace: agentgateway-system
spec:
  static:
    host: login.microsoftonline.com
    port: 443
  policies:
    tls: {}
EOF

Step 6: Deploy the Graph /me MCP server

Deploy a minimal MCP server that exposes a graph_me tool. This tool calls Microsoft Graph GET /me by using the bearer token that the gateway attaches after the OBO exchange. The MCP server implements the Streamable HTTP transport (JSON-RPC over HTTP POST on /mcp).

  1. Save the MCP server code to a server.py file. The server uses only the Python standard library, so it runs on the public Python image without a build step.

    cat > server.py <<'EOF'
    """Minimal MCP server that exposes a 'graph_me' tool.
    
    The tool calls Microsoft Graph GET /me using the bearer token that the
    gateway attached after the Entra OBO token exchange.
    
    Implements MCP Streamable HTTP transport (JSON-RPC over HTTP POST on /mcp).
    
    Flow:
      MCP client -(Entra token)-> gateway -(OBO exchange)-> this server -(Graph token)-> Graph /me
    """
    
    import http.server
    import json
    import urllib.request
    import urllib.error
    import os
    import uuid
    
    GRAPH_ME_URL = "https://graph.microsoft.com/v1.0/me"
    PORT = int(os.environ.get("PORT", "8080"))
    
    # MCP protocol version
    MCP_PROTOCOL_VERSION = "2025-03-26"
    
    # Server info
    SERVER_INFO = {
        "name": "graph-me-tool",
        "version": "0.1.0",
    }
    
    # Tool definition
    GRAPH_ME_TOOL = {
        "name": "graph_me",
        "description": "Calls Microsoft Graph GET /me and returns the signed-in user's profile. "
                       "Requires a valid Microsoft Graph access token (provided via OBO token exchange).",
        "inputSchema": {
            "type": "object",
            "properties": {},
            "additionalProperties": False,
        },
    }
    
    
    def call_graph_me(auth_header):
        """Call Graph /me with the provided Authorization header."""
        req = urllib.request.Request(GRAPH_ME_URL, headers={"Authorization": auth_header})
        try:
            with urllib.request.urlopen(req) as resp:
                return json.loads(resp.read())
        except urllib.error.HTTPError as e:
            error_body = e.read().decode("utf-8", errors="replace")
            return {"error": f"Graph API returned {e.code}", "detail": error_body}
    
    
    def handle_jsonrpc(request, auth_header):
        """Route a JSON-RPC request to the appropriate MCP handler."""
        method = request.get("method")
        req_id = request.get("id")
    
        if method == "initialize":
            return jsonrpc_result(req_id, {
                "protocolVersion": MCP_PROTOCOL_VERSION,
                "capabilities": {"tools": {}},
                "serverInfo": SERVER_INFO,
            })
    
        if method == "notifications/initialized":
            # Notification, no response needed
            return None
    
        if method == "tools/list":
            return jsonrpc_result(req_id, {"tools": [GRAPH_ME_TOOL]})
    
        if method == "tools/call":
            tool_name = request.get("params", {}).get("name")
            if tool_name != "graph_me":
                return jsonrpc_error(req_id, -32602, f"Unknown tool: {tool_name}")
    
            result = call_graph_me(auth_header)
            return jsonrpc_result(req_id, {
                "content": [{"type": "text", "text": json.dumps(result, indent=2)}],
            })
    
        if method == "ping":
            return jsonrpc_result(req_id, {})
    
        return jsonrpc_error(req_id, -32601, f"Method not found: {method}")
    
    
    def jsonrpc_result(req_id, result):
        return {"jsonrpc": "2.0", "id": req_id, "result": result}
    
    
    def jsonrpc_error(req_id, code, message):
        return {"jsonrpc": "2.0", "id": req_id, "error": {"code": code, "message": message}}
    
    
    class MCPHandler(http.server.BaseHTTPRequestHandler):
        def do_GET(self):
            if self.path == "/healthz":
                self._respond(200, {"status": "ok"})
                return
            self._respond(404, {"error": "not found"})
    
        def do_POST(self):
            if self.path != "/mcp":
                self._respond(404, {"error": "not found"})
                return
    
            content_length = int(self.headers.get("Content-Length", 0))
            body = self.rfile.read(content_length)
    
            try:
                request = json.loads(body)
            except json.JSONDecodeError:
                self._respond(400, jsonrpc_error(None, -32700, "Parse error"))
                return
    
            auth_header = self.headers.get("Authorization", "")
            response = handle_jsonrpc(request, auth_header)
    
            if response is None:
                # Notification: return 204 No Content
                self.send_response(204)
                self.end_headers()
                return
    
            self._respond(200, response)
    
        def do_DELETE(self):
            # Session teardown: acknowledge
            if self.path == "/mcp":
                self.send_response(204)
                self.end_headers()
                return
            self._respond(404, {"error": "not found"})
    
        def _respond(self, status, body):
            payload = json.dumps(body).encode()
            self.send_response(status)
            self.send_header("Content-Type", "application/json")
            self.send_header("Content-Length", str(len(payload)))
            self.end_headers()
            self.wfile.write(payload)
    
    
    if __name__ == "__main__":
        server = http.server.HTTPServer(("0.0.0.0", PORT), MCPHandler)
        print(f"graph-me-tool MCP server listening on :{PORT}/mcp")
        server.serve_forever()
    EOF
  2. Store the server code in a ConfigMap.

    kubectl create configmap graph-me-tool --from-file=server.py -n agentgateway-system
  3. Create the Kubernetes Service and Deployment for the MCP server. The Deployment runs the public python:3.12-slim image and mounts the server code from the ConfigMap.

    kubectl apply -f- <<EOF
    apiVersion: v1
    kind: Service
    metadata:
      name: graph-me-tool
      namespace: agentgateway-system
    spec:
      selector:
        app: graph-me-tool
      ports:
        - port: 8080
          targetPort: 8080
          appProtocol: agentgateway.dev/mcp
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: graph-me-tool
      namespace: agentgateway-system
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: graph-me-tool
      template:
        metadata:
          labels:
            app: graph-me-tool
        spec:
          containers:
            - name: graph-me-tool
              image: python:3.12-slim
              command: ["python", "/app/server.py"]
              ports:
                - containerPort: 8080
              readinessProbe:
                httpGet:
                  path: /healthz
                  port: 8080
                initialDelaySeconds: 2
                periodSeconds: 5
              volumeMounts:
                - name: server-code
                  mountPath: /app
          volumes:
            - name: server-code
              configMap:
                name: graph-me-tool
    EOF
  4. Verify that the MCP server pod is running and ready.

    kubectl get pods -n agentgateway-system -l app=graph-me-tool

    Example output:

    NAME                             READY   STATUS    RESTARTS   AGE
    graph-me-tool-6b8f9c4d7f-x2k9p  1/1     Running   0          30s
    
  5. Create the EnterpriseAgentgatewayBackend and HTTPRoute to expose the MCP server through the gateway.

    kubectl apply -f- <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayBackend
    metadata:
      name: graph-me-mcp
      namespace: agentgateway-system
    spec:
      mcp:
        targets:
          - name: graph-me
            static:
              host: graph-me-tool.agentgateway-system.svc.cluster.local
              port: 8080
              path: /mcp
              protocol: StreamableHTTP
    ---
    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: graph-me-mcp
      namespace: agentgateway-system
    spec:
      parentRefs:
        - name: agentgateway-proxy
      rules:
        - matches:
            - path:
                type: Exact
                value: /graph-me/mcp
          backendRefs:
            - name: graph-me-mcp
              group: enterpriseagentgateway.solo.io
              kind: EnterpriseAgentgatewayBackend
    EOF

Step 7: Test without the OBO policy

Before you apply the OBO policy, verify that the MCP server cannot call Microsoft Graph without token exchange. This step proves that the user’s original access token (which has a middle-tier audience) is not valid for calling the Graph API.

  1. Get a user access token from Entra ID for the middle-tier app. You can use the Azure CLI or any OIDC client.

    az login --tenant "${ENTRA_TENANT_ID}" --scope "api://${ENTRA_CLIENT_ID}/.default"
    
    export USER_TOKEN=$(az account get-access-token \
      --tenant "${ENTRA_TENANT_ID}" \
      --resource "api://${ENTRA_CLIENT_ID}" \
      --query accessToken -o tsv)
    
    echo $USER_TOKEN
  2. Port-forward the gateway proxy.

    kubectl -n agentgateway-system port-forward svc/agentgateway-proxy 8080:80
  3. Open MCP Inspector in a separate terminal.

    npx @modelcontextprotocol/inspector#0.21.2
  4. In MCP Inspector, configure the connection.

    • Transport Type: Streamable HTTP
    • URL: http://localhost:8080/graph-me/mcp
    • In the Headers section, add an Authorization header with the value Bearer <$USER_TOKEN>, replacing <$USER_TOKEN> with the token from step 1.
  5. Click Connect, then go to the Tools tab and click List Tools. You see the graph_me tool.

  6. Click Run Tool.

    Without the OBO policy, the MCP server receives the user’s original token (or no token at all), which is not valid for calling the Graph API. The tool returns an error:

    {
      "error": "Graph API returned 401",
      "detail": "{\"error\":{\"code\":\"InvalidAuthenticationToken\",\"message\":\"Access token is empty.\",\"innerError\":{\"date\":\"2026-04-02T15:40:45\",\"request-id\":\"dae02bb6-d68c-45f3-b353-ab0eaa8fc553\",\"client-request-id\":\"dae02bb6-d68c-45f3-b353-ab0eaa8fc553\"}}}"
    }

    This error confirms that the MCP server needs a Graph-scoped token that only the OBO exchange can provide.

Step 8: Apply the OBO policy

Apply the OBO token exchange policy to the MCP backend. This policy tells the gateway to exchange the user’s Entra token for a Microsoft Graph API token by using the Entra OBO flow.

kubectl apply -f- <<EOF
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayPolicy
metadata:
  name: entra-obo-policy
  namespace: agentgateway-system
spec:
  targetRefs:
    - group: enterpriseagentgateway.solo.io
      kind: EnterpriseAgentgatewayBackend
      name: graph-me-mcp
  backend:
    tokenExchange:
      mode: ExchangeOnly
      entra:
        tenantId: "${ENTRA_TENANT_ID}"
        clientId: "${ENTRA_CLIENT_ID}"
        scope: "https://graph.microsoft.com/User.Read"
        clientSecretRef:
          name: entra-obo-client-secret
          key: client_secret
EOF
Review the following table to understand this configuration.
SettingDescription
targetRefsTarget the MCP backend that needs the exchanged token. The policy applies to all requests forwarded to this backend.
modeSet to ExchangeOnly to perform token exchange without elicitation.
entra.tenantIdYour Entra tenant ID, as a GUID. The policy rejects a domain name such as contoso.onmicrosoft.com, and it rejects the common alias.
entra.clientIdThe app registration’s client ID. This must match the audience of the incoming user token.
entra.scopeThe Microsoft Graph API scope to request. User.Read allows the MCP server to call GET /me.
entra.clientSecretRefReference to the Kubernetes secret that contains the app’s client secret.

Step 9: Test the Entra OBO flow

With the OBO policy applied, the gateway now exchanges the user’s token for a Graph-scoped token before forwarding the request to the MCP server.

  1. In MCP Inspector, reconnect to the gateway by using the same settings from Step 7. Make sure the Authorization header still includes a valid user token. If your previous token expired, get a new one.

  2. Go to the Tools tab, click List Tools, and click Run Tool on the graph_me tool.

    With the OBO policy applied, the gateway exchanges the user’s token for a Microsoft Graph token. The MCP server calls Graph GET /me with the exchanged token and returns your profile:

    {
      "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
      "businessPhones": [],
      "displayName": "First Last",
      "givenName": "First",
      "jobTitle": null,
      "mail": null,
      "mobilePhone": null,
      "officeLocation": null,
      "preferredLanguage": null,
      "surname": "Last",
      "userPrincipalName": "first.last@example.com",
      "id": "12345ab1-1234-123a-1a23-12345678ab12"
    }

    This response confirms that the Entra OBO token exchange is working. The user’s original token had the audience api://${ENTRA_CLIENT_ID} (the middle-tier app), but the gateway exchanged it for a token with the audience https://graph.microsoft.com, which is what the Graph API requires.

  3. Check the controller and data plane logs to confirm the token exchange policies are active.

    kubectl logs -n agentgateway-system deploy/enterprise-agentgateway --tail=50 | grep -i "token\|exchange\|entra\|obo"
    kubectl logs -n agentgateway-system -l app.kubernetes.io/name=agentgateway-proxy --tail=50

    In the controller logs, verify that the OBO policy was pushed to the data plane.

    "cause":"policy/agw-enterprise-policy/agentgateway-system/entra-obo-policy/graph-me-mcp:enterprise-token-exchange"
    

    The entra-obo-policy:enterprise-token-exchange entry confirms that the OBO token exchange policy is applied to the graph-me-mcp backend.

    In the data plane logs, verify that the STS is configured and that MCP requests succeed with a validated JWT subject.

    tokenExchange:
      stsUri: http://enterprise-agentgateway.agentgateway-system.svc.cluster.local:7777/oauth2/token
    
    {"level":"info","scope":"request","route":"agentgateway-system/graph-me-mcp","http.method":"POST","http.path":"/graph-me/mcp","http.status":200,"jwt.sub":"123456_abcdefg_1234_abcd","protocol":"mcp","mcp.method.name":"tools/call","mcp.target":"graph-me","jwt":{"aud":"api://${ENTRA_CLIENT_ID}","iss":"https://sts.windows.net/${ENTRA_TENANT_ID}/","name":"First Last","upn":"first.last@example.com"}}
    • stsUri confirms the STS endpoint is configured for Entra OBO (/oauth2/token, not the RFC 8693 /oauth2/token/exchange path).
    • jwt.sub in the request log confirms the Entra user’s JWT was validated and the subject claim was extracted.
    • jwt.aud shows the audience of the incoming user token (api://${ENTRA_CLIENT_ID}). The fact that Graph returned a 200 response proves the token was exchanged, because Graph requires a token with audience https://graph.microsoft.com.
    • protocol: mcp and mcp.method.name: tools/call confirm the request was processed as an MCP tool call.

Troubleshooting

SymptomWhat to check
MCP Inspector connection errorVerify that the gateway proxy is port-forwarded and the URL and path match the HTTPRoute (/graph-me/mcp). Check that the Authorization header includes a valid, non-expired Entra token.
Token exchange fails (invalid_grant)Check controller logs. Common causes: the aud of the incoming token does not match the clientId in the OBO policy, missing consent for the Graph User.Read scope, or wrong client secret.
AADSTS65001 (consent not granted)The user or admin has not consented to the required permissions. Complete the interactive consent flow or ask an admin to grant consent in the Azure portal.
Graph returns InvalidAuthenticationTokenThe token sent to Graph has the wrong audience. Verify the OBO policy scope is https://graph.microsoft.com/User.Read. If the policy is not applied, the MCP server receives the original user token instead of the exchanged token.
No token exchange (MCP server gets no token)The OBO policy must target the same EnterpriseAgentgatewayBackend as the route’s backendRef. Verify that backend.tokenExchange.entra and clientSecretRef are configured and the secret exists.
Wrong STS pathThe STS_URI in gateway parameters must use /oauth2/token, not /oauth2/token/exchange.
No data plane podVerify the Gateway resource is accepted and programmed. Check that the EnterpriseAgentgatewayParameters resource name matches the gatewayClassParametersRefs in Helm values. See the controller logs for errors.

Cleanup

You can optionally remove the resources that you set up as part of this guide.
kubectl delete enterpriseagentgatewaypolicy entra-obo-policy -n agentgateway-system
kubectl delete httproute graph-me-mcp -n agentgateway-system
kubectl delete enterpriseagentgatewaybackend graph-me-mcp -n agentgateway-system
kubectl delete deploy graph-me-tool -n agentgateway-system
kubectl delete svc graph-me-tool -n agentgateway-system
kubectl delete configmap graph-me-tool -n agentgateway-system
kubectl delete agentgatewaybackend entra-jwks -n agentgateway-system
kubectl delete enterpriseagentgatewayparameters agentgateway-params -n agentgateway-system
kubectl delete secret entra-obo-client-secret -n agentgateway-system