This tutorial is grounded in the iag-mcp-demo reference application, running its canbank usecase provisioned with the instant-stack app. It puts the IndyKite Agent Gateway (IAG) in MCP proxy mode (protected_agent.protocol: mcp) in front of an MCP server - and proves the mode is downstream-agnostic by protecting a Google Drive MCP server that has nothing to do with IndyKite. Users log in at an external identity provider (IdP), which also introspects tokens and performs the OAuth 2.0 token exchange (RFC 8693) that gives every gateway its delegation token; the demo uses Curity, and any IdP with those endpoints fits. Every request is authorized against the Identity Knowledge Graph (IKG) before it is forwarded: who the caller is, which workflow they may trigger, and through which chain of agents. And because that authorization is graph data, it changes live: a denied request is remediated with one AuthZEN-guarded click, explained with a why? graph, and revoked again. The closing chapter shows the same recipe carried further - a Postgres-backed ERP whose rows are pre-filtered by AuthZEN search/resource, and a CRM agent that files Salesforce cases on behalf of the delegated user.
The whole demo, every agent, gateway and external service and the numbered request flow between them, is drawn and explained in the Agent Gateway architecture guide. Read it first if you want the map before the route.
External token exchange or Token Service? In this tutorial the delegation tokens come from your identity provider's token exchange. If your provider has no token exchange, or you want the delegation tokens issued by a service you run, follow Follow a delegation chain across agents: Agent Gateway with the IndyKite Token Service instead; its first chapter compares the two.
What you will have at the end
- A clear mental model of what IAG's MCP proxy mode does and does not do (session pass-through, SSE streaming, header handling, per-request authorization).
- A Google Drive MCP server running as a container: the reference stdio server wrapped into MCP Streamable HTTP.
- A
Workflownode (external_id=wf-drive), anAgentnode (indykiteagent-drive), and theCAN_TRIGGER/INVOKESrelationships in the IKG. - The admission KBAC policy that lets a user reach the Drive server only when a workflow they can trigger has exactly the request's delegation chain as its path of agents, and the Token Introspect configurations that tell IndyKite which tokens of your IdP to accept.
- A dedicated gateway instance,
drive-mcp-iag, proxying MCP traffic on port8887. - A full-text Google Drive search executed through the gateway as an authorized user - and the same call denied with
403for everyone else, with matching audit records. - The deny → remediate → allow loop: a denied user's red audit card grants Drive access with one AuthZEN-guarded click (writing
CAN_TRIGGERrelationships via the Capture API), a why? card renders the authorization path live from the graph, and a revoke resets the world. - A view of where the recipe leads: the ERP profile (a Postgres-backed MCP server whose rows are pre-filtered per caller by AuthZEN search/resource) and the CRM profile (a gateway-protected agent filing Salesforce cases on behalf of the delegated user).
Prerequisites
- An IndyKite project with AuthZEN/KBAC and ContX IQ enabled, provisioned with the canbank dataset via the instant-stack app (
DATASET=canbank) or, request by request, with the demo's Bruno collection (bruno/iag-demo) - chapter 5 explains the parts of that dataset this tutorial relies on. - An external OAuth 2.0 IdP with a token introspection endpoint, the client credentials grant, and token exchange (RFC 8693). It holds the demo's clients -
consolefor the chatbot login and one machine-to-machine client per gateway (indykiteagent,indykiteagent-2to-4,indykiteagent-mcp, andindykiteagent-drivefor this tutorial) - andmillicentas a login user (chapter 7 logs in as her). - Docker and Docker Compose v2, plus a Google account for chapter 3. The gateways run the
indykite/agent-gatewayimage with a platform release tag from IndyKite on Docker Hub. - The base iag-mcp-demo configured per the repo README with the canbank usecase active - this tutorial adds the Drive pieces on top and bootstraps the usecase env file (
.env.canbank) in chapter 7.
Who this tutorial is for
- Developers exposing MCP servers to AI agents who need token introspection, authorization, and audit in front of them - without changing the MCP server itself.
- Platform and security engineers who want the same enforcement point for MCP tool calls as for A2A agent calls.
- AI agents consuming this doc as a runbook - every chapter uses explicit service names, ports, file paths, and commands.
Demo topology at a glance
The iag-mcp-demo is usecase-driven: the agents, gateways, and compose topology are domain-agnostic, and a usecase bundle (usecases/canbank/ - domain vocabulary, per-agent skills, demo script) plus a matching provisioned IndyKite project make it "the CanBank demo". Activate it with ./switch-usecase.sh canbank. This tutorial focuses on the services below; the Google Drive pair only starts when the drive compose profile is enabled.
| Service | Role | Port |
chatbot |
Web UI; users log in here, and the demo scripts reuse its session token. | 3000 |
mcp-iag |
IAG in MCP proxy mode in front of the IndyKite MCP server. | 8886 |
drive-mcp-iag |
IAG in MCP proxy mode in front of the Google Drive MCP server (profile drive). |
8887 |
drive-mcp |
Google Drive MCP server: stdio reference server wrapped into Streamable HTTP (profile drive). |
8000 |
erp-mcp-iag |
IAG in MCP proxy mode in front of the ERP MCP server (profile erp; chapter 8's "Beyond Drive" section). |
8889 |
erp-mcp + erp-db |
Postgres-backed ERP MCP server and its database (profile erp). Deliberately not published to the host - only the gateway reaches them. |
internal only |
analyst-iag |
IAG in front of the analyst agent (used by the optional analyst path in chapter 7). | 8885 |
analyst |
A2A data analyst agent; can use both the IndyKite and the Drive MCP backends. | 6005 |