LevelUpWith

Explore / AI Engineering

Agent Interfaces: MCP Apps, Generative UI, WebMCP & A2A

Build agent interfaces people can actually use: ship MCP Apps with sandboxed interactive widgets, stream agent state with AG-UI, expose site tools through WebMCP, and connect agents using A2A, all tested, accessible and safe for risky actions.

Read lesson 1 free →

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor.

Photographic 3D course artwork for Agent Interfaces: MCP Apps, Generative UI, WebMCP & A2A

Expert · 40 levels · 4 free · Created Nov 2026 · Professionally curated by levelupwith.com

What's inside

  1. Level 1: Where Text-Only Agents Hit Their LimitsFree
    Learners see the cases where a text-only reply fails the user: picking from many options, editing structured data, showing charts and maps, confirming risky actions, and running multi-step flows.
    • Rewrite a text-only agent transcript and mark each point where a widget, form or visual would beat plain prose
    • Sort example tasks into 'text is fine' and 'needs an interface', and give an engineering reason for each
  2. Level 2: Mapping the Agent–App–Person Interface StackFree
    Learners place MCP, MCP Apps, generative UI libraries, AG-UI, WebMCP, A2A and Zed's Agent Client Protocol on one map that shows who talks to whom: agent to tool, agent to UI, site to browser agent, and agent to agent.
    • Draw the interface stack and label which protocol covers each connection
    • Pick the right layer for a given product scenario and explain why the other layers don't fit
  3. Level 3: MCP Refresher: Tools, Resources and Lifecycle
    A quick, practical review of the MCP basics the course builds on: initialization and capability negotiation, tools, resources, transports, and how a host turns server output into model context.
    • Run a small MCP server over stdio and Streamable HTTP and inspect the initialize handshake
    • Explain how capability negotiation decides which features a session can use
  4. Level 4: Tool Calling Across Claude, OpenAI, Gemini and Open Models
    Learners compare how Claude, OpenAI, Gemini and an open-weight model served locally define tools, return tool calls and accept results, so later UI work doesn't depend on one vendor.
    • Call the same tool through two vendor APIs and one open-weight model in Python or TypeScript
    • Write a thin adapter that converts between vendor tool-call formats and MCP tool calls
  5. Level 5: What the Model Sees vs What the User Sees
    Learners separate the text content a tool returns for the model from the structured data meant for an interface, the split every UI protocol in this course relies on.
    • Return both text content and structuredContent from an MCP tool, with an output schema
    • Measure how many tokens each version of a tool result costs and decide what belongs in the model's context
  6. Level 6: MCP Apps: The UI Extension to MCP
    Learners learn what the official MCP Apps extension adds: ui:// resources that hold HTML, tools that point to them through metadata, and opt-in negotiation where both client and server must declare support.
    • Explain how a tool's UI metadata links it to a ui:// resource and what the host does with that link
    • Read the MCP Apps specification and its SEP and list what is fixed in the spec and what is still being decided
  7. Level 7: Host Support and Graceful Fallback
    Learners check the official MCP extension client matrix to see which hosts render MCP Apps (Claude, ChatGPT, VS Code, Goose, Cursor and others), then design tools that still work in hosts with no UI.
    • Check the live client matrix and each host's own docs before promising that a feature is supported
    • Detect at runtime whether a client supports MCP Apps and fall back to useful text output when it doesn't
  8. Level 8: Your First MCP App in TypeScript
    Learners build a minimal MCP App with the official @modelcontextprotocol/ext-apps SDK: a server that registers a tool and its ui:// resource, plus a bundled widget that renders the tool result.
    • Register a tool and a matching UI resource with the ext-apps server helpers
    • Bundle a widget into a single HTML resource and see it render in a host that supports MCP Apps
  9. Level 9: Serving an MCP App from a Python Server
    Learners rebuild the same app with a Python MCP server that serves the ui:// resource and tool metadata, while the widget itself stays HTML and TypeScript.
    • Serve a ui:// HTML resource with the correct MIME type and UI metadata from a Python MCP server
    • Confirm the Python and TypeScript servers behave the same by comparing their resource and tool listings
  10. Level 10: The Widget Lifecycle and Host Context
    Learners follow a widget from creation to teardown: the handshake with the host, receiving tool input and results, and responding to host context such as theme, locale and container size.
    • Handle tool-input and tool-result notifications so the widget shows loading, success and error states
    • Match host theming and layout hints so the widget looks native in different hosts
  11. Level 11: Interactive Widgets: Calling Tools from the UI
    Learners make widgets interactive by having them call server tools through the host, and they keep app-only tools hidden from the model.
    • Call a server tool from a button or form in the widget and update the view with the result
    • Set tool visibility so helper tools meant only for the UI stay out of the model's tool list
  12. Level 12: Widgets That Talk Back to the Conversation
    Learners use the app-to-host messages that send a chat message, update the model's context or open a link, and decide when a user's action in the widget should involve the model.
    • Send a follow-up message and push a compact state summary into model context from the widget
    • Decide which widget events the model should know about and which should stay out of its context
  13. Level 13: Display Modes, Sizing and Layout
    Learners handle the display modes hosts offer, such as inline, fullscreen and picture-in-picture, and build layouts that adapt to the container they get, given that hosts support these modes unevenly.
    • Request a display mode change and handle it gracefully when the host refuses
    • Build a responsive widget that reports its size and stays usable inside a narrow chat column
  14. Level 14: Iframe Sandboxing and the postMessage Threat Model
    Learners see why hosts treat every widget as untrusted code, and how the iframe sandbox attribute, separate origins and checked postMessage traffic contain it.
    • List the attacks a malicious or compromised widget could try against a host and its user
    • Set up a sandboxed iframe that checks the origin and message shape of every postMessage it receives
  15. Level 15: The Double-Iframe Sandbox Proxy
    Learners build the double-iframe pattern MCP Apps hosts use: an outer sandbox proxy on a separate origin that loads the untrusted widget HTML into an inner iframe and relays messages between widget and host.
    • Build a minimal host with an outer proxy iframe on a different origin that loads and relays to an inner widget
    • Explain what the extra layer protects against that a single iframe does not, and what it costs in complexity
  16. Level 16: CSP and Declaring External Domains
    Learners declare which outside origins a widget may contact using the MCP Apps CSP metadata (connectDomains, resourceDomains, frameDomains), starting from a deny-by-default policy.
    • Put API calls in connectDomains and scripts, styles, images and fonts in resourceDomains, and fix the common mix-up between them
    • Check how each target host applies or drops declared domains, and design the widget to work under the strictest one
  17. Level 17: Debugging and Testing MCP Apps Locally
    Learners set up a local loop to develop and debug MCP Apps using the SDK's example host and developer tools such as MCPJam, and record the quirks of each host before shipping.
    • Run a widget in a local test host, inspect its messages and find CSP and handshake failures
    • Write a pre-release checklist that covers each target host's differences and the no-UI fallback
  18. Level 18: Generative UI Paradigm 1: Model-Picked Components
    Learners build the most controlled generative UI pattern, where the model chooses from a fixed library of pre-built components through tool calls and fills in their typed props.
    • Map a set of typed components to tool schemas so the model can choose and fill one in
    • Judge how this pattern scores on safety, consistency, flexibility and token cost
  19. Level 19: Generative UI Paradigm 2: Declarative JSON Specs
    Learners have the model output a declarative JSON spec of the interface that a trusted renderer checks and turns into native components, so the model can arrange layouts without running code.
    • Define a JSON schema for a small UI vocabulary and render model output against it safely
    • Handle spec output that is invalid or only partially streamed without breaking the interface
  20. Level 20: Generative UI Paradigm 3: Generated HTML
    Learners let the model write complete HTML and JavaScript for an interface, run it only inside the sandbox from earlier levels, and compare its flexibility with its risk, cost and inconsistent results.
    • Generate an HTML interface with a model and render it safely inside a locked-down sandboxed iframe
    • Choose between the three generative UI approaches for a given product, with a written reason for the choice
  21. Level 21: Generated HTML: Letting the Model Write the UI
    Learn the third generative UI approach, where the model writes complete HTML, CSS and JavaScript at runtime, and see why it is the most flexible option and also the riskiest and most expensive in tokens.
    • Prompt Claude, GPT, Gemini and an open-weight model to produce the same self-contained HTML widget, then compare its quality, size in tokens and how often it breaks
    • Render model-written HTML inside the sandboxed iframe from earlier levels and list the injection and data-leak risks that the sandbox still does not cover
    • Add a validation step that rejects generated markup with inline event handlers, external scripts or form actions before it is rendered
  22. Level 22: Choosing a Generative UI Paradigm
    Weigh model-picked components, declarative JSON specs and generated HTML against each other on safety, flexibility, token cost, testability and brand consistency, and learn when a hybrid makes sense.
    • Score the three approaches against the requirements of a real product feature and defend the choice in a short design note
    • Design a hybrid where a JSON spec handles most screens and generated HTML is a gated fallback, with a clear rule for when the fallback is used
    • Explain plainly which parts of generative UI practice are still unsettled and which are safe defaults today
  23. Level 23: AG-UI: The Event Stream Between Agent and Front End
    Understand the AG-UI protocol, the open event-based protocol started by CopilotKit, and how its run lifecycle, text message and tool call events let a front end follow an agent run as it happens.
    • Trace a full AG-UI run from RUN_STARTED, through text and tool call events, to RUN_FINISHED or RUN_ERROR, and say what the UI should show at each step
    • Write a minimal Python agent endpoint that emits AG-UI events over server-sent events using the official Python SDK
    • Consume that stream in a TypeScript client and render streaming text and tool call progress
  24. Level 24: Shared State with AG-UI Snapshots and Deltas
    Keep agent state and UI state in sync using AG-UI's STATE_SNAPSHOT and STATE_DELTA events, and handle the ordering, reconnection and drift problems that show up in production.
    • Send a full state snapshot followed by JSON Patch deltas, and apply them on the client so the UI matches the agent's state
    • Recover from a dropped connection by asking for a fresh snapshot instead of replaying deltas you can't trust
    • Check which delta format your AG-UI SDK version actually uses, because sources disagree, and write a test that catches a mismatch
  25. Level 25: Front-End Tools and Human-in-the-Loop over AG-UI
    Let the agent call tools that run in the browser and pause for a person to approve or edit, using AG-UI tool call events and a resume flow.
    • Register a front-end tool that the agent can call to update the page, and return its result to the agent run
    • Build an approval step that pauses a run, shows the proposed action to the user, and continues or cancels based on their answer
    • Name the failure cases (user leaves, timeout, approving twice) and handle each one so the run never stays half-finished
  26. Level 26: Vercel AI SDK and Other Streaming UI Libraries
    Stream model output, tool calls and typed data parts to a React front end with the Vercel AI SDK, and compare it with CopilotKit, TanStack AI and plain server-sent events across Claude, OpenAI, Gemini and open-weight providers.
    • Build a chat route with the Vercel AI SDK that streams text and renders tool results as components, then switch providers by changing one line
    • Connect the same front end to a Python backend through a documented stream protocol instead of locking the stack to TypeScript
    • Choose between the AI SDK, an AG-UI client and hand-rolled server-sent events for a given project, with the trade-offs written down
  27. Level 27: WebMCP: Why Sites Should Expose Tools
    Understand why browser agents that scrape and click are fragile, what WebMCP offers instead, and where it stands: a draft being incubated in a W3C Community Group, previewed in Chrome behind flags and trials, with an API that is still changing.
    • Compare a screenshot-and-click browser agent with a WebMCP tool call for the same task on speed, reliability and token cost
    • Turn on WebMCP in a current Chrome build through the testing flag or origin trial, and confirm it with feature detection
    • Explain how WebMCP differs from a remote MCP server, including who is authenticated, where the code runs and what the user sees
  28. Level 28: Registering Tools with the Imperative API
    Expose page features to in-browser agents by registering tools from JavaScript, each with a name, description and input schema, and remove them as the page state changes.
    • Register a tool with registerTool that calls the page's existing application logic, and unregister it with an AbortController signal
    • Write tool descriptions and JSON schemas that agents use correctly, and test them with more than one model
    • Show only the tools that make sense for the current view or login state, and check the current spec for the exact entry point your Chrome build expects
  29. Level 29: The Declarative API: Turning Forms into Tools
    Expose existing HTML forms as agent tools with the draft declarative WebMCP API, and learn where this low-effort route works and where it breaks.
    • Annotate an existing form so an in-browser agent can find it and fill it in as a tool
    • Decide between the declarative and imperative APIs for a given feature, with reasons
    • Debug a declarative tool that does not appear, using the Chrome preview notes and the community issue reports
  30. Level 30: WebMCP Security, Consent and User Presence
    Threat-model a WebMCP-enabled page: prompt injection through tool output, agents acting with the user's session, and how to require confirmation before risky actions.
    • Classify a site's tools as read-only, reversible or destructive, and gate each class with the right level of confirmation
    • Clean tool results so page content cannot inject instructions into the agent
    • Keep a server-side audit log of agent-started actions that is separate from actions the user took directly
  31. Level 31: Testing WebMCP Pages and Graceful Fallback
    Test WebMCP tools automatically and by hand, and make sure the page works the same for browsers and agents that don't support WebMCP at all.
    • Write automated tests that call registered tools in a real Chrome build and check both the results and the page state
    • Use feature detection so the page works normally when WebMCP is missing or its API has changed shape
    • Keep a compatibility note that tracks the spec draft and Chrome version your implementation targets
  32. Level 32: A2A Fundamentals: Agent Cards and Tasks
    Learn what the Agent2Agent protocol, now hosted by the Linux Foundation, is for: how agents find each other through Agent Cards and work together through tasks, messages and artifacts.
    • Write an Agent Card that declares an agent's skills, endpoint, authentication and supported protocol versions, and publish it at the well-known path
    • Trace an A2A task through its lifecycle, including streaming updates and the input-required state
    • Explain why A2A treats the remote agent as an opaque peer, while MCP treats a server as tools and resources under the client's control
  33. Level 33: Building an A2A Agent Exchange
    Build a small A2A server in Python and a TypeScript client that hands it a task, streams progress and receives an artifact, using the official SDKs.
    • Wrap an existing agent built on any model provider as an A2A server with the official Python SDK
    • Find that agent from a TypeScript client by reading its Agent Card, send a task and handle the streamed updates
    • Handle protocol version negotiation and authentication failures without guessing, and check behaviour against the current spec on a2a-protocol.org
  34. Level 34: Zed's Agent Client Protocol for Editors
    Understand the Agent Client Protocol, which connects code editors to coding agents over JSON-RPC, and how its sessions, permission requests and file access differ from both MCP and A2A.
    • Run a coding agent through ACP in a supporting editor and inspect the JSON-RPC messages it sends
    • Implement a minimal ACP agent that streams updates and asks the editor for permission before it edits a file
    • Explain why an editor-to-agent protocol needs its own trust model rather than reusing MCP
  35. Level 35: Choosing Between MCP, AG-UI, A2A and ACP
    Put the course's protocols on one map, comparing purpose, trust boundary and message flow, and design a system that uses several together without overlapping roles.
    • Assign each link in a multi-agent product to MCP, MCP Apps, AG-UI, WebMCP, A2A or ACP, and justify each choice
    • Identify where credentials, user consent and audit logs must sit when a request crosses more than one protocol
    • Name the areas where agent-to-agent practice is still unsettled and design so that a protocol can be swapped out later
  36. Level 36: Token Budgets and Consent Friction
    Design interfaces that keep the model's context small, by sending compact tool results and keeping data meant for the UI out of the model, and that ask for consent on risky actions without tiring users out with prompts.
    • Measure the tokens that a widget's tool results add to context, and cut them by splitting what the model sees from what only the UI sees
    • Design a tiered consent scheme with silent reads, inline confirmation for reversible writes, and explicit approval with a preview for destructive or payment actions
    • Set and check a per-turn token budget across Claude, OpenAI, Gemini and an open-weight model
  37. Level 37: Testing Generated Interfaces
    Test interfaces whose content changes every time, using schema checks, snapshot tests of stable structure, browser tests inside sandboxed iframes, and evals of how well the model chooses UI.
    • Write schema and contract tests that reject invalid UI specs or widget payloads before they are rendered
    • Drive an MCP App widget inside a test host with Playwright, including the postMessage bridge
    • Build a small eval set that checks whether each model chooses the right component and fills it in correctly
  38. Level 38: Accessibility of Generated and Embedded UI
    Make generated components, widgets in sandboxed iframes and streamed updates usable with a keyboard and screen reader, and automate accessibility checks.
    • Add focus management, iframe titles and live regions so streamed and generated content is announced correctly
    • Run automated accessibility checks on generated output, and block any release where they fail
    • Limit generated HTML to an accessible component list or spec so accessibility is built in rather than hoped for
  39. Level 39: Final Project: MCP App Widget plus WebMCP Page
    Build and ship the course project: an MCP App with an interactive, sandboxed widget that works in at least two hosts, paired with a WebMCP-enabled page that exposes the same capability to in-browser agents.
    • Build the MCP App server in Python or TypeScript with a widget that has a strict content security policy, declared external domains and a working host bridge
    • Expose matching tools on a web page through WebMCP, with consent gates and a fallback for browsers without WebMCP
    • Test both surfaces, check their accessibility and measure their token use, then write up how the project behaves in each host and browser
  40. Level 40: Final Challenge: Agent Interfaces End to End Exam
    Bring the whole course together in a review challenge that covers text-only limits, MCP Apps and sandboxing, generative UI paradigms, AG-UI streaming, WebMCP, A2A and ACP, token budgets, consent, testing and accessibility.
    • Design an end-to-end agent product, choosing the right interface pattern and protocol for each part and defending the trade-offs
    • Review a flawed agent interface design and find its security, consent, token budget and accessibility problems
    • Tell which claims about these protocols are settled and which are still in draft, and check them against current primary sources

Access

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor. Every level, the podcast edition and the AI tutor come with All Access at £4.99/month or any Creator plan — see pricing.

Read lesson 1 free →