Example file
01-minimal.html
The paste-in snippet, and whether this browser can offer tools.
To try this page, download it, replace the placeholders and put it on a test page of your website. Opening the file from your computer won't work, because the embeds check the website address they're on.
<!--
The WebMCP snippet on its own, plus a quick check of whether this browser
can offer tools. Replace wmk_YOUR_KEY with your integration's key, and open
the page on one of the websites listed on the integration.
Nothing appears on the page. If the visitor's browser supports WebMCP, the
script offers your tools to the AI assistant in it.
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebMCP: minimal snippet</title>
</head>
<body>
<h1>Minimal snippet</h1>
<p>
One script tag with your key. If this browser supports WebMCP, your tools are now available to the AI
assistant in it. Nothing appears on the page. Open the developer console and look for
<code>Subcontext.webmcp registered N tool(s)</code>.
</p>
<h2>Can this page offer tools?</h2>
<ul>
<li id="secure"></li>
<li id="supported"></li>
</ul>
<script>
document.getElementById('secure').textContent = window.isSecureContext
? 'Yes: this is a secure page (https, or localhost while testing).'
: 'No: this page isn\'t secure. Open it over https, or from localhost.'
// The script looks for WebMCP on document first, then on navigator.
var supported = [document.modelContext, navigator.modelContext].some(function (context) {
return context && typeof context.registerTool === 'function'
})
document.getElementById('supported').textContent = supported
? 'Yes: this browser supports WebMCP.'
: 'No: this browser doesn\'t support WebMCP, or it is switched off.'
</script>
<!-- Replace wmk_YOUR_KEY with your integration's key (starts wmk_). In the dashboard: Organisation >
Agent access > Manage WebMCP tools, then open the integration. Its page shows this snippet with the key filled in. -->
<script id="webmcp-embed-script" src="https://js.subcontext.com/webmcp-latest.js"
data-key="wmk_YOUR_KEY" async></script>
</body>
</html>