Why MCP Renders Direct UI: How SEP-1865 Enables 1-Second Multi-Server Approvals and Anchors the 3-Layer Protocol Stack
Executive Summary & Key Takeaways
- Core Thesis: While the Model Context Protocol (MCP) standardized how AI models access external data and operational tools, its reliance on raw text and JSON strings created a severe bottleneck for human governance. In high-stakes enterprise workflows—such as verifying security patch status across 50 production servers—forcing operators to audit terminal logs in chat interfaces is slow and error-prone. The official MCP Apps extension specification (SEP-1865, identifier
io.modelcontextprotocol/ui) resolves this by allowing MCP servers to return sandboxed interactive user interfaces (ui://) rendered within isolatediframecontainers, communicating bidirectionally viapostMessageJSON-RPC. This enables “Ephemeral UI”—transient, high-density approval panels that pop up for critical human-in-the-loop decisions and disappear once executed. Furthermore, recent systems analyses from AI Atlas and MarkTechPost resolve protocol fragmentation by structuring the agent ecosystem into a three-layer stack (L1 MCP tools, L2 A2A v1.0.1 collaboration, L3 AP2/x402 economic settlement) paired with strict state boundaries: 100% stateless MCP servers, durable framework checkpoints, and harness-level context compaction. - Primary Sources Verified: Model Context Protocol Official Extension Specification (SEP-1865: MCP Apps, draft specification for
io.modelcontextprotocol/ui), AI Atlas (The Agent Protocols Map: MCP vs A2A vs AP2, x402, ACP), and MarkTechPost Systems Architecture Report (Agent Harness vs Agent Framework vs MCP: Who Owns State?). - Actionable Engineering & Governance Takeaways:
- Audit existing MCP server tool responses: for tools executing batch operations, database migrations, or infrastructure restarts, implement SEP-1865
_meta.ui.resourceUrito serve interactive visual dashboards rather than raw JSON strings. - Enforce strict 100% statelessness in MCP servers: eliminate in-memory session caches, global variables, and local state retention, passing encrypted continuation tokens (handles) back to the agent client to preserve horizontal scalability.
- Decouple state across the three architectural tiers: assign workflow durability and multi-day approval checkpoints to the Framework layer (PostgreSQL/SQLite), isolate local workspace file modifications and context auto-compaction to the Harness layer, and keep the MCP protocol layer strictly functional.
- Audit existing MCP server tool responses: for tools executing batch operations, database migrations, or infrastructure restarts, implement SEP-1865
- Limits of the Evidence: SEP-1865 represents an active draft extension within the Model Context Protocol governance process; client-side host implementation varies across commercial agent interfaces. A2A v1.0.1 and AP2/x402 protocols are in early enterprise adoption stages, with cross-vendor interoperability currently demonstrated primarily in consortium pilot environments.
Japanese Edition: https://consuloji.substack.com/p/aimcpmcp-apps501
1. The Interface Constraint: Why Autonomous Agents Require Ephemeral UI
When organizations integrate autonomous AI agents into core infrastructure, they encounter a fundamental usability constraint: the text-only chat window.

Under standard Model Context Protocol (MCP) implementations, tool executions return strings formatted as markdown, raw plaintext, or JSON objects. While adequate for basic information retrieval (such as fetching a weather forecast or looking up a documentation snippet), this interface fails in high-stakes operational environments. Consider a scenario where an autonomous operations agent scans an infrastructure fleet, identifies a critical vulnerability, and requests authorization to apply an emergency patch across 50 Kubernetes nodes.
If the agent returns a 50-node terminal dump as raw JSON or a scrolling text log, human operators face an impossible trade-off. Verifying node versions, cluster health scores, and rollout stages by reading hundreds of lines of text takes several minutes, creating cognitive fatigue that encourages rubber-stamping. Alternatively, operators reject the agent’s proposal out of caution, nullifying the speed advantage of automation.

Human cognition processes visual matrices orders of magnitude faster than unstructured text. A color-coded status grid displaying 50 server nodes—with green indicators for clean health checks, yellow for active connections, and red for failure alerts—allows a site reliability engineer to evaluate system safety in under one second.
Autonomous agents do not require permanent static dashboards; rather, they require “Ephemeral UI”—interactive visual components that materialize dynamically at the moment an evaluation or approval is required, capture human judgment, execute verified actions, and disappear once the operational state is finalized.
2. Technical Anatomy of SEP-1865: Sandboxed iframes and Bidirectional JSON-RPC
The Model Context Protocol community formalized this capability through official extension proposal SEP-1865, designated by the specification identifier io.modelcontextprotocol/ui.

SEP-1865 introduces three core mechanisms that allow MCP servers to deliver rich, interactive web components while maintaining strict security isolation:
1. The Reserved ui:// URI Scheme
The specification establishes ui:// as a standard URI scheme dedicated to user interface resources. Rather than embedding raw HTML strings inside unstructured text outputs, an MCP server registers UI endpoints (for example, ui://cluster-patch-matrix or ui://billing-approval-widget). These URIs point to self-contained web bundles comprising HTML, CSS, and client-side JavaScript.
2. Tool Response Metadata Binding (_meta.ui.resourceUri)
When an agent invokes a tool, the MCP server returns standard structured data alongside a standardized metadata extension:
{
"content": [
{
"type": "text",
"text": "Prepared emergency security patch for 50 cluster nodes."
}
],
"_meta": {
"ui": {
"resourceUri": "ui://cluster-patch-matrix",
"preferredDisplay": "inline",
"dimensions": {
"width": "100%",
"maxHeight": "480px"
}
}
}
}
The host client (such as Claude Desktop, a web IDE, or an enterprise internal console) reads _meta.ui.resourceUri, fetches the corresponding UI bundle from the MCP server, and mounts the component directly into the conversation stream.

3. Sandboxed iframe Isolation and postMessage JSON-RPC
Allowing third-party or internal MCP servers to render arbitrary code inside a chat interface introduces severe security vulnerabilities, including cross-site scripting (XSS), session cookie theft, and internal token exfiltration. SEP-1865 enforces a strict browser isolation boundary:
- All
ui://resources must render inside an isolatediframeconfigured with restricted sandbox attributes (disallowing top-level navigation, same-origin storage access, and unmediated network calls). - Communication between the host application and the embedded UI component occurs exclusively over window
postMessageutilizing a lightweight JSON-RPC 2.0 protocol. - When an engineer clicks an action button within the visual component (such as “Approve Staged Rollout (Nodes 1-25)”), the UI issues a JSON-RPC request over
postMessage. The host application verifies user authorization and translates the event into a standard MCP tool invocation (such asexecuteStagedPatch()). At no point does the embedded UI gain direct access to the agent harness or host environment credentials.
3. The Three-Layer Agent Communications Stack: MCP, A2A, and AP2/x402
The introduction of specialized protocols across the industry has created architectural confusion regarding overlapping standards. AI Atlas’s research report The Agent Protocols Map establishes a coherent three-layer taxonomy demonstrating how MCP, A2A v1.0.1, and emerging payment standards operate as a vertical stack rather than competing alternatives.

