Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

MCP, AG-UI, and A2UI: How the Three AI-UI Protocols Fit Together (With Live Zero-Dep Demos)

If you have been building AI interfaces in 2026, you have probably seen three acronyms show up in the same week: MCP, AG-UI, and A2UI. A common question from frontend engineers is: "Are these competing standards? Which

MCP, AG-UI, and A2UI: How the Three AI-UI Protocols Fit Together (With Live Zero-Dep Demos)

If you have been building AI interfaces in 2026, you have probably seen three acronyms show up in the same week: MCP, AG-UI, and A2UI.

A common question from frontend engineers is: "Are these competing standards? Which one should I pick?"

The short answer is they do not compete. They solve three different layers of the AI-to-UI lifecycle:

Layer Protocol When It Runs What It Solves
1. Build / Prompt Time MCP (Model Context Protocol) While a coding agent writes your app Gives the agent verified component schemas, design tokens, and WCAG checks so it stops hallucinating props.
2. Runtime Event Stream AG-UI (Agent-User Interaction) While an agent executes a task Streams lifecycle events, reasoning steps, tool-call approvals (HITL), and RFC 6902 JSON Patch state deltas.
3. Runtime Declarative UI A2UI (Agent-to-UI) When an agent generates UI on the fly Streams structured JSON component trees into a locked client catalog with zero executable code and zero innerHTML.

In @wcomp/[email protected], we implemented all three layers on top of a single zero-dependency Web Components foundation (109 WCAG 2.2 AA components that work in React 18/19, Vue 3, Svelte 5, Next.js, and Vanilla HTML).

Here is how each layer works in practice, with live browser demos you can inspect right now.

Layer 1: MCP (Verifiable Component Contract at Build Time)

When an AI coding agent generates UI from memory, it invents attribute names, misses ARIA labels, and forgets responsive layouts.

Elementum exposes its W3C Custom Elements Manifest (custom-elements.json), design tokens, markup validator (validate_component_usage), and static accessibility linter (lint_accessibility) over a hosted Vercel Edge MCP endpoint (100/100 on mcptry.com):

https://elementum-sage.vercel.app/mcp

You can configure any project (React, Next.js, Vue, Svelte, or Vanilla) in one command:

npm install @wcomp/elementum && npx @wcomp/elementum init

Or connect Claude Code directly:

claude mcp add --transport http elementum https://elementum-sage.vercel.app/mcp

In our reproducible 4-Arm AI-Agent UI Benchmark scored in headless Chromium with @axe-core/playwright, Elementum arms achieved 0px desktop and mobile overflow and 0-1 severe WCAG violations, compared to 69px-585px mobile overflow and 5-8 severe WCAG violations in conventional CSS and raw HTML baselines.

Layer 2: AG-UI (Runtime Execution, Tool Approvals & JSON Patch State)

Once your app is deployed, users interact with live agents that think, call tools, request human approval, and update application state incrementally.

@wcomp/elementum/ag-ui provides a zero-dependency reactive store (createAgUiStore) that consumes Server-Sent Events (SSE) and applies RFC 6902 JSON Patch STATE_DELTA updates straight to Elementum micro-signals without Virtual DOM re-render cascades:

import '@wcomp/elementum/tokens.css';
import '@wcomp/elementum';
import { createAgUiStore } from '@wcomp/elementum/ag-ui';

const store = createAgUiStore();

store.dispatch({
  type: 'STATE_DELTA',
  delta: [{ op: 'replace', path: '/progress', value: 80 }],
});

Layer 3: A2UI (Safe Declarative Agent UI at Runtime)

Sometimes a fixed chat bubble is not enough. An agent helping a user rebook a flight or adjust a billing cap should render real seat chips, switches, meters, and confirmation buttons without executing untrusted HTML or JavaScript.

@wcomp/elementum/a2ui (createA2UiSurface) maps streaming A2UI JSONL messages (dataModelUpdate, surfaceUpdate, beginRendering, deleteSurface) onto a locked catalog of native Elementum Web Components:

import '@wcomp/elementum/tokens.css';
import '@wcomp/elementum';
import { createA2UiSurface } from '@wcomp/elementum/a2ui';

const surface = createA2UiSurface({
  allowedTypes: ['Card', 'Column', 'Text', 'ChoiceChip', 'Button'],
  onAction: (ev) => console.log('Agent action:', ev.actionName, ev.context),
});

surface.mount(document.getElementById('a2ui-host'));
surface.processMessage(chunkFromStream);

Key security guarantees built in:

  1. Locked Catalog Allowlist: Unregistered or disallowed node types (like script/iframe tags) are silently dropped and reported in surface.blockedTypes.value.
  2. Zero innerHTML: All text and labels bind via textContent and fine-grained signal effects.
  3. Inline Handler & URL Stripping: on* attributes and javascript:/data: URLs are rejected automatically.

Explore the Full 4-Chapter Platform Story

If you want to see how design tokens (Penpot/Figma), framework parity (React 19, Vue 3, Next.js DSD SSR, Vanilla HTML), and the 3 AI protocols fit together in one place, start here:

  <link rel="stylesheet" href="https://unpkg.com/@wcomp/elementum/tokens.css" />
  <script type="module" src="https://unpkg.com/@wcomp/elementum"></script>

If you try npm install @wcomp/elementum && npx @wcomp/elementum init in a real project, I would genuinely love your first-attempt feedback as we harden the path toward 1.0.0.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.