WebMCP on your site|INEMA.CLUB-PRO

In this lesson you will

  1. 1Clone the kit and install it with pinned versions
  2. 2Secure context: https in production, 127.0.0.1 for rehearsal
  3. 3The three modes: sem, polyfill, and nativo
  4. 4Origin trial and flag in your Chrome, when you want to see it live

Goal: set up the kit and see the same page in three modes (no API, polyfill, native) without spending quota or installing an experimental Chrome.

01The same page, three browsers

Click each mode.

The API only exists in a secure context: https or localhost/127.0.0.1. That is why the kit serves the page at 127.0.0.1.

Always test the No API mode: it is what most visitors see.

02Clone and install the kit

Versions pinned on 10/19/2026: @mcp-b/webmcp-polyfill 6.0.3 and playwright 1.64.0. The postinstall copies the polyfill to pagina/vendor/ (for rehearsal only).

Terminal · clone, install, and download Chromium
git clone -q https://github.com/inematds/formacao-webmcp-site-v72 ~/projetos/formacao-webmcp-site-v72
cd ~/projetos/formacao-webmcp-site-v72/kit
npm ci
npx playwright install chromium
echo "saída: $?"
Example from the repository
> kit-webmcp-no-seu-site@1.0.0 postinstall
> node scripts/copiar-polyfill.mjs

polyfill copiado para pagina/vendor/webmcp-polyfill.js

added 4 packages, and audited 5 packages in 1s

found 0 vulnerabilities
(…) barras de progresso cortadas
Downloading Chrome for Testing 156.0.8078.4 (playwright chromium v1248) from https://cdn.playwright.dev/builds/cft/156.0.8078.4/linux-arm64/chrome-linux-arm64.zip
Chrome for Testing 156.0.8078.4 (playwright chromium v1248) downloaded to ~/.cache/ms-playwright/chromium-1248
Downloading FFmpeg (playwright ffmpeg v1013) from https://cdn.playwright.dev/dbazure/download/playwright/builds/ffmpeg/1013/ffmpeg-linux-arm64.zip
FFmpeg (playwright ffmpeg v1013) downloaded to ~/.cache/ms-playwright/ffmpeg-1013
Downloading Chrome Headless Shell 156.0.8078.4 (playwright chromium-headless-shell v1248) from https://cdn.playwright.dev/builds/cft/156.0.8078.4/linux-arm64/chrome-headless-shell-linux-arm64.zip
Chrome Headless Shell 156.0.8078.4 (playwright chromium-headless-shell v1248) downloaded to ~/.cache/ms-playwright/chromium_headless_shell-1248
saída: 0

The first time, playwright install downloads Chrome for Testing 156.0.8078.4 (190.5 MiB), the headless shell (119.9 MiB), and FFmpeg (1.9 MiB); after that, it does not download again. The path (here linux-arm64) and the time change from machine to machine.

03What the page sees in each mode

ambiente.mjs opens the page in the three modes and reads: secure context, document.modelContext, the old name navigator.modelContext, and the on-screen notice.

Terminal · three modes
cd ~/projetos/formacao-webmcp-site-v72/kit
node scripts/ambiente.mjs; echo "saída: $?"
Example from the repository
== Chromium 156.0.8078.4 (Playwright) · modo: sem
contexto seguro: sim · document.modelContext: ausente · navigator.modelContext: ausente
página: sem · aviso: Este navegador não expõe WebMCP. Tudo funciona pelo formulário.
== Chromium 156.0.8078.4 (Playwright) · modo: polyfill
contexto seguro: sim · document.modelContext: presente · navigator.modelContext: ausente
página: com · aviso: WebMCP ativo: 4 ferramentas registradas.
== Chromium 156.0.8078.4 (Playwright) · modo: nativo
contexto seguro: sim · document.modelContext: presente · navigator.modelContext: ausente
página: com · aviso: WebMCP ativo: 4 ferramentas registradas.
saída: 0

In the No API mode, the page shows a notice and carries on through the form. In the other two, it registers 4 tools. In none of them does navigator.modelContext exist.

04See it in your Chrome (optional)

Experimental as of 10/19/2026. Nothing here is a done-when criterion.

1. Flag

Open chrome://flags/#enable-webmcp-testing, turn it on, and restart Chrome.

Run the kit's server and open the URL it prints.

Servercd kit && node scripts/servir.mjs

05Practice

All local, no cost. Each exercise ends with a done when.

E1 · Kit installed

10 min

Clone the course repository into ~/projetos and install the kit with the block above.

Done when: The block ends with saída: 0 and ls ~/projetos/formacao-webmcp-site-v72/kit/pagina/vendor shows webmcp-polyfill.js.

E2 · Three modes

3 min

Run ambiente.mjs and compare the three "página:" lines.

Done when: node scripts/ambiente.mjs; echo "saída: $?" → página: sem, página: com, página: com and saída: 0.

E3 · Does the "sem" mode break?

5 min

Run node scripts/servir.mjs, open the URL in the browser you use every day (no flag), and do a search and a booking through the screen.

Done when: The search shows results and the booking appears in "Minhas reservas" with no tool registered.

06Lesson quiz

The explanation appears after your answer.

Question 1 of 4

Why does the kit serve the page at 127.0.0.1 instead of opening the file directly?

07In three sentences

KitOne clone, npm ci and Playwright's Chromium: no experimental Chrome installed.
Three modesNo API tests the fallback, Polyfill rehearses the API, Native runs Chrome's implementation.
ProductionOrigin trial on your domain; the rest of your visitors fall back to the No API mode.

To go further

Previous lessonNext lesson