Layer 1: Tool, Data, and UI Connection (MCP + SEP-1865)
Layer 1 governs the direct interface between an individual reasoning model and its immediate operational environment. MCP provides the standardized RPC pipeline for reading local files, querying internal databases, executing shell commands, and invoking REST APIs. With SEP-1865, Layer 1 extends upward to render ephemeral human-approval interfaces. MCP operates strictly within a single agent’s execution context.
Layer 2: Inter-Agent Collaboration (A2A v1.0.1)
Enterprise workflows frequently cross organizational and vendor boundaries, requiring agents running on different platforms to coordinate. Agent-to-Agent (A2A v1.0.1) governs horizontal federation:
- Capability Discovery: Agents discover peer services using decentralized agent registries and capability manifests.
- Task Delegation and Negotiation: A procurement agent within Company A can negotiate contract deliverables, delivery schedules, and service-level agreements (SLAs) with a vendor logistics agent in Company B without exposing either company’s internal tool implementations or prompt harnesses.
Layer 3: Economic Settlement and Payment Authorization (AP2 / x402 / ACP)
When inter-agent transactions require financial settlement, agents must operate within explicit legal and cryptographic boundaries. Layer 3 protocols—including Agent Payment Protocol (AP2), HTTP 402 payment extensions (x402), and Agent Commerce Protocol (ACP)—provide the authorization layer:
- Cryptographic Spending Caps: Human principals issue time-bound, budget-constrained cryptographic authorizations (e.g., authorizing a research agent to spend up to $25.00 across third-party data APIs).
- Autonomous Settlement: Agents exchange machine-readable payment proofs directly over HTTP status code 402 (“Payment Required”), establishing auditable commercial receipts without requiring manual human credit card entry for micro-transactions.
In an end-to-end enterprise workflow, Layer 1 (MCP) allows an internal procurement agent to query enterprise ERP inventory, Layer 2 (A2A) allows that agent to negotiate volume pricing with an external supplier agent, and Layer 3 (AP2/x402) settles the resulting invoice under predetermined executive spending limits.
4. State Ownership Architecture: 100% Stateless MCP, Frameworks, and Harnesses
Beyond protocol layering, system stability hinges on clear boundaries for state management. MarkTechPost’s systems audit Agent Harness vs Agent Framework vs MCP: Who Owns State? reveals that attempting to store conversational state or execution progress inside MCP servers is a primary cause of agent failure.

To maintain reliable, horizontally scalable multi-agent systems, engineering teams must partition state across three distinct architectural tiers:
1. The MCP Layer: 100% Completely Stateless
MCP servers must function as pure, stateless utility providers. Storing in-memory session variables, active client handles, or multi-turn execution caches on the MCP server creates state synchronization deadlocks, prevents serverless scaling, and corrupts state during container restarts.
- If an MCP tool requires continuity across invocations (such as paginating through a 10,000-row database query), the tool must return an opaque, encrypted token (a state handle) to the client.
- On the subsequent invocation, the agent client passes the handle back as a standard parameter. The MCP server decrypts the token, validates its signature, executes the request, and exits.
2. The Framework Layer: Durable Workflow Persistence
The Agent Framework (such as LangGraph, Semantic Kernel, or custom enterprise orchestrators) owns long-term workflow durability:
- High-stakes agent operations frequently pause for human approval, awaiting review for minutes, hours, or days.
- The framework serializes the agent’s graph state and writes durable checkpoints to reliable transactional databases (such as PostgreSQL or SQLite).
- If the host system reboots or the process terminates, the framework reloads the checkpoint from the database and resumes execution seamlessly.
3. The Harness Layer: Ephemeral Workspace and Context Management
The Agent Harness (the execution environment executing the model loop, such as Claude Code, Codex CLI, or OpenCode) manages the immediate physical workspace:
- The harness maintains ephemeral file copies, scratchpads, and git branch worktrees where the agent tests code.
- Crucially, the harness governs context window budgeting, executing automated compaction (Auto-compact) and sliding-window truncation to prevent context saturation without corrupting the underlying framework state.


Summary of Implementation Actions
Engineering teams deploying agent infrastructure should execute two immediate architectural improvements:
- Adopt SEP-1865 for Complex Tool Inspections: Replace multi-page text outputs for sensitive infrastructure actions with
ui://sandboxed components, reducing human verification latency to under one second while eliminating XSS risks. - Purge Internal State from MCP Servers: Enforce statelessness by converting internal state into signed, encrypted client tokens, delegating durability to database-backed framework checkpoints and workspace management to the agent harness.
Sources
- Model Context Protocol Official Extension Specification, “SEP-1865: MCP Apps (
io.modelcontextprotocol/ui)”: https://modelcontextprotocol.io/specification/draft/extensions/mcp-apps-sep-1865 - AI Atlas, “MCP vs A2A vs AP2, x402, ACP: The Agent Protocols Map”: https://aiatlas.io/reports/agent-protocols-map-mcp-a2a-ap2-x402
- MarkTechPost, “Agent Harness vs Agent Framework vs MCP: Who Owns State?”: https://www.marktechpost.com/articles/agent-harness-vs-framework-vs-mcp-state