Skip to content

AI-Native Development

IWSDK is built from the ground up for AI-assisted immersive web development. AI agents can see, interact with, and debug your WebXR experience through 32 MCP (Model Context Protocol) tools — screenshots, controller input, scene inspection, ECS (Entity-Component-System) debugging, and more.

How It Works

When you enable AI in your Vite config, the plugin sets up three things automatically:

  1. Playwright Browser — A managed Chromium instance that loads your app and provides screenshots and console capture for the AI agent.
  2. MCP Server — A local server that exposes 32 tools for controlling the emulated XR runtime, inspecting the scene, and debugging ECS state.
  3. MCP Config Files — Auto-generated config files (e.g., .mcp.json for Claude) so your AI tool discovers the server on startup.
text
┌──────────────────────┐
│  AI Tool             │
│  (Claude, Cursor...) │
└──────────┬───────────┘
           │ MCP protocol (stdio)
┌──────────▼───────────┐
│  MCP Server          │◄── screenshots, console logs
└──────────┬───────────┘
           │ WebSocket
┌──────────▼───────────┐     ┌──────────────────────┐
│  Vite Dev Server     │────►│  Normal Browser      │
│                      │     │  (developer)         │
└──────────┬───────────┘     └──────────────────────┘

┌──────────▼───────────┐
│  Playwright Browser  │
│  (managed)           │
└──────────────────────┘

The AI agent communicates with the MCP server over stdio. The server relays commands to the Playwright browser via WebSocket, where the IWER runtime processes them (move controllers, trigger inputs, query state). Screenshots and console logs are captured server-side through Playwright's CDP integration — no browser round-trip needed.

Your normal browser runs independently with its own XR session, so you can develop and test manually while the agent works in the background.

Additional MCP Servers

The plugin can auto-register additional MCP servers alongside iwsdk-dev-mcp:

  • iwsdk-rag-local — If @felixtz/iwsdk-rag-mcp is installed, a local RAG server is registered that provides semantic code search and IWSDK API knowledge. The embedding model is downloaded and cached on first startup.
  • hzdb — If @meta-quest/hzdb is installed, the hzdb MCP server is registered. This provides Meta Quest device management, 3D asset search from Meta's asset library, and IWSDK documentation lookup.

These appear automatically in the generated MCP config files when the corresponding packages are present in node_modules.

Three Modes

IWSDK supports three usage modes, each optimized for a different workflow:

ModeDescriptionPlaywrightDevUIBrowser
AgentAI works autonomously in the backgroundHeadless, fixed viewportOffNormal browser opens
OversightYou watch the AI work in real timeVisible, resizableOffPlaywright is the browser
CollaborateYou and the AI share the same sessionVisible, resizableOnPlaywright is the browser

Agent mode is the default — the AI operates in a headless browser optimized for screenshots while you develop in your normal browser. Switch to oversight or collaborate when you need visibility or hands-on interaction with the agent's session.

See Modes for the full deep dive.

What Can the Agent Do?

The MCP server exposes tools across several categories:

  • Session — Accept, monitor, and end XR sessions
  • Transforms — Position and orient the headset, controllers, and hands
  • Input — Trigger selects, manipulate gamepad buttons and axes, switch input modes
  • Browser — Take screenshots, read console logs, reload the page
  • Scene — Inspect the Three.js scene hierarchy and object transforms
  • ECS — Pause/step the simulation, query entities, diff state snapshots

See MCP Tools Reference for the complete list.

Next Steps

Privacy | Terms