Linux VM: Idle WebMCP: Checking…

Browser-Delivered Linux 7.x · Headless Worker + 9p MemoryFs + WebMCP

Headless Browser Linux & WebMCP Custom UI

Running a full Linux 7.x kernel inside a browser Dedicated Worker via Unkernel and WebAssembly JSPI does not require exposing a raw terminal window. This lab mounts a reactive 9p MemoryFs at /work, powers native web cards with real BusyBox awk, grep, and vsock loopback HTTP (vm.fetch()), and exposes five typed WebMCP tools with zero server compute and zero external guest network sockets.

Why this matters

Terminal emulators force both people and language models to parse unstructured text, ANSI codes, and fragile column layouts. Putting a real Linux kernel behind a Dedicated Worker lets standard POSIX utilities execute locally while the UI and WebMCP layer exchange typed JSON.

What this opens up

Client-side apps delivered as static URLs that run real Linux tooling over in-memory files, serve guest loopback previews over vsock without opening network sockets, snapshot and restore kernel memory in milliseconds, and expose deterministic tools to browser agents.

How to test it

Click Boot Linux 7.x VM (or wait for auto-boot), edit sales-q4.csv or site/index.html in the File Explorer, run live BusyBox awk analytics, grep search, and vm.fetch() preview, then compare WebMCP JSON against raw shell stdout.

Linux 7.x Worker Runtime

Dedicated Worker loading /vendor/unkernel/0.3.0-261202-b033dc7/web.mjs (112 MiB RAM, JIT enabled, external net disabled).

Kernel Pending boot
Boot Time —
Guest Network Disabled (vsock only)
9p Mount /work (4 seed files)

3 Things To Try

1. Live CSV Analytics via BusyBox awk

Executes awk inside the browser Linux VM over /work/sales-q4.csv and updates the visual KPI cards and regional table. Edit a row in the File Explorer and re-run to verify reactive 9p updates.

2. Loopback HTTP via vm.fetch()

Starts a BusyBox loopback HTTP server serving /work/site on guest port 8080 and fetches http://localhost:8080/ over vsock—zero network sockets opened.

3. Snapshot Kernel RAM, Mutate & Restore

Captures a live kernel checkpoint via vm.snapshot(), mutates /tmp/checkpoint-state.txt and /work/notes.md from inside Linux, then rolls both back via createKernel({ restore }).

Reactive 9p File Explorer (/work)

Backed by MemoryFs and live mem.onChange() notifications

