Skip to content

feat: WebMCP Workbench Chrome side-panel extension - #24

Open
liady wants to merge 5 commits into
mainfrom
feat/extension
Open

feat: WebMCP Workbench Chrome side-panel extension#24
liady wants to merge 5 commits into
mainfrom
feat/extension

Conversation

@liady

@liady liady commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What

A new apps/webmcp-workbench Chrome MV3 side-panel extension — a WebMCP devtools workbench that inspects a page's registered tools, runs them through schema-driven forms, and lints them with the same rules as the webmcp-verify CLI. No AI agent, no LLM providers — devtools only.

How

  • packages/webmcp-verify refactor (additive, CDP path unchanged): new src/page-fns.ts holds the page logic as self-contained functions (readToolsInPage / runToolInPage); page.ts derives the CLI's CDP expression strings from them via toString(); verify.ts exports normalizeListResult / normalizeExecuteResult; browser-safe ./verify and ./page-fns subpath exports (the root still pulls Node-only chrome-launcher and must not enter the bundle).
  • The extension injects those functions into the page's MAIN world via chrome.scripting.executeScript({world:"MAIN", func}) — CSP-proof (no eval), zero content scripts, no message bridge. CLI and panel share one page contract.
  • Vite + @crxjs + React; build.target: esnext pinned so the injected functions aren't down-leveled into unserializable helper refs.
  • tabs + host_permissions (not activeTab, which never applies from a side panel); background is one setPanelBehavior call.

Also fixed along the way (found by the E2E)

  • Chrome 152 compat: DevToolsWebMCPSupport no longer exists and its presence invalidates the whole --enable-features list; WebMCPTesting alone works on 151+152 (152 ships WebMCP on by default). WEBMCP_CHROME_FLAGS, guidance text, and docs updated.
  • Bookshop fixture: Chrome ~151 calls execute(input) with one argument; the spec-shape { signal } destructure threw. Context param now defaults.

Verification

  • webmcp-verify: 17/17 Vitest, lint, typecheck, build green (CDP contract tests updated to the toString-derived expressions; same safety properties).
  • Automated E2E (apps/webmcp-workbench/scripts/e2e.mjs, 15/15 on Chrome for Testing 152): loads the built extension, opens the real side panel via user-gesture eval, and drives Inspect (search_books + read-only badge + schema) → Run (schema form → parsed {"matches":[…]} + raw DOMString) → Audit (clean) → 0-tools and WebMCP-not-detected states. Branded Chrome ≥137 ignores --load-extension, so the script needs CHROME_PATH pointed at Chrome for Testing (documented in the script).
  • node scripts/check.mjs green; bridge tests untouched and green (13/13).

Legal

Clean-room build on our own webmcp-verify code; informed by observing nekuda's extension behavior, no code copied. MIT.

🤖 Generated with Claude Code

liady and others added 5 commits August 31, 2026 19:56
…on reuse

- src/page-fns.ts: self-contained readToolsInPage/runToolInPage functions
  (injectable via chrome.scripting.executeScript world:MAIN)
- src/page.ts: expression strings now derived from those functions via
  toString(), keeping the CDP/CLI contract identical
- src/verify.ts: extract normalizeListResult/normalizeExecuteResult so the
  CLI and workbench extension share result handling
- package.json: browser-safe ./verify and ./page-fns subpath exports

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Vite + @crxjs/vite-plugin + React MV3 extension in apps/webmcp-workbench.
Reaches the page's document.modelContext by injecting the self-contained
page-fns from @ora-ai/webmcp-verify via chrome.scripting.executeScript
(world: MAIN) — CSP-proof, no content scripts, no eval. Inspect / Run
(schema-driven forms) / Audit (lintTools) views plus a StatusBar with
explicit WebMCP-not-detected guidance. build.target esnext + esbuild
chrome110 keep the injected functions serializable (no helper refs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tures

On Chrome 152 the retired feature name invalidates the whole
--enable-features list, leaving WebMCP off; WebMCPTesting alone works on
151 and 152 (both verified empirically; 152 also ships WebMCP on by
default). Update WEBMCP_CHROME_FLAGS, the no-modelcontext guidance, and
docs to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…xt arg

Chrome ~151 invokes tool execute(input) with a single argument (verified
by probe); the spec-shape destructure of { signal } from a missing second
argument made both bookshop tools throw. Default the context object and
optional-chain throwIfAborted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scripts/e2e.mjs serves the bookshop fixture, launches Chrome with the
built extension (needs a --load-extension-capable binary, e.g. Chrome
for Testing; branded >=137 ignores the switch), opens the real side
panel via a user-gesture eval, and drives Inspect -> Run -> Audit plus
the 0-tools and WebMCP-not-detected states. 15 checks, all passing on
Chrome for Testing 152.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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