# googlecloudplatform/apigee-samples architecture

> Architecture diagram of the GitHub repository googlecloudplatform/apigee-samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/googlecloudplatform/apigee-samples
- Repository: https://github.com/googlecloudplatform/apigee-samples

## Overview

Apigee Samples is a collection of deployable API-proxy and integration examples, not one unified application. A developer selects a use case and runs its proxy or service; the sampled MCP server has a more specific flow: fetch API-product specifications, generate MCP tools, then invoke the described APIs. The graph also preserves the API Hub, LLM, gRPC, and proxy-capability branches represented in the tree. Some sample behavior is unsampled, so those branches are shown without inferred runtime links.

Main entry points: [`apigee-mcp/src/index.ts`](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/index.ts) (MCP server), [`grpc-web/app/cmd/main.go`](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/cmd/main.go) (gRPC-web entry), [`grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java`](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java) (Protobuf decoder), [`apigee-mcp/src/api.ts`](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/api.ts) (Product API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mcp["MCP API tools"]
  node_mcp_server["MCP server<br/>[index.ts]"]
  node_product_api["Product API client<br/>[api.ts]"]
  node_openapi["OpenAPI tool generation<br/>[openapi_tools.ts]"]
  node_executor["API tool executor"]
  node_api_service["API product service"]
end

subgraph group_grpc["gRPC examples"]
  node_grpc_entry["gRPC-web entry<br/>[main.go]"]
  node_grpc_server["gRPC server<br/>[server.go]"]
  node_grpc_web["gRPC-web adapter<br/>[server.go]"]
  node_decoder["Protobuf decoder"]
  node_resolver["Variable resolver<br/>[VarResolver.java]"]
  node_debug["Debug variables<br/>[Debug.java]"]
  node_extension_grpc["Plaintext gRPC extension<br/>[grpc.go]"]
end

subgraph group_hub["API Hub plugins"]
  node_aws_plugin["AWS API Gateway plugin<br/>[index.mjs]"]
  node_azure_plugin["Azure APIM plugin<br/>[onrampApimSync.js]"]
end

subgraph group_llm["LLM examples"]
  node_llm_calling["LLM function calling<br/>[JS-Products.js]"]
  node_llm_cache["LLM semantic cache"]
  node_vertex_agent["Vertex AI agent<br/>[JS-Products.js]"]
end

subgraph group_proxies["Proxy capabilities"]
  node_oauth["Token authorization"]
  node_caching["Caching and quota"]
  node_traffic["Traffic controls"]
  node_property["Property-set headers"]
  node_path_split["Path-based decomposition<br/>[pathMatcher.js]"]
  node_cloud_fn["Cloud Functions backend<br/>[app.js]"]
  node_cloud_run["Cloud Run backend<br/>[app.js]"]
end

node_developer(("API developer"))

node_developer -->|"starts server"| node_mcp_server
node_mcp_server -->|"fetches specs"| node_product_api
node_mcp_server -->|"generates tools"| node_openapi
node_mcp_server -->|"dispatches tools"| node_executor
node_product_api -.->|"requests specifications"| node_api_service
node_executor -.->|"calls target API"| node_api_service
node_developer -.->|"runs example"| node_grpc_entry
node_grpc_entry -->|"starts"| node_grpc_server
node_grpc_entry -->|"starts"| node_grpc_web
node_grpc_web -->|"wraps requests"| node_grpc_server
node_decoder -->|"resolves variables"| node_resolver
node_decoder -->|"initializes"| node_debug
node_developer -.->|"runs example"| node_extension_grpc
node_developer -.->|"uses plugin"| node_aws_plugin
node_developer -.->|"uses plugin"| node_azure_plugin
node_developer -.->|"runs example"| node_llm_calling
node_developer -.->|"runs example"| node_llm_cache
node_developer -.->|"runs example"| node_vertex_agent
node_developer -.->|"selects proxy"| node_oauth
node_developer -.->|"selects proxy"| node_caching
node_developer -.->|"selects proxy"| node_traffic
node_developer -.->|"selects proxy"| node_property
node_developer -.->|"selects proxy"| node_path_split
node_developer -.->|"runs backend example"| node_cloud_fn
node_developer -.->|"runs backend example"| node_cloud_run

click node_mcp_server "https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/index.ts"
click node_product_api "https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/api.ts"
click node_openapi "https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/openapi_tools.ts"
click node_executor "https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/mcp_api_executor.ts"
click node_grpc_entry "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/cmd/main.go"
click node_grpc_server "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/pkg/grpc/server.go"
click node_grpc_web "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/pkg/grpc-web/server.go"
click node_decoder "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java"
click node_resolver "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/util/VarResolver.java"
click node_debug "https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/util/Debug.java"
click node_extension_grpc "https://github.com/googlecloudplatform/apigee-samples/blob/main/extension-processor-grpc/backend/cmd/plaintext/grpc.go"
click node_aws_plugin "https://github.com/googlecloudplatform/apigee-samples/blob/main/apihub-plugins/aws/apigateway/index.mjs"
click node_azure_plugin "https://github.com/googlecloudplatform/apigee-samples/blob/main/apihub-plugins/azure/apim/src/functions/onrampApimSync.js"
click node_llm_calling "https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-function-calling/proxybundles/llm-function-calling-v1/apiproxy/resources/jsc/JS-Products.js"
click node_llm_cache "https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-semantic-cache/semantic-cache-response-v1/sharedflowbundle/resources/jsc/CalculateExpTime.js"
click node_vertex_agent "https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-vertexai-agent/apiproxy/resources/jsc/JS-Products.js"
click node_oauth "https://github.com/googlecloudplatform/apigee-samples/tree/main/authorize-idp-access-tokens"
click node_caching "https://github.com/googlecloudplatform/apigee-samples/tree/main/basic-caching"
click node_traffic "https://github.com/googlecloudplatform/apigee-samples/tree/main/spike-arrest"
click node_property "https://github.com/googlecloudplatform/apigee-samples/blob/main/property-set/apiproxy/resources/jsc/JS-SetHeadersUsingPropertySet.js"
click node_path_split "https://github.com/googlecloudplatform/apigee-samples/blob/main/monolith-to-microservices-based-on-paths/apiproxy/resources/jsc/pathMatcher.js"
click node_cloud_fn "https://github.com/googlecloudplatform/apigee-samples/blob/main/cloud-functions/app/app.js"
click node_cloud_run "https://github.com/googlecloudplatform/apigee-samples/blob/main/cloud-run/app/app.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp_server,node_product_api,node_openapi,node_executor,node_api_service toneBlue
class node_grpc_entry,node_grpc_server,node_grpc_web,node_decoder,node_resolver,node_debug,node_extension_grpc toneAmber
class node_aws_plugin,node_azure_plugin,node_developer toneMint
class node_llm_calling,node_llm_cache,node_vertex_agent toneRose
class node_oauth,node_caching,node_traffic,node_property,node_path_split,node_cloud_fn,node_cloud_run toneIndigo
```

## Components

### MCP API tools

- [MCP server](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/index.ts): `apigee-mcp/src/index.ts`
- [Product API client](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/api.ts): `apigee-mcp/src/api.ts`
- [OpenAPI tool generation](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/openapi_tools.ts): `apigee-mcp/src/openapi_tools.ts`
- [API tool executor](https://github.com/googlecloudplatform/apigee-samples/blob/main/apigee-mcp/src/mcp_api_executor.ts): `apigee-mcp/src/mcp_api_executor.ts`
- **API product service**

### gRPC examples

- [gRPC-web entry](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/cmd/main.go): `grpc-web/app/cmd/main.go`
- [gRPC server](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/pkg/grpc/server.go): `grpc-web/app/pkg/grpc/server.go`
- [gRPC-web adapter](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/app/pkg/grpc-web/server.go): `grpc-web/app/pkg/grpc-web/server.go`
- [Protobuf decoder](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java): `grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java`
- [Variable resolver](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/util/VarResolver.java): `grpc-web/callout/src/main/java/com/google/apigee/callouts/util/VarResolver.java`
- [Debug variables](https://github.com/googlecloudplatform/apigee-samples/blob/main/grpc-web/callout/src/main/java/com/google/apigee/callouts/util/Debug.java): `grpc-web/callout/src/main/java/com/google/apigee/callouts/util/Debug.java`
- [Plaintext gRPC extension](https://github.com/googlecloudplatform/apigee-samples/blob/main/extension-processor-grpc/backend/cmd/plaintext/grpc.go): `extension-processor-grpc/backend/cmd/plaintext/grpc.go`

### API Hub plugins

- [AWS API Gateway plugin](https://github.com/googlecloudplatform/apigee-samples/blob/main/apihub-plugins/aws/apigateway/index.mjs): `apihub-plugins/aws/apigateway/index.mjs`
- [Azure APIM plugin](https://github.com/googlecloudplatform/apigee-samples/blob/main/apihub-plugins/azure/apim/src/functions/onrampApimSync.js): `apihub-plugins/azure/apim/src/functions/onrampApimSync.js`

### LLM examples

- [LLM function calling](https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-function-calling/proxybundles/llm-function-calling-v1/apiproxy/resources/jsc/JS-Products.js): `llm-function-calling/proxybundles/llm-function-calling-v1/apiproxy/resources/jsc/JS-Products.js`
- [LLM semantic cache](https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-semantic-cache/semantic-cache-response-v1/sharedflowbundle/resources/jsc/CalculateExpTime.js): `llm-semantic-cache/semantic-cache-response-v1/sharedflowbundle/resources/jsc/CalculateExpTime.js`
- [Vertex AI agent](https://github.com/googlecloudplatform/apigee-samples/blob/main/llm-vertexai-agent/apiproxy/resources/jsc/JS-Products.js): `llm-vertexai-agent/apiproxy/resources/jsc/JS-Products.js`

### Proxy capabilities

- [Token authorization](https://github.com/googlecloudplatform/apigee-samples/tree/main/authorize-idp-access-tokens): `authorize-idp-access-tokens`
- [Caching and quota](https://github.com/googlecloudplatform/apigee-samples/tree/main/basic-caching): `basic-caching`
- [Traffic controls](https://github.com/googlecloudplatform/apigee-samples/tree/main/spike-arrest): `spike-arrest`
- [Property-set headers](https://github.com/googlecloudplatform/apigee-samples/blob/main/property-set/apiproxy/resources/jsc/JS-SetHeadersUsingPropertySet.js): `property-set/apiproxy/resources/jsc/JS-SetHeadersUsingPropertySet.js`
- [Path-based decomposition](https://github.com/googlecloudplatform/apigee-samples/blob/main/monolith-to-microservices-based-on-paths/apiproxy/resources/jsc/pathMatcher.js): `monolith-to-microservices-based-on-paths/apiproxy/resources/jsc/pathMatcher.js`
- [Cloud Functions backend](https://github.com/googlecloudplatform/apigee-samples/blob/main/cloud-functions/app/app.js): `cloud-functions/app/app.js`
- [Cloud Run backend](https://github.com/googlecloudplatform/apigee-samples/blob/main/cloud-run/app/app.js): `cloud-run/app/app.js`

### Other components

- **API developer**

## Connections

- API developer → MCP server: starts server (evidence: `apigee-mcp/src/index.ts`)
- MCP server → Product API client: fetches specs (evidence: `apigee-mcp/src/index.ts`)
- MCP server → OpenAPI tool generation: generates tools (evidence: `apigee-mcp/src/index.ts`)
- MCP server → API tool executor: dispatches tools (evidence: `apigee-mcp/src/index.ts`)
- Product API client → API product service: requests specifications
- API tool executor → API product service: calls target API
- API developer → gRPC-web entry: runs example (evidence: `README.md`)
- gRPC-web entry → gRPC server: starts (evidence: `grpc-web/app/cmd/main.go`)
- gRPC-web entry → gRPC-web adapter: starts (evidence: `grpc-web/app/cmd/main.go`)
- gRPC-web adapter → gRPC server: wraps requests (evidence: `grpc-web/app/pkg/grpc-web/server.go`)
- Protobuf decoder → Variable resolver: resolves variables (evidence: `grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java`)
- Protobuf decoder → Debug variables: initializes (evidence: `grpc-web/callout/src/main/java/com/google/apigee/callouts/ProtobufDecoder.java`)
- API developer → Plaintext gRPC extension: runs example (evidence: `README.md`)
- API developer → AWS API Gateway plugin: uses plugin (evidence: `README.md`)
- API developer → Azure APIM plugin: uses plugin (evidence: `README.md`)
- API developer → LLM function calling: runs example (evidence: `README.md`)
- API developer → LLM semantic cache: runs example (evidence: `README.md`)
- API developer → Vertex AI agent: runs example (evidence: `README.md`)
- API developer → Token authorization: selects proxy (evidence: `README.md`)
- API developer → Caching and quota: selects proxy (evidence: `README.md`)
- API developer → Traffic controls: selects proxy (evidence: `README.md`)
- API developer → Property-set headers: selects proxy (evidence: `README.md`)
- API developer → Path-based decomposition: selects proxy (evidence: `README.md`)
- API developer → Cloud Functions backend: runs backend example (evidence: `README.md`)
- API developer → Cloud Run backend: runs backend example (evidence: `README.md`)
