Dev.to AI 🤖 Ai 👁 0 📖 7 min read

Elementum: An AI-Native UI Platform with Built-in MCP, Agent Runtime & 109 Zero-Dep Web Components

When you build modern web applications (especially AI-assisted or agentic ones), you usually end up wiring together half a dozen separate tools: a UI component library, a framework-specific wrapper layer, custom chat/str

When you build modern web applications (especially AI-assisted or agentic ones), you usually end up wiring together half a dozen separate tools: a UI component library, a framework-specific wrapper layer, custom chat/streaming/tool-call widgets, an accessibility test harness, and ad-hoc instructions for your AI coding assistant.

Elementum (@wcomp/[email protected]) brings all of those pieces together into one open-source, zero-dependency UI engineering platform built on standard Web Components.

In this walkthrough, I'll cover what makes Elementum different, show real code examples you can run immediately in live Vercel demos or StackBlitz, and share our automated 3-way comparison of building the exact same app in React, Vue 3, and Vanilla JS.

1. Built-in Model Context Protocol (MCP) Server (Stdio + Vercel Edge)

Elementum ships with its own Model Context Protocol (MCP) server (2025-03-26 / 2025-06-18 compliant) so coding assistants like Claude Code, Cursor, Gemini CLI, and Copilot can inspect the library directly instead of guessing prop names or slot structures.

Connect locally over stdio:

npx elementum-mcp

Or connect directly to the hosted Vercel Edge Streamable HTTP endpoint (zero cold starts):

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

You can also install Elementum's agent skills directly into your toolchain:

npx skills@latest add pinguxx/Elementum --skill elementum

Once connected, your AI assistant gets 10 read-only MCP tools to:

  • Query structured component schemas (get_component_doc) with cleanly separated variants, states, props, constraints, and examples (plus section filtering to keep context lean)
  • Validate markup against closed enum variants and required parent/child constraints (validate_component_usage)
  • Search W3C DTCG design tokens (list_tokens) for light & dark themes
  • Generate validated component snippets (generate_snippet) and scaffold new components (scaffold_component)
  • Run static WCAG 2.2 AA accessibility lint checks (lint_accessibility / validate_accessibility)

2. Semantic Agent Runtime (@wcomp/elementum/agent)

Automating or testing Web Components inside Shadow DOM often requires fragile selectors. Elementum includes a lightweight, Shadow-DOM-piercing runtime bridge with two clean primitives:

  • snapshot(root): builds a structured semantic accessibility tree across Shadow DOM boundaries
  • act(root, command): executes semantic actions (click, type, toggle, open, close) directly against live components
import { snapshot, act } from '@wcomp/elementum/agent';

// 1. Inspect the live UI semantically (pierces Shadow DOM)
const tree = snapshot(document.body);
console.log(tree);

// 2. Drive the UI with semantic commands
act(document.body, { role: 'textbox', name: 'Agent Name', action: 'type', value: 'Atlas' });
act(document.body, { role: 'switch', name: 'Auto Approve', action: 'toggle' });
act(document.body, { role: 'button', name: 'Run Task', action: 'click' });

This makes browser-use agents, automated UI evaluation, and end-to-end testing significantly cleaner.

3. Dedicated AI UI Primitives (+ Live Demo & StackBlitz)

Rather than rebuilding chat composers, thought disclosures, and tool-execution logs from scratch, Elementum ships accessible AI primitives out of the box:

  • <el-prompt-input>: auto-expanding prompt composer with tool/model slots and Enter-to-submit
  • <el-reasoning-card>: collapsible thought disclosure with active breathing pulse & duration timer
  • <el-tool-call>: AG-UI compatible tool call visualizer with collapsible JSON args, results, status badges, and Human-in-the-Loop (HITL) approvals
  • <el-streaming-text>: smooth token-by-token streaming text with customizable cadence
  • <el-sources>: grounding citation pills and expandable source cards for RAG apps
  • <el-diff-viewer>: unified and side-by-side code diff viewer

Here is a complete zero-build AI chat interface using these components:

<div class="chat-layout">
  <el-reasoning-card id="reasoning" summary="Reasoning Process" open thinking>
    Analyzing prompt and querying documentation...
  </el-reasoning-card>

  <el-tool-call
    id="tool-call"
    name="search_docs"
    status="completed"
    args='{"query": "asyncSignal AbortSignal"}'
    result='{"matches": 2, "status": "ok"}'
  ></el-tool-call>

  <el-card bordered>
    <el-streaming-text
      id="stream-output"
      speed="18"
      text="Elementum combines 109 zero-dependency Web Components with micro-signals, DSD SSR, and MCP tooling."
    ></el-streaming-text>
  </el-card>

  <el-sources
    id="sources"
    label="Verified Sources"
    sources='[{"title":"Elementum Docs","url":"https://elementum-sage.vercel.app/docs.html","domain":"elementum-sage.vercel.app"}]'
  ></el-sources>

  <el-prompt-input
    id="prompt-input"
    placeholder="Ask the AI agent anything..."
  ></el-prompt-input>
</div>

