Skip to content

🤖 feat(web): add W3C WebMCP browser AI agent integration (useWebMCP) - #42

Merged
thenom merged 2 commits into
mainfrom
feat/webmcp-exploration
Nov 12, 2026
Merged

thenom merged 2 commits into
mainfrom
feat/webmcp-exploration

Conversation

@thenom

@thenom thenom commented Nov 12, 2026

Copy link
Copy Markdown
Owner

🤖 AI Agent / LLM Disclosure

This Pull Request was developed and generated with the assistance of an AI Agent (Google DeepMind Antigravity):

  • Prompt / Context: Evaluate whether W3C WebMCP (document.modelContext / navigator.modelContext) is a viable integration for the Star Citizen Keybinding Management Suite (sc-controller-mapper), design the client-side tool capabilities, implement the hook and diagnostic UI on a new branch (feat/webmcp-exploration), and add unit + E2E test coverage.
  • Tools Used: Web search (search_web for W3C WebMCP specification & polyfill patterns), workspace file analysis (read_file, write_file, edit_file), Vitest unit test runner, TypeScript compiler (tsc -b), and Vite production build verification.
  • Verification Steps:
    • Executed npm test across the monorepo (22 test files / 223 unit & component tests passing, including 7 comprehensive tests in apps/web/src/hooks/useWebMCP.test.tsx).
    • Executed npm run build across @sc-mapping/shared-types, @sc-mapping/parser, @sc-mapping/resolver, and @sc-mapping/web (clean TypeScript build and Vite production bundle).
    • Added Playwright E2E test in e2e/app-workflow.spec.ts verifying document.modelContext.getTools(), document.modelContext.executeTool('set_action_binding', ...), and the interactive WebMCP diagnostic runner inside the Contributor Tools modal.

Summary of Changes

  1. W3C WebMCP Integration (apps/web/src/hooks/useWebMCP.ts):
    • Exposes 9 structured, JSON-Schema-typed tools on document.modelContext and navigator.modelContext with zero external runtime dependencies and automatic polyfill support:
      • get_profile_summary (read): Profile metadata, target game version (GAME_METADATA), joystick hardware list, jsX_ remap table, action counts, and conflict summary.
      • audit_conflicts (read): Runs ConflictResolver.auditDocument with deviceScope (js, kb, all), severity (Fatal, Warning, Redundant, all), and limit filters.
      • search_bindings_and_catalog (read): Searches across all 50 Star Citizen action maps in both the loaded XML profile and CatalogManager by keyword, input code, mapName, masterFlightMode (SCM/NAV), and bindingState (bound/unbound/all).
      • find_unused_joystick_inputs (read): Identifies unused vs. bound buttons and axes on any joystick instance (js1..jsN).
      • set_action_binding (write): Updates <rebind> and <addbind> inputs with chorded modifier parsing (ActionMapsParser.parseInputDescriptor), preserves the <rebind input=""/> unbind invariant when cleared, and runs an immediate conflict delta check.
      • auto_fix_obsolete_conflicts (write): Automatically strips deprecated legacy bindings (obsolete_collision) colliding with modern Star Citizen actions.
      • remap_joystick_instances (write): Updates or resets the js1..js8+ hardware remapping table to bypass Star Citizen's 4-device pp_resortdevices ceiling.
      • configure_joystick_options (write): Configures axis inversions, deadzones, sensitivities, and ProductGUID on <options type="joystick"> blocks.
      • workspace_control (write): Switches HUD tabs (matrix, inspector, conflicts), updates the live search query, loads starter HOSAS/HOTAS presets, or exports the lossless CryEngine XML string.
  2. Contributor Tools WebMCP Bridge Panel (apps/web/src/App.tsx):
    • Added an interactive WebMCP AI Agent Bridge (document.modelContext) diagnostic panel inside the Contributor Tools modal to inspect and test-run registered tools in the browser.
  3. Tests & Documentation:
    • Added unit test suite (apps/web/src/hooks/useWebMCP.test.tsx) and Playwright E2E test (e2e/app-workflow.spec.ts).
    • Updated AGENTS.md, README.md, docs/ARCHITECTURE_BLUEPRINT.md, and docs/PROJECT_STATE.md.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Deploying sc-controller-mapper with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ab3b4f
Status: ✅  Deploy successful!
Preview URL: https://abda58d6.sc-controller-mapper.pages.dev
Branch Preview URL: https://feat-webmcp-exploration.sc-controller-mapper.pages.dev

View logs

@thenom
thenom merged commit 3550ef5 into main Nov 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant