|
| 1 | +--- |
| 2 | +title: MCP Apps Architecture |
| 3 | +subtitle: How MCP Apps work with Apollo MCP Server |
| 4 | +--- |
| 5 | + |
| 6 | +MCP Apps combine GraphQL operations with custom UI resources to create interactive experiences in MCP Apps-compatible hosts. Apollo MCP Server bridges your GraphQL APIs to the MCP Apps specification. |
| 7 | + |
| 8 | +## High-level flow |
| 9 | + |
| 10 | +MCP Apps work in two phases: |
| 11 | + |
| 12 | +**Discovery phase**: The host discovers your app and pre-fetches the built resource. |
| 13 | + |
| 14 | +**Tool execution phase**: When a tool is invoked, the host receives data from the MCP server and injects it into a pre-loaded iframe. |
| 15 | + |
| 16 | +```mermaid |
| 17 | +graph TB |
| 18 | + subgraph Discovery["Discovery Phase"] |
| 19 | + Host1["MCP Apps Host"] |
| 20 | + MCPServer1["Apollo MCP Server"] |
| 21 | + |
| 22 | + Host1 -->|"1. List Resources"| MCPServer1 |
| 23 | + MCPServer1 -->|"2. Return Resource URI"| Host1 |
| 24 | + Host1 -->|"3. Read Resource"| MCPServer1 |
| 25 | + MCPServer1 -->|"4. Return UI Content"| Host1 |
| 26 | + end |
| 27 | + |
| 28 | + subgraph Execution["Tool Execution Phase"] |
| 29 | + Host2["MCP Apps Host"] |
| 30 | + MCPServer2["Apollo MCP Server"] |
| 31 | + GraphQL["GraphQL API"] |
| 32 | + Iframe["Iframe with UI"] |
| 33 | + |
| 34 | + Host2 -->|"5. Invoke Tool"| MCPServer2 |
| 35 | + MCPServer2 -->|"6. Execute GraphQL"| GraphQL |
| 36 | + GraphQL -->|"7. Return Data"| MCPServer2 |
| 37 | + MCPServer2 -->|"8. Return Data"| Host2 |
| 38 | + Host2 -->|"9. Create Iframe"| Iframe |
| 39 | + Host2 -->|"10. Inject Data"| Iframe |
| 40 | + end |
| 41 | + |
| 42 | + style Host1 fill:#E3F2FD |
| 43 | + style Host2 fill:#E3F2FD |
| 44 | + style MCPServer1 fill:#1976D2,color:#fff |
| 45 | + style MCPServer2 fill:#1976D2,color:#fff |
| 46 | + style GraphQL fill:#00ACC1,color:#fff |
| 47 | + style Iframe fill:#4CAF50,color:#fff |
| 48 | +``` |
| 49 | + |
| 50 | +When an MCP Apps-compatible host invokes a tool, Apollo MCP Server executes the GraphQL operation and returns only the data. The host then creates an iframe with the pre-fetched HTML resource and injects the tool result data into it. |
| 51 | + |
| 52 | +## App components |
| 53 | + |
| 54 | +An MCP App consists of: |
| 55 | + |
| 56 | +- **Tools**: GraphQL operations exposed as MCP tools that MCP Apps-compatible hosts can invoke |
| 57 | +- **Resource**: The built `.html` file that contains your application code. |
| 58 | + |
| 59 | +The app manifest (`.application-manifest.json`) is automatically generated from your app code and your configuration file (or `package.json`). GraphQL operations come from your app code, while app-level configuration comes from your configuration files. The manifest defines the mapping between tools, operations, and the resource. |
| 60 | + |
| 61 | +## App structure |
| 62 | + |
| 63 | +Apps are organized in directories under `apps/`, each containing build artifacts (the manifest file and built resources). The MCP Server reads from the `apps/` directory. |
| 64 | + |
| 65 | +**Important**: The `apps/` directory contains build artifacts, not your development code. Development happens in a separate directory (we recommend using `dev/<app-name>`, like the [Apollo AI Apps Template](https://github.com/apollographql/ai-apps-template) does). |
| 66 | + |
| 67 | + |
| 68 | +## Resources |
| 69 | + |
| 70 | +The resource is the built `.html` file that contains your application code. This file is loaded by the host and contains everything needed to render your app's UI. We recommend using the [Apollo AI Apps Template](https://github.com/apollographql/ai-apps-template) for a complete setup. |
| 71 | + |
| 72 | +## App target selection |
| 73 | + |
| 74 | +Apollo MCP Server supports two app targets: |
| 75 | +- ChatGPT Apps: For hosts that support OpenAI's Apps SDK specification (for example, ChatGPT) |
| 76 | +- MCP Apps: MCP Apps-compatible clients |
| 77 | + |
| 78 | +The target determines MIME type, metadata format, and CSP format. |
0 commit comments