Foundations: how agents use a website today|INEMA.CLUB-PRO

Lesson 4 · 15 min

MCP and WebMCP in one picture: server × page, who calls whom

The two names look like the same thing, but they are not. MCP connects an agent to a server of yours, outside the browser, and it is stable. WebMCP lets the page itself declare tools for the agent running in the browser, and it is a draft. In this lesson you separate the two in one picture and run the feature detection that keeps the site working without the API.

Start the lesson
Industrial humanoid robot sitting in front of a monitor with a browser, with cables running to a server rack in the background.

In this lesson you will

  1. 1MCP: the agent calls your server (revision 2026-07-28)
  2. 2WebMCP: the page declares tools in the browser
  3. 3Feature detection: without the API, nothing breaks
  4. 4Which course in the program teaches each side

Goal: place MCP (server) and WebMCP (page) in one picture and see feature detection with fallback running.

01Two paths to the same action

Click each block.

Click each block in the diagram to see what it does.

MCP: the agent goes to your server. WebMCP: the open page offers tools to the browser's agent. The HTML holds up both.

02Side by side

What changes between the two, in four questions.

1. Where does it run?

MCP: in a process of yours (on the agent's machine over stdio, or at an HTTP address). WebMCP: inside the open tab, in the page's JavaScript.

03Feature detection with fallback

The only WebMCP JavaScript in this course: check whether the API exists and, without it, leave the form as it is. Registering real tools is course 2. The detectar.mjs opens the page without the API and with an empty stub (it is not the API or the polyfill), just to show the two branches.

File · kit/site/deteccao.js
// deteccao.js — WebMCP feature detection with fallback (course 0 kit, WebMCP Program).
// Spec used: WebMCP, Draft Community Group Report from 2026-10-16 (document.modelContext).
// It is a Community Group draft, not a standard: in Chrome only with an origin trial (149–156) or a local flag.
// Without the API, nothing changes: the form above is still the path for people and agents.
(function () {
  const caminho = "modelContext" in document
    ? "WebMCP presente: aqui a página registraria as ferramentas (curso 2 da formação)"
    : "WebMCP ausente: o site segue pelo formulário, igual para todos";
  document.documentElement.dataset.webmcp = "modelContext" in document ? "sim" : "nao";
  console.log(caminho);
})();
Terminal · the two branches
cd ~/projetos/formacao-webmcp-base-v72/kit
node detectar.mjs depois; echo "saída: $?"
Example from the repository
sem API  · WebMCP ausente: o site segue pelo formulário, igual para todos · botão Agendar: sim
com stub · WebMCP presente: aqui a página registraria as ferramentas (curso 2 da formação) · botão Agendar: sim
saída: 0

In both branches the "Agendar" button is still there: the fallback doesn't depend on the API. With the API present, the page would register the tools; without it, the page works the same for everyone.

04Practice

Both branches and detection in your copy.

E1 · Both branches

5 min

Run the "os dois ramos" block and read deteccao.js line by line.

Done when: node detectar.mjs depois → line sem API · WebMCP ausente, line com stub · WebMCP presente, both with botão Agendar: sim, and saída: 0.

E2 · Detection in your copy

10 min

Copy kit/site/deteccao.js to /tmp/oficina/ and add <script src="deteccao.js"></script> at the end of the body of the copy you fixed in lesson 3.

Done when: node detectar.mjs /tmp/oficina/antes.html → both lines with botão Agendar: sim and saída: 0.

E3 · Your service map

10 min

Write three lines: which action on your site an agent would ask for; whether it lives in a service with an API (a candidate for MCP, course 1) or only on the page (a candidate for WebMCP, course 2); and which form is the fallback.

Done when: the file with the three lines exists and each action has a named fallback form.

05Lesson quiz

Question 1 of 4

Where does the tool run in an MCP server?skill

06In three sentences

MCP is a serverThe agent calls a process of your own; stable, revision 2026-07-28.
WebMCP is a pagedocument.modelContext, October 16, 2026 draft, only with an origin trial or a flag.
Detect and fall back to HTMLWithout the API, the form is still the way in.

Going further

Previous lessonNext lesson