|
1 | 1 | # MCP UI 🪟
|
2 | 2 |
|
3 |
| -Hooray! You're all done! 👏👏 |
| 3 | +Hooray! You made it through the whole workshop! 👏 |
| 4 | + |
| 5 | +## What you've learned |
| 6 | + |
| 7 | +### 1. Simple - Raw HTML UI Resources |
| 8 | + |
| 9 | +Learned the core pattern: use `createUIResource` to return a `rawHtml` UI resource instead of plain text. You delivered styled, visual output (e.g. info cards) and saw how a `uri` + content type package UI for compliant clients. |
| 10 | + |
| 11 | +### 2. Consistent - Remote DOM |
| 12 | + |
| 13 | +Moved from hand-authored HTML/CSS to a component-driven, host-consistent layer (Shopify's Remote DOM). You gained: design system consistency, built-in interactivity, less styling drift, and safer structured creation of elements (`ui-text`, `ui-button`, etc.). |
| 14 | + |
| 15 | +### 3. Complex - Iframe / Embedded Apps |
| 16 | + |
| 17 | +Escalated to full application surfaces using the `externalUrl` content type. Added preferred sizing metadata, understood lifecycle messages, and decomposed complexity into an independently deployed (or locally served) app. Sub-steps introduced readiness, fixed sizing, and dynamic resizing strategies. |
| 18 | + |
| 19 | +### 4. Interactive - Communication Protocol |
| 20 | + |
| 21 | +Empowered iframes to participate in workflows: sending `link`, `tool`, and `prompt` messages via `postMessage`. You handled message IDs, async responses, and error feedback—turning passive UI into an active collaborator with the host + MCP toolchain. |
| 22 | + |
| 23 | +### 5. Advanced - Tool Results & Render Data |
| 24 | + |
| 25 | +Closed the loop on data richness and performance: |
| 26 | + |
| 27 | +- **Structured Tool Results:** Defined output schemas so clients can safely parse, validate, and branch on outcomes (e.g. metrics, suggestions). |
| 28 | +- **Render Data:** Preloaded initial iframe data through `uiMetadata` (`initial-render-data`) to avoid extra network hops and securely pass contextual, possibly private data at creation time. |
| 29 | + |
| 30 | +### Putting It All Together |
| 31 | + |
| 32 | +Across the progression you learned how to choose the right abstraction: |
| 33 | + |
| 34 | +- Raw HTML → quickest path to visual output |
| 35 | +- Remote DOM → consistency & built-in components |
| 36 | +- Iframe Apps → full framework power & complex interaction |
| 37 | +- Protocol Messaging → rich, bi-directional intent + action |
| 38 | +- Structured Results & Render Data → reliability, safety, and performance |
| 39 | + |
| 40 | +### Next Steps |
| 41 | + |
| 42 | +You're well equipped to ship production-grade MCP UI experiences. Consider: |
| 43 | + |
| 44 | +- Converting existing plain-text MCP tools into visual UI resources |
| 45 | +- Adding schema validation everywhere a boundary exists (tool inputs/outputs, render data) |
| 46 | +- Building a reusable internal component library for Remote DOM use |
| 47 | +- Layering authorization & audit logging around iframe messages |
| 48 | +- Contributing examples or docs back to the MCP UI ecosystem |
| 49 | + |
| 50 | +You've taken AI interaction from linear text to adaptive, interactive surfaces that feel native and intentional. Nicely done. Keep experimenting—and ship something real next. |
0 commit comments