Apigee X AI Gateway
Enables using Google Cloud Apigee X as an AI gateway to govern MCP tool calls, transcode JSON-RPC to REST, and invoke protected Cloud Run/Firestore backends with Google IAM authentication.
Integrates with Keycloak as an OAuth 2.0/OIDC identity provider, validating JWT tokens and enforcing user scopes for MCP tool invocations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Apigee X AI Gatewayorder a large latte for my account"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Apigee X AI Gateway: Biscuit Coffee Shop Agent Demo
Enterprise Security, 3-Legged OAuth 2.0, MCP Protocol Transcoding & Zero-Trust Governance for GenAI Agents
š” Enterprise AI Gateway Reference Architecture
This repository demonstrates how enterprises use Google Cloud Apigee X as an AI Gateway to manage, secure, monitor, and govern Model Context Protocol (MCP) tool calling by autonomous GenAI agents built with the Google Agent Development Kit (ADK) and powered by Gemini 2.5 Flash.
It features 3-legged OAuth 2.0 / OIDC identity propagation (Keycloak), JSON-RPC to REST MCP protocol transcoding (ParsePayload), granular Role-Based Access Control (RBAC), and a zero-trust Cloud Run backend architecture.
šÆ Intention & Business Problem
As enterprises deploy autonomous Generative AI agents into operational environments, granting Large Language Models (LLMs) direct access to internal APIs and databases presents critical security, operational, and architectural risks:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā THE AI AGENT GOVERNANCE CHALLENGE ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā UNSECURED ARCHITECTURE: Direct Tool Access
āāāāāāāāāāāāāāāā Direct Machine Token āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā AI Agent / ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāā> ā Internal Microservices ā
ā LLM Runtime ā "Confused Deputy" Attack ā & Customer Databases ā
āāāāāāāāāāāāāāāā No User Context / No RBAC āāāāāāāāāāāāāāāāāāāāāāāāāāā
⢠Overprivileged machine service account.
⢠The agent cannot distinguish Customer actions from Store Manager actions.
⢠Zero audit trail linking the end-user identity to database modifications.
⢠Disconnected protocols: LLMs speak MCP (JSON-RPC 2.0), backends speak REST.
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
SECURED ARCHITECTURE: Apigee X AI Gateway
āāāāāāāāāāāāāāāā OAuth 2.0 JWT (User Scopes) āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā AI Agent / ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā> ā Apigee X AI Gateway ā
ā LLM Runtime ā + MCP JSON-RPC 2.0 ā ā
āāāāāāāāāāāāāāāā āāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā Transcoded REST
ā + Google IAM Token
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Protected Cloud Run ā
ā Backend & Firestore ā
āāāāāāāāāāāāāāāāāāāāāāāāāāā
⢠3-Legged OAuth 2.0: Agent acts strictly on behalf of the logged-in user.
⢠Perimeter RBAC: Apigee validates JWT scopes BEFORE invoking backend logic.
⢠Protocol Transcoding: Native 'ParsePayload' policy bridges MCP to REST.
⢠Zero-Trust Isolation: Backend is completely private, requiring IAM authentication.Key Architectural Capabilities Demonstrated
Protocol Transcoding (
ParsePayloadPolicy):AI Agents discover and execute tools using the standard Model Context Protocol (MCP) via JSON-RPC 2.0 requests over HTTP.
Rather than re-architecting legacy REST microservices into dedicated MCP servers, Apigee X intercepts the JSON-RPC payloads, extracts the tool arguments, and proxies them to standard REST/OpenAPI endpoints with zero backend code modifications.
User Identity Propagation (3-Legged OAuth 2.0):
Prevents the "Confused Deputy" vulnerability. Instead of using a static backend API key, the agent receives an OAuth 2.0 Bearer JWT issued by Keycloak during user login.
Every MCP tool invocation carries the authenticated user's token, allowing Apigee to enforce user-specific authorizations.
Granular Role-Based Access Control (RBAC):
Apigee X acts as the security boundary: It verifies the JWT signature against Keycloak's JWKS endpoint (
certs) and enforces conditional scope checks (RF-Invalid-Scope) at the API Gateway level.A prompt injection or malicious prompt trying to access internal employee records is blocked by Apigee with HTTP 403 Forbidden, never touching the Cloud Run backend.
Zero-Trust Backend Isolation:
The backend Cloud Run service accepts requests only when accompanied by a signed Google Cloud IAM Identity Token minted by Apigee. Direct public access to backend APIs is strictly denied.
Related MCP server: Nervora
šļø High-Level Architecture
End-to-End Architectural Flow
sequenceDiagram
autonumber
actor User as User (Public / Customer / Manager)
participant UI as Coffee Shop Web UI
participant KC as Keycloak IdP (OAuth 2.0)
participant ADK as Google ADK Agent (Gemini 2.5)
participant GW as Apigee X AI Gateway
participant CR as Backend (Cloud Run + Firestore)
%% Scenario 1: Public
rect rgb(240, 248, 255)
Note over User,CR: Flow 1: Public / Unauthenticated Inquiry
User->>UI: "What's on the menu and what are your opening hours?"
UI->>ADK: Sends prompt (Guest Session)
ADK->>GW: POST /mcp (JSON-RPC 2.0: mcp_proxy_getMenu)
GW->>GW: PP-ParseMCPTools + VerifyApiKey
GW->>CR: GET /biscuit-coffee/menu
CR-->>GW: 200 OK (Menu JSON)
GW-->>ADK: JSON-RPC Result
ADK-->>UI: "Here is our coffee menu..."
end
%% Scenario 2: 3-Legged Auth
rect rgb(255, 250, 240)
Note over User,CR: Flow 2: 3-Legged OAuth 2.0 Authentication
User->>UI: Clicks "Login as Customer" (or Store Manager)
UI->>KC: OAuth 2.0 Authorization Code Flow
KC-->>UI: Signed JWT Token (Claims: email, biscuit_coffee_customer scope)
UI->>ADK: Stores token in agent session state
end
%% Scenario 3: RBAC Scope Enforcement
rect rgb(255, 240, 245)
Note over User,CR: Flow 3: RBAC Enforcement & Threat Interception
User->>UI: "Can you list all store employees and their staff IDs?"
UI->>ADK: Forward prompt with Customer Bearer Token
ADK->>GW: POST /mcp (mcp_proxy_listEmployees) + Bearer Customer Token
GW->>GW: JWT-VerifyToken (Validates RS256 signature with Keycloak JWKS)
GW->>GW: Evaluate Scope: biscuit_coffee_manager required
alt Customer Token (Lacks Manager Scope)
GW-->>ADK: HTTP 403 Forbidden (RF-Invalid-Scope)
ADK-->>UI: "I'm sorry, viewing employee records requires Store Manager permissions."
else Store Manager Token (Contains Manager Scope)
GW->>CR: GET /biscuit-coffee/employees + Google IAM Auth
CR-->>GW: 200 OK (Employee Roster)
GW-->>ADK: JSON-RPC Result
ADK-->>UI: "Here is the staff directory for Biscuit Coffee..."
end
endš„ User Personas & Role Security Matrix
The architecture defines three distinct user tiers enforced deterministically at the Apigee Gateway perimeter:
Operation / Feature | Backend Path & HTTP Verb | Public Guest | Logged-in Customer ( | Logged-in Store Manager ( | Apigee Security Enforcement Policy |
OAuth 2.0 Scope | JWT Claims | None |
|
| Keycloak OpenID Connect Realm |
Browse Menu & Pricing |
| ā Allowed | ā Allowed | ā Allowed | Public Ingress Flow ( |
Store Hours & Location |
| ā Allowed | ā Allowed | ā Allowed | Public Ingress Flow ( |
Check Rewards Balance |
| ā Login Required | ā Allowed | ā Allowed |
|
Sign Up for Rewards |
| ā Login Required | ā Allowed | ā Allowed |
|
Place New Order |
| ā Login Required | ā Allowed | ā Allowed |
|
Track Order Status |
| ā Login Required | ā Allowed | ā Allowed |
|
Cancel Active Order |
| ā Login Required | ā Allowed | ā Allowed |
|
List Store Employees |
| ā BLOCKED | ā BLOCKED (403 Forbidden) | ā Allowed (200 OK) |
|
View Staff IDs & Emails |
| ā BLOCKED | ā BLOCKED (403 Forbidden) | ā Allowed (200 OK) | Apigee Scope & Payload Protection |
Modify Gateway Infrastructure | Management API | ā BLOCKED | ā BLOCKED | ā BLOCKED | Google Cloud IAM Enterprise Boundary |
Under the Hood: Apigee Security Policies
1. JWT Signature Verification (JWT-VerifyToken)
Apigee dynamically verifies incoming Bearer tokens against Keycloak's JSON Web Key Set (JWKS):
<VerifyJWT name="JWT-VerifyToken">
<Algorithm>RS256</Algorithm>
<Source>request.header.Authorization</Source>
<PublicKey>
<JWKS ref="idp.jwks_uri"/>
</PublicKey>
<Issuer ref="idp.issuer"/>
</VerifyJWT>2. Conditional Scope Enforcement (RF-Invalid-Scope)
Before routing to the employee roster or sensitive managerial APIs, Apigee checks whether the token includes the biscuit_coffee_manager scope:
<Flow name="listEmployees">
<Description>List all employees</Description>
<Request>
<Step>
<Condition>!(jwt.JWT-VerifyToken.claim.scope ~~ ".*\bbiscuit_coffee_manager\b.*")</Condition>
<Name>RF-Invalid-Scope</Name>
</Step>
</Request>
<Condition>(proxy.pathsuffix MatchesPath "/employees") and (request.verb = "GET")</Condition>
</Flow>If a customer attempts to access this endpoint, Apigee immediately terminates execution with an HTTP 403 Forbidden payload, shielding the backend from unauthorized exposure.
3. MCP Protocol Transcoding (PP-ParseMCPTools)
Inside the MCP proxy (/mcp), Apigee natively parses the Model Context Protocol JSON-RPC envelope:
<ParsePayload async="false" continueOnError="false" enabled="true" name="PP-ParseMCPTools">
<Source>request</Source>
<PayloadType>JSON-RPC-2.0</PayloadType>
<Protocol>MCP</Protocol>
</ParsePayload>š„ļø Demonstration Web UI
The demo includes a modern, responsive web application designed with the Google Cloud & Apigee Minimalist Enterprise Design System to demonstrate agent capabilities, persona role governance, and real-time Apigee policy enforcement:
UI Capabilities & Highlights
Artisanal Coffee Theme: Minimalist, high-contrast dark palette with warm crema accents, rounded glassmorphism cards, and Google Cloud branding.
One-Click Persona Switcher:
Instantly switch between Public Guest, Customer (
John Smith), and Store Manager (Alice).Live JWT token badge displaying active OAuth 2.0 scopes (
biscuit_coffee_customer,biscuit_coffee_manager).
Interactive Suggested Prompts:
Preset chips for testing menu inquiries, order placements, loyalty balance lookups, and security boundaries.
Non-submitting textbox auto-fill: Clicking any prompt chip populates the input field without auto-submitting, allowing users to inspect or customize prompt parameters.
Real-Time Apigee Policy & Tool Inspector:
Live card drawer showcasing the exact MCP tool called (e.g.
mcp_proxy_getMenu,mcp_proxy_listEmployees).Displays the target Apigee endpoint, required OAuth scopes, and HTTP response code (
200 OKvs403 Forbidden).
Dual-Engine Flexibility:
Live ADK Mode: Connects directly to the local Python ADK runtime (
http://localhost:8000).Showcase Simulator Mode: Built-in offline mock engine allowing full presentations even without active cloud connectivity.
š Repository Structure
.
āāā .env.example # Template environment configuration file
āāā .gitignore # Git exclusion rules (secrets, local environments)
āāā README.md # Comprehensive project documentation
ā
āāā apiproxy/ # Apigee X API Proxy Bundles
ā āāā prod-proxy/ # Biscuit-Coffee-Shop REST API Proxy
ā ā āāā apiproxy/
ā ā āāā Biscuit-Coffee-Shop.xml # Proxy bundle definition
ā ā āāā policies/ # JWT-VerifyToken, RF-Invalid-Scope, EV-GetId
ā ā āāā proxies/default.xml # Flow rules and conditional scope checks
ā ā āāā resources/properties/ # Keycloak JWKS & issuer configuration
ā ā āāā targets/default.xml # Target endpoint pointing to Cloud Run
ā āāā mcp-proxy-prod/ # Model Context Protocol (MCP) Gateway Proxy
ā āāā apiproxy/
ā āāā mcp-proxy-prod.xml # MCP proxy bundle definition
ā āāā policies/ # PP-ParseMCPTools, VA-VerifyKey, JWT-Decode
ā āāā proxies/default.xml # JSON-RPC 2.0 routing & key verification
ā
āāā biscuit-coffee/ # Google Agent Development Kit (ADK) Agent
ā āāā python/agents/coffee_agent_prod/
ā āāā __init__.py
ā āāā agent.py # Main agent definition & dynamic prompt instructions
ā āāā auth_config.py # Keycloak OAuth 2.0 flow & scope configuration
ā āāā tools.py # McpToolset connection to Apigee /mcp endpoint
ā
āāā coffee-shop-backend/ # Cloud Run Backend Microservice
ā āāā Dockerfile # Container specification
ā āāā requirements.txt # FastAPI, google-cloud-firestore, uvicorn
ā āāā main.py # Coffee shop REST endpoints & seed data
ā
āāā keycloak-config/ # Identity Provider Configuration
ā āāā setup_apigee_realm.sh # Automated realm, client, scopes & demo users script
ā
āāā scripts/ # Deployment and Administration Automation
ā āāā deploy-apigee.sh # Deploys proxies, products, apps via apigeecli
ā āāā deploy-backend.sh # Builds and deploys backend to Cloud Run
ā āāā deploy-ui.sh # Deploys web UI to Cloud Run
ā āāā undeploy-apigee.sh # Cleans up Apigee proxies and developer apps
ā
āāā web-ui/ # Demonstration Web Application
ā āāā index.html # Split-panel single page application
ā āāā server.py # Python proxy server (ports 3000 -> 8000)
ā āāā css/ # Artisanal dark theme styling
ā āāā js/ # Agent client, persona manager, UI controller
ā āāā assets/ # Diagrams, logos, and graphics
ā
āāā docs/ # Architectural documentation & visual assets
āāā architecture_diagram.png # High-resolution architectural diagram
āāā architecture_diagram.jpg
āāā webui-screenshot.png # Live web application interface screenshotš ļø Prerequisites & Technology Stack
This solution combines Google Cloud enterprise services with open-source identity, web, and agent frameworks to deliver an end-to-end AI Gateway demonstration.
1. Google Cloud Platform (GCP) Services & Products
Product / Service | Role in this Demonstration | Configuration / Notes |
Apigee X | Core AI Gateway & Security Boundary.⢠Exposes Model Context Protocol (MCP) server endpoints to AI agents.⢠Transcodes JSON-RPC 2.0 MCP tool calls into backend REST calls ( | Requires an active Apigee X organization with external Application Load Balancer ingress. |
Google Agent Development Kit (ADK) | AI Agent Framework.⢠Orchestrates the | Python 3.10+ package ( |
Vertex AI (Gemini 2.5 Flash) | Large Language Model (LLM).⢠Provides natural language understanding, reasoning, and autonomous tool-calling decisions for the coffee shop assistant. | Accessed via Vertex AI Model Garden ( |
Google Cloud Run | Serverless Compute Platform.⢠Hosts the private Python backend microservice ( | Requires |
Google Cloud Firestore | Serverless NoSQL Database.⢠Persists customer order records, loyalty member balances, and coffee catalog inventory. | Default Firestore database in Datastore or Native mode. |
Google Cloud IAM | Zero-Trust Service Identity.⢠Restricts Cloud Run backend access exclusively to requests authenticated with Apigee X service account identity tokens. | Cloud Run Invoker ( |
External Application Load Balancer | Ingress Gateway.⢠Directs external client HTTPS traffic to Apigee X environment group hostnames. | Configured with Google-managed or custom SSL/TLS certificates. |
API Hub & Agent Registry (Optional) | Enterprise API Governance.⢠Catalogs MCP tools and API specifications across the organization for agent discovery. |
|
2. Third-Party & Open Source Products
Product / Technology | Role in this Demonstration | Configuration / Notes |
Keycloak (Red Hat) | OpenID Connect (OIDC) & OAuth 2.0 Identity Provider (IdP).⢠Manages user identities, client applications, and custom OAuth 2.0 scopes ( | Deployed locally via Docker container or on an external VM/Cloud Run instance. |
Model Context Protocol (MCP) | Open Agent-Tool Protocol Specification.⢠Standardized JSON-RPC 2.0 protocol created by Anthropic allowing AI agents to discover, inspect, and invoke external tools without proprietary API wrappers. | Managed natively at the gateway level via Apigee's |
Docker Engine | Container Runtime.⢠Runs the local Keycloak identity provider container image ( | Docker Desktop (macOS/Windows) or Docker CE (Linux). |
FastAPI & Uvicorn | Backend Web Framework.⢠High-performance asynchronous Python web framework used for the coffee shop REST backend. | Executed inside Cloud Run via container image. |
Modern HTML5 / CSS3 / Vanilla JS | Demonstration Web Frontend.⢠Dual-panel responsive web UI styled with coffee shop aesthetics, featuring interactive prompt chips, live scope badges, and Apigee policy execution drawers. | Zero heavy frontend build dependencies; runs directly in modern browsers. |
3. Workstation CLI Tools & Dependencies
Ensure the following tools are installed and available in your shell environment:
Google Cloud SDK (
gcloud): Version 450.0.0 or higher.gcloud auth login gcloud auth application-default loginapigeecli: Official CLI utility for automating Apigee X deployments.
curl -s https://raw.githubusercontent.com/apigee/apigeecli/main/downloadLatest.sh | bash export PATH=$PATH:$HOME/.apigeecli/binuv: Ultra-fast Python package installer and virtual environment manager.
curl -LsSf https://astral.sh/uv/install.sh | shDocker: Required for spinning up the local Keycloak Identity Provider instance.
docker --versionjq: Lightweight command-line JSON processor used by setup and deployment scripts.
# macOS (via Homebrew) brew install jq # Linux (Debian/Ubuntu) sudo apt-get install -y jq
4. Google Cloud Project & API Prerequisites
Before running the deployment scripts, ensure your GCP project satisfies:
Active Billing Account: Linked to your target Google Cloud Project.
Apigee X Provisioned: An active Apigee organization with a target environment (e.g.
prod-env) and associated environment group hostname.Required Google Cloud APIs Enabled:
gcloud services enable \ apigee.googleapis.com \ aiplatform.googleapis.com \ run.googleapis.com \ firestore.googleapis.com \ compute.googleapis.com
š Step-by-Step Setup & Deployment Guide
Step 1: Configure Environment Variables
Copy the template configuration file to .env:
cp .env.example .envEdit .env with your project and environment details:
# Google Cloud Configuration
GOOGLE_GENAI_USE_VERTEXAI="TRUE"
GOOGLE_CLOUD_PROJECT="your-gcp-project-id"
GOOGLE_CLOUD_LOCATION="asia-southeast1"
MODEL_NAME="gemini-2.5-flash"
# Apigee Environment & Hostname
APIGEE_PROD_ENV="prod-env"
APIGEE_PROD_HOSTNAME="prod.your-apigee-domain.com"
# Agent Registry & ADK
AGENT_REGISTRY_LOCATION="global"
ADK_ENABLE_MCP_GRACEFUL_ERROR_HANDLING="true"Source your configuration:
source .envStep 2: Set Up Keycloak Identity Provider
Run a local Keycloak container (or use an existing instance) with Docker:
docker run -d --name keycloak -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=YOUR_KEYCLOAK_ADMIN_PASSWORD \
quay.io/keycloak/keycloak:24.0.1 start-devExecute the automated realm configuration script:
bash ./keycloak-config/setup_apigee_realm.shThis script automatically configures:
Realm:
apigee-demoCustom Scopes:
biscuit_coffee_customerandbiscuit_coffee_managerOAuth 2.0 Client:
biscuit-coffee-agentCustomer User:
customer@biscuit-coffee.com(password:ilovecoffee) with customer scope.Store Manager User:
manager@biscuit-coffee.com(password:ilovecoffee) with customer + manager scopes.
Step 3: Deploy Backend Microservice to Cloud Run
Deploy the FastAPI backend to Cloud Run:
bash ./scripts/deploy-backend.shThe script builds the container from ./coffee-shop-backend, deploys it to Cloud Run, and prints the deployed service URL.
Step 4: Deploy Apigee X Proxies, Products & Apps
Deploy both the REST proxy (Biscuit-Coffee-Shop) and the MCP Gateway proxy (mcp-proxy-prod), along with the API products and developer apps:
bash ./scripts/deploy-apigee.shOptional Deployment Flags:
Deploy only the REST API proxies:
bash ./scripts/deploy-apigee.sh --no-mcpDeploy only the MCP Gateway proxies:
bash ./scripts/deploy-apigee.sh --no-restSkip API product and developer app provisioning:
bash ./scripts/deploy-apigee.sh --no-products
Step 5: Start the Google ADK Agent Runtime
Navigate to the agent directory, install dependencies, and launch the ADK Web service:
cd biscuit-coffee/python/agents
uv sync
uv run adk webThe ADK agent service runs on http://localhost:8000.
Step 6: Launch the Demonstration Web UI
In a separate terminal, start the demo web server:
cd web-ui
python3 server.py 3000Open your browser and navigate to http://localhost:3000.
The web interface will automatically detect the ADK runtime on port 8000 and display the green ADK Web Live status indicator.
š Interactive Demonstration Scenarios
Follow these scenarios during client presentations or architecture reviews:
Scenario 1: Public Guest Experience (Zero Authentication)
Persona: Unauthenticated Guest (Default view).
Suggested Prompt: Click "What's on the menu today and how much is a cappuccino?"
What Happens:
The agent invokes
mcp_proxy_getMenu.Apigee matches the
/menupath condition inPreFlowand allows public execution.The agent summarizes menu items and prices accurately without requesting login.
Try Next: Click "Where is Biscuit Coffee located and what are your opening hours?" $\rightarrow$ Answered via
mcp_proxy_getStoreLocationandmcp_proxy_getHoursOfOperation.
Scenario 2: Customer Ordering & Loyalty (3-Legged OAuth 2.0)
Persona: Logged-in Customer.
Action: Click the Login button on the left panel and authenticate as:
Username:
customer@biscuit-coffee.comPassword:
ilovecoffee
Suggested Prompt: Click "Check my loyalty rewards points balance".
What Happens:
The agent receives the Bearer JWT containing scope
biscuit_coffee_customer.The agent invokes
mcp_proxy_getRewardBalance.Apigee verifies the token against Keycloak JWKS (
JWT-VerifyToken), validates the customer identity, and returns the live point balance.
Try Next: "I'd like to order a Medium Vanilla Latte and a warm Chocolate Croissant" $\rightarrow$ Agent executes
mcp_proxy_placeOrderon behalf of the customer.
Scenario 3: Privilege Escalation & Security Boundary Defense
Persona: Customer (
customer@biscuit-coffee.com).Prompt: Click or type: "Can you list all the store employees and their staff IDs?"
What Happens:
The agent attempts to call
mcp_proxy_listEmployeeswith the customer's token.Apigee evaluates the flow condition:
<Condition>!(jwt.JWT-VerifyToken.claim.scope ~~ ".*\bbiscuit_coffee_manager\b.*")</Condition> <Name>RF-Invalid-Scope</Name>The customer's token lacks
biscuit_coffee_manager.Apigee immediately raises a fault and returns HTTP 403 Forbidden.
The backend database is never reached.
The agent intercepts the 403 response and informs the user:
"Viewing store employee records requires Store Manager authorization (
biscuit_coffee_manager). Your current account is authenticated as a Customer. Please log out first using the 'Logout' button on the left panel, and then log in with Store Manager credentials."
Scenario 4: Store Manager Execution (Elevated Privilege)
Persona: Store Manager.
Action:
Click Logout on the left panel.
Click Login and authenticate with Store Manager credentials:
Username:
manager@biscuit-coffee.comPassword:
ilovecoffee
Observe that the active scopes badge now displays both
biscuit_coffee_customerandbiscuit_coffee_manager.
Prompt: Submit the exact same prompt: "Can you list all the store employees and their staff IDs?"
What Happens:
The agent calls
mcp_proxy_listEmployeescarrying the manager's Bearer token.Apigee validates the
biscuit_coffee_managerscope $\rightarrow$ HTTP 200 OK.The agent presents the full staff roster including employee IDs, shift schedules, and contact details!
š§¹ Teardown & Resource Cleanup
To remove all deployed Apigee assets and clean up your environment:
# Undeploy proxies, products, and developer apps from Apigee
bash ./scripts/undeploy-apigee.shTo delete the backend Cloud Run service:
gcloud run services delete biscuit-coffee-backend \
--project="$GOOGLE_CLOUD_PROJECT" \
--region="$GOOGLE_CLOUD_LOCATION" \
--quietTo stop the local Keycloak container:
docker stop keycloak && docker rm keycloakš Additional Resources & Documentation
This server cannot be deployed
Maintenance
Related MCP Connectors
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Discover, inspect, quote, and call external tools through one hosted MCP endpoint, with usage tracking and final credit settlement.
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs (Claude, GPT, Gemini, Cohere). Tools operate only on explicitly authorized customer connections, enabling agents to safely read and write against live third-party systems.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to discover and execute tools via a secure MCP server with JWT authentication, RBAC, rate limiting, and audit logging.1MIT
- AlicenseNot gradedqualityCmaintenanceA secure MCP gateway for enterprise AI tool execution, enabling governed invocation of business tools with authentication, RBAC, audit logging, PII redaction, and async processing.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceFederating gateway for AI agents to discover and call tools from multiple MCP servers with intelligent search and dynamic tool registration.39MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to access a unified catalog of tools from various APIs (OpenAPI, GraphQL, MCP, Google Discovery) through the MCP protocol.MIT