Skip to content

feat(docs): WebMCP — site as in-browser MCP server with the 3 neuron-js tools - #35

Merged
SebaSOFT merged 2 commits into
mainfrom
feat/webmcp-site
Sep 28, 2026
Merged

SebaSOFT merged 2 commits into
mainfrom
feat/webmcp-site

Conversation

@SebaSOFT

Copy link
Copy Markdown
Owner

What

El sitio de documentación se convierte en servidor MCP en el browser del visitante. Cualquier MCP client (Claude Desktop, Cursor, Cline, Windsurf) se conecta via el widget WebMCP y llama los tools de neuron-js en la página — sin backend, sin API keys.

Piezas

  • docs/public/webmcp/webmcp.js — librería WebMCP vendored (jasonjmcghee/WebMCP, MIT), self-hosted. Sin CDN dependency.
  • docs/public/webmcp/neuron-webmcp.js — registra:
    • Los mismos 3 tools del server stdio: validate_script, execute_decision, explain_decision (mismo contrato fail-closed: valida script y context antes de ejecutar)
    • 1 prompt (pricing-rules example)
    • 2 resources (llms.txt, SKILL.md)
    • El runtime es el @sebasoft/neuron-js real desde npm (ESM de unpkg), ejecutándose en el browser del visitante — la librería es browser-safe (cero node: imports, verificado)
  • Head de VitePress carga ambos scripts en todas las páginas
  • docs/integrations/webmcp.md — guía completa: cómo conectar, tabla de tools, garantías, nota de provenance (librería ≠ draft W3C navigator.modelContext; cuando el spec nativo llegue, la página lo prefiere)
  • Sidebar + index de integrations + llms.txt + llms-full.txt + SKILL.md (mirror idéntico verificado)
  • tests/contracts/webmcp-site.test.ts — 5 contract tests de la superficie

Verificación real (no simulada)

  • Browser E2E con el build real servido por HTTP (base path /neuron-js/ como Pages): widget renderiza en cada página (div fixed bottom-right), WebMCP global presente
  • sessionStorage.webmcp_tools del browser real: los 3 tools + prompt + resources registrados
  • neuron-js ESM ejecutando en el browser: validScript:true, executed:true rulesExecuted:1, hasExplanation:true, invalidRejected:true — el mismo bundle ESM que sirve unpkg
  • Suite: 122/122 (23 archivos, +5 nuevos), docs:build verde

Nota de scope

La librería @jason.today/webmcp es el prototipo original (no conforme al W3C spec, su propio README lo aclara) — funciona hoy y demuestra el patrón; la guía documenta el estado real. Cuando navigator.modelContext llegue nativo, se prefiere.

Sin bump de versión: docs-only, no runtime code del paquete.

- docs/public/webmcp/webmcp.js: vendored WebMCP widget library
  (jasonjmcghee/WebMCP, MIT) served self-hosted, no CDN dependency.
- docs/public/webmcp/neuron-webmcp.js: registers the same three tools
  as the stdio server (validate_script, execute_decision,
  explain_decision) plus a pricing-example prompt and llms.txt /
  SKILL.md resources. The runtime is the real @sebasoft/neuron-js
  ESM from the npm registry executed in the visitor's browser; the
  library is browser-safe (zero node: imports). Fail-closed: every
  call validates script and context first.
- VitePress head loads both scripts on every page.
- docs/integrations/webmcp.md guide: connect instructions for
  Claude Desktop/Cursor/Cline/Windsurf, tool table, guarantees,
  provenance note (library vs W3C navigator.modelContext draft).
- Sidebar, integrations index, llms.txt, llms-full.txt, SKILL.md
  (mirror kept identical) updated.
- tests/contracts/webmcp-site.test.ts: 5 contract tests over the
  integration surface.

Browser E2E verified: widget renders on every page; webmcp_tools in
sessionStorage shows the 3 tools + prompt + 2 resources registered;
the neuron-js ESM bundle executes a real script in-browser
(validateScript ok, execute ok rulesExecuted=1, explain trace,
invalid script rejected). Suite 122/122, docs:build green.
…istration

- Chrome origin-trial token for sebasoft.github.io (WebMCP feature,
  expires 2026-11-17) as http-equiv=Origin-Trial meta in the VitePress
  head: GitHub Pages cannot serve custom headers, so the meta tag is
  the enabling mechanism.
- Dual tool registration in neuron-webmcp.js: when the trial activates
  navigator.modelContext, the same three tools (validate_script,
  execute_decision, explain_decision) register through the native W3C
  API; the WebMCP widget remains the universal path for every browser.
- Same fail-closed contracts on both surfaces.
- Guide updated: two complementary surfaces documented honestly.
- Contract test extended: origin-trial presence + dual registration.

Verified: 6/6 webmcp contract tests, full suite green, docs:build with
Origin-Trial meta in dist/index.html, browser E2E shows the three tools
registered and the widget healthy; navigator.modelContext correctly
absent in headless (trial only activates in Chrome with the token).
@SebaSOFT
SebaSOFT merged commit 761a68a into main Sep 28, 2026
2 checks passed
@SebaSOFT
SebaSOFT deleted the feat/webmcp-site branch September 28, 2026 18:07
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