Try the AI Chat Starter Live

Elementum also includes an AG-UI protocol adapter (@wcomp/elementum/ag-ui) with RFC 6902 JSON Patch state deltas so SSE streams from agent backends bind directly to reactive micro-signals.

4. Two-Way Penpot MCP Design Sync

Design-to-code handoff is built directly into the platform using the open-source W3C Design Tokens Community Group (DTCG) format:

  • Code -> Penpot: Sync W3C DTCG tokens and Master Components directly into an open Penpot file via MCP (npm run penpot:mcp).
  • Penpot -> Code: Compile exported Penpot tokens into src/tokens.css (npm run tokens:sync) or generate full validated Elementum applications (npm run penpot:generate).

You can see the end-to-end result in our LedgerFlow fintech dashboard demo, compiled from Penpot into 15 live Elementum components.

5. Pure Node.js Declarative Shadow DOM (DSD) SSR

Elementum renders Shadow DOM on the server in pure Node.js (no jsdom or happy-dom required) using standard <template shadowrootmode="open"> markup for zero Cumulative Layout Shift (CLS):

import { renderComponentToDSD } from '@wcomp/elementum/ssr';

const html = renderComponentToDSD('el-button', {
  variant: 'primary',
  children: 'Server Rendered Button',
});

console.log(html);
// <el-button variant="primary"><template shadowrootmode="open">...</template>Server Rendered Button</el-button>

6. One Library Across React, Vue 3, Svelte 5 & Vanilla (3-Way Comparison)

Because every component is a standard Custom Element with Form-Associated Custom Elements (ElementInternals) and Constructable Stylesheets, you can use Elementum in any stack, including official strictly-typed React 18 & 19 wrappers via @wcomp/elementum/react.

To test how consistent the developer experience is across frameworks, we built the exact same interactive Team Directory app (using <el-card>, <el-badge>, <el-button>, <el-theme-switch>, <el-input>, <el-select>, <el-table>, <el-dialog>, and <el-toaster>) three times and automated the measurements via npm run bench:frameworks:

Metric React (@wcomp/elementum/react) Vue 3 (Native Custom Elements) Vanilla (Micro-Signals + CDN)
App File src/App.jsx src/App.vue index.html (full app)
Non-Empty LOC (Total) 103 (112) 90 (101) 98 (108, includes HTML shell)
App Source (Raw / Gzip) 4.20 KB / 1.36 KB 3.86 KB / 1.30 KB 4.54 KB / 1.51 KB
Build Step Vite Vite None (0 build)
Live Demo Live React App Live Vue 3 App Live Vanilla App
Sandbox StackBlitz StackBlitz StackBlitz

React (@wcomp/elementum/react) Example

The auto-generated React wrappers handle forwardRef, boolean attributes, useLayoutEffect pre-paint object/array prop sync (with automatic reset on prop removal), CustomEvent mapping, and strict TypeScript types (zero [prop: string]: any escape hatches):

import { ElButton, ElInput, ElTable, ElDialog } from '@wcomp/elementum/react';

export function TeamTable({ columns, rows, onSelect }) {
  return (
    <ElTable
      selectable
      columns={columns}
      data={rows}
      onSelectionChange={(e) => onSelect(e.detail.selected)}
    />
  );
}

Vue 3 Example

Configure isCustomElement: (tag) => tag.startsWith('el-') in vite.config.js and use components directly:

<template>
  <el-card bordered>
    <h2 slot="header">Vue 3 + Elementum</h2>
    <el-switch :checked="enabled" @change="onToggle">
      Enable notifications
    </el-switch>
  </el-card>
</template>

All Interactive Starters (CI-Verified)

All starter projects are build-verified in CI via tools/verify-starters.js:

7. Verification, Visual Regression & Audit Hub

Every claim in Elementum is backed by an automated verification pipeline (npm run verify:all), an auto-generated QUALITY.md matrix, and a permanent AUDITS.md hub:

  • 109 / 109 Production Verified (100%): Every registered Custom Element passes catalog schema checks, unit instantiation, real-browser Playwright E2E (Chromium, Firefox, WebKit), and @axe-core/playwright WCAG 2.2 AA audits
  • 0 runtime dependencies and 2.24 KB avg gzip per component across 86 size-gated ESM entrypoints
  • Cross-theme Visual Regression: Automated Playwright screenshot regression (e2e/visual-regression.spec.js) across desktop/mobile and light/dark themes
  • Real React 18 & React 19 consumer verification (npm run verify:react) packing the actual .tgz tarball and running SSR, StrictMode, startTransition, ElementInternals forms, and strict tsc --noEmit --strict
  • Starter CI Gate (tools/verify-starters.js) ensuring all framework starters install, typecheck, and build cleanly

Try It Out

# Install the package
npm install @wcomp/elementum

# Or connect the MCP server to your coding agent
npx elementum-mcp

If you're building AI interfaces, design systems, or framework-independent frontends, I'd love to hear your feedback, especially on what tools you'd like to see in the MCP server or the @wcomp/elementum/agent runtime!

📰 Read the original article on Dev.to AI

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