One line of code makes your existing website usable by agentic AI browsers.
latch.tools · Add WebMCP to your site · See which AI agents visit your site →
<script src="https://latch.tools/latch.js" defer></script>AI browsers — ChatGPT Atlas, Perplexity Comet, Chrome's WebMCP origin trial,
Edge — can now operate web pages through WebMCP,
the Web Model Context API (document.modelContext; formerly
navigator.modelContext, deprecated in Chrome 150). But out of the box they have to guess at
your buttons and forms, and they often fail. Latch reads your page (read-only)
and exposes its core actions as WebMCP tools an agent can call directly.
No MCP server. No backend. No rebuild. Zero dependencies. ~6 KB.
Latch inspects the DOM and, when it finds them, registers:
| Tool | Triggered by | What it does |
|---|---|---|
search_site |
a search input (type=search, name=q, role=searchbox, …) |
types the query and submits the search form |
add_to_cart |
"Add to cart / bag / basket / Buy now" controls | clicks the add-to-cart control |
submit_form |
contact / booking / signup / quote forms | fills the mapped fields and submits |
navigate |
your <nav> / header links |
moves to a named page |
If WebMCP isn't present in the browser, Latch does nothing — it never mutates or breaks the host page.
Drop the tag in before </body>:
<script src="https://latch.tools/latch.js" defer></script>Or self-host: copy latch.js anywhere static and point the src at it.
Skip auto-init and drive it yourself:
<script src="/latch.js" data-latch-manual defer></script>
<script>
// ...prepare your page, then:
window.Latch.init();
</script>Latch.inspect() returns what an agent would see — handy for debugging and the
"agent's-eye view" on the landing page:
Latch.inspect();
// { webmcp: true, tools: [ { name: "search_site", why: "found a search input" }, ... ] }Set Latch.debug = true before init for console diagnostics.
- On
DOMContentLoaded, Latch feature-detectsdocument.modelContext— falling back to the deprecatednavigator.modelContextfor pre-Chrome-150 builds — (supporting both theregisterTool()andprovideContext({tools})shapes). - It runs read-only DOM discovery to find your actionable surface.
- It registers one WebMCP tool per capability, each with a JSON Schema an agent
can reason about.
execute()handlers dispatch nativeinput/changeevents andrequestSubmit()so your existing validation and handlers still run. - Failures are swallowed — the host page is never affected.
- Read-only discovery. Latch never scrapes content off-site, makes network calls, or sends data anywhere. It only registers tools the browser's own agent can choose to call, with the user in the loop.
- No backend, no keys, no cookies.
WebMCP (document.modelContext) is in a public origin trial in Chrome 149
(announced at Google I/O, May 2026) and runs through Chrome 156 — it is not
yet shipped to stable. It is implemented by agentic browsers (ChatGPT Atlas,
Perplexity Comet) and Edge; the earlier navigator.modelContext alias is
deprecated as of Chrome 150. Everywhere else, Latch is a no-op.
The latch.js above is free forever and needs no account. When you want to
know which agents are hitting your site and what they do, create a free
project key at latch.tools:
- Free — live view of the WebMCP tool calls agents make on your site.
- Pro — €19/mo per project — 90-day history, per-agent breakdown, and a weekly email digest. Upgrade →
No tracking of your visitors, no cookies — Latch only reports the agent tool calls the browser itself surfaces.
node --check latch.js # syntax check (the only "build")
python3 -m http.server # then open http://localhost:8000MIT © Latch. See LICENSE.