0 bytes
mem.onChange() & Host Sync Feed 0 events

    Project Search (BusyBox grep -rnF)

    Runs vm.exec("grep", ...) directly across /work

    Idle

    Visual CSV Analytics (BusyBox awk)

    Real vm.exec("awk", ...) aggregation over /work/sales-q4.csv

    Idle
    Net Revenue $0.00
    Gross Revenue $0.00
    Units Sold 0
    Wire Bytes 0 B
    Region Lines Units Gross USD Net USD Avg Net Price Share

    Loopback Service Preview (vm.fetch())

    Serves /work/site on guest 127.0.0.1:8080 over vsock—zero network sockets

    Stopped
    Safe DOM-Rendered Guest HTML Preview Not fetched yet
    Click Fetch localhost:8080 to start the guest loopback service and render /work/site/index.html.
    Raw HTTP response body from vm.fetch("http://localhost:8080/") appears here.

    Structured WebMCP JSON vs. Raw Shell Stdout Comparator

    Executes the same Q4 CSV analytics query twice inside Linux 7.x—once returning typed WebMCP JSON and once returning a human-formatted ASCII table—measuring exact wire bytes, parse stability, and real vm.exec() latency.

    Metric WebMCP Typed JSON Raw Linux Shell Stdout Observed Difference
    Wire Payload Size — — Run comparison to measure real bytes
    Structured WebMCP JSON Output
    Click "Run Side-by-Side Comparison" to execute both lanes inside Linux 7.x.
    Raw Linux Shell Table Stdout
    Raw BusyBox awk table stdout appears here.

    WebMCP Tool Surface & Optional Live LLM Agent Runner

    Registers 5 typed tools via navigator.modelContext?.registerTool (with automatic local registry fallback) so browsers and optional LLM backends drive the Linux VM without screen-scraping a terminal.

    5 tools pending

    1. Direct Typed Tool Invoker

    Ready
    Tool invocation output appears here.

    2. Optional Live LLM Backend (Zero Server Keys)

      Optional Raw Linux Console Peek (No default terminal — click to verify uname -a & kernel boot log)
      Real Linux 7.x kernel verification inside Dedicated Worker
      Open this panel and click "Run uname -a & /proc/version" after boot to inspect real Linux kernel output.
      Browser Tab · Single Origin · Zero Server Compute No default terminal — structured RPC & typed WebMCP tools over Dedicated Worker
      MAIN THREAD

      Custom Web UI + WebMCP

      navigator.modelContext.registerTool()

      Reactive Explorer, CSV Charts, Search, Loopback Preview, and Optional LLM Runner.

      analyze_csv_with_awk search_project preview_guest_http
      DEDICATED WORKER

      vm-worker.js → Linux 7.x

      unkernel.wasm · 112 MiB · JIT · JSPI

      Runs BusyBox awk, grep, loopback HTTP, and vm.snapshot() with no external net.

      vm.exec() vm.fetch("localhost:8080") vm.snapshot()
      9P MEMORYFS

      Mounted at /work

      mem.onChange() reactive bridge

      Bidirectional file tree shared between host UI and Linux guest without uploading user bytes.

      sales-q4.csv notes.md site/index.html config.json

      Cloudflare Edge Worker src/worker.ts + Static Assets

      Static Delivery Only

      Serves HTML with strict CSP ('wasm-unsafe-eval', worker-src 'self' blob:) and delivers immutable cached /vendor/unkernel/0.3.0-261202-b033dc7/unkernel.wasm directly from Static Assets. Zero user files or Linux commands ever leave the browser.

      All Linux process execution, 9p file operations, vsock loopback HTTP fetches, and kernel memory checkpoints run locally inside the browser Dedicated Worker.
      Key terms & further reading
      Unkernel (Linux 7.x in WebAssembly)
      A Linux 7.x kernel compiled to WebAssembly with an embedded BusyBox initramfs, vsock transport, 9p host mounts, and live memory snapshots.
      WebAssembly JSPI
      JavaScript Promise Integration (WebAssembly.Suspending) lets the compiled Linux kernel suspend on host I/O and resume cleanly inside a Dedicated Worker.
      WebMCP (navigator.modelContext)
      Browser API allowing web pages to register typed JSON-schema tools (registerTool) so agents invoke structured operations instead of scraping terminals or DOM text.
      Dedicated Worker + 9p MemoryFs
      Runs the Linux VM off the UI thread while mounting a host JavaScript MemoryFs at /work with live onChange() notifications.
      Port Authority AI Router
      Optional client-side MessagePort router (https://llmchannel.dev/router.js) letting the user connect their own model to drive WebMCP tools with zero server-held keys.
      How This Is Set Up

      Headless Linux Worker + WebMCP Tool Registration

      Replacing a raw terminal emulator with a Dedicated Worker running real Linux 7.x, a 9p MemoryFs mounted at /work, and typed navigator.modelContext tools.

      Terminal-first shell scraping (fragile)
      // Piping commands into an xterm.js PTY mixes prompts, ANSI escapes, and data:
      vm.write("awk -F, '...' /work/sales-q4.csv\n");
      // Callers must guess when stdout finishes and regex-parse ASCII tables:
      const raw = await readUntilPrompt(vm.output);
      const rows = raw.split("\n").filter((l) => /^[A-Z]+/.test(l));
      Headless Worker + typed WebMCP tool
      // Dedicated Worker boots Linux 7.x with 9p MemoryFs and zero external net:
      const mem = new MemoryFs(seedTree);
      mem.onChange((ev) => postMessage({ event: "fs_change", ev }));
      const vm = await createKernel({ memoryMiB: 112, jit: true, mounts: { "/work": mem } });
      
      // Structured process execution + loopback HTTP over vsock:
      const res = await vm.exec("awk", ["-F,", program, "/work/sales-q4.csv"]);
      const preview = await vm.fetch("http://localhost:8080/");
      WebMCP Tool Registration & Kernel Snapshot/Restore Wiring
      // public/app.js — Register typed tools via WebMCP when supported, plus local registry:
      for (const spec of WEBMCP_TOOLS) {
        localRegistry.set(spec.name, spec);
        if (typeof navigator.modelContext?.registerTool === "function") {
          navigator.modelContext.registerTool({
            name: spec.name,
            description: spec.description,
            inputSchema: spec.inputSchema,
            execute: (args) => invokeWebMcpTool(spec.name, args),
          });
        }
      }
      
      // public/vm-worker.js — Snapshot kernel RAM + /work files, then restore in milliseconds:
      const snap = await vm.snapshot();
      await vm.stop();
      vm = await createKernel({ restore: snap, mounts: { "/work": restoredMem } });
      What disappears

      Mandatory terminal chrome, server-side sandboxes for basic CSV/grep processing, and brittle regex parsers scraping human-formatted shell output.

      What becomes explicit

      Mounted /work file boundaries, typed JSON schemas per WebMCP tool, vsock-only loopback HTTP (0 external sockets), and exact vm.exec() timing.

      Platform requirements

      Requires WebAssembly JSPI (WebAssembly.Suspending) in the browser engine and CSP script-src 'wasm-unsafe-eval' plus worker-src 'self' blob:.