Let AI assistants in your visitors' browsers use your Subcontext tools to list your products, explain cover, answer questions, book a callback and pass on a visitor's details.
You add one script tag to your website. Nothing appears on the page. The script offers your tools to any AI assistant running in the visitor's browser, so the assistant gets accurate answers from you instead of guessing from the page text.
Quick start#
- In the Subcontext dashboard, open Organisation > Agent access, then Manage WebMCP tools, then New integration.
- Give it a name, list your website (for example
https://www.example.com) under Websites where it's embedded, and keep the tools you want ticked. Save. - Copy the snippet from the integration's page. It already has your key in it:
<script id="webmcp-embed-script" src="https://js.subcontext.com/webmcp-latest.js"
data-key="wmk_YOUR_KEY" async></script>
- Paste it into the pages of that website, anywhere in the HTML.
- Check it worked: open a page in a browser with WebMCP switched on, open the developer console and look for
Subcontext.webmcp registered 10 tool(s) for <your firm's name>(the number is however many tools you ticked).
To change which tools are offered later, change the integration in the dashboard. The snippet stays the same.
What is WebMCP?#
WebMCP is a new browser feature. It lets a website offer tools to an AI assistant running in the visitor's browser (a browser's built-in assistant, or an extension). A tool is a named action with a short description, such as "list products" or "book a callback". The assistant reads the descriptions, decides when a tool would help the visitor, and calls it.
When an assistant calls one of your tools, the script sends the request to Subcontext. Subcontext runs it against your firm's data and settings, and passes the result back to the assistant.
WebMCP is a proposed web standard and is still experimental:
- Browser support. At the time of writing, Chrome has it behind a setting (a "flag"). Open
chrome://flags, search for "WebMCP" or "model context", enable it and restart Chrome. Flag names change between Chrome versions, so look for whatever your version offers. Other browsers may add it later. - Where it lives. Different drafts of the standard put it at
document.modelContextornavigator.modelContext. The script works with either (it triesdocumentfirst). To check a browser, type this in the developer console on your page:
typeof document.modelContext?.registerTool // or navigator.modelContext?.registerTool
"function" means WebMCP is available.
- Secure pages only. Browsers only offer WebMCP on secure pages: https:// addresses, or
http://localhost and http://127.0.0.1 while you test on your own computer. On plain http:// on any
other address it is not available. window.isSecureContext in the console tells you (true means the page is secure).
For AI agents that don't run in a browser (ChatGPT, Claude, and other agents), Subcontext has other options under Organisation > Agent access in the dashboard.
What you need#
Tools are offered only when all of these are in place:
- A browser with WebMCP switched on, on a secure page (see above). The script does not add WebMCP to browsers that lack it.
- A WebMCP integration in Subcontext that is Enabled, lists your page's website, and has at least one tool ticked (see the next section).
- A plan that includes agent access. It is part of the Professional and Enterprise plans, and your account must be paid up. If you don't see Agent access in the dashboard, ask Subcontext (hello@subcontext.com).
- An AI assistant that uses the tools. Without one, the tools are offered but nobody calls them. You can still test them yourself: example 03 lists and calls them from a page.
Set up the integration in the dashboard#
Owners and managers can do this.
- Open Organisation > Agent access and choose Manage WebMCP tools.
- Press New integration and fill in:
- Name: for your own reference, for example "Marketing site".
- Websites where it's embedded: one per line. Only pages on these websites may use the tools.
- Tools: new integrations start with every tool ticked. Untick any you don't want to offer.
- Save. The integration's page shows your snippet with the key filled in.
How website addresses are saved#
Each entry is reduced to its website (what browsers call the origin), which is https:// or http://, the
host name, and the port if it isn't the usual one. Paths and trailing slashes are dropped, so
https://www.example.com/products/ is saved as https://www.example.com.
- An entry must start with
http://orhttps://.www.example.comon its own is refused withAllowed origins must be website addresses like https://www.example.com (...), naming the entry. https://www.example.comandhttps://example.comare different websites. List both if your site answers on both.http://andhttps://are different too.
Other settings on the integration#
- Enabled: switches all of the integration's tools on or off. It is on by default.
- Configure (next to each tool): change the description the AI assistant sees, and set the tool's own options (see The tools).
- Rotate key: makes a new key. The old one stops working straight away, so update your snippet at the same time.
What some tools need from your account#
answer_questionneeds a live agent (one that is in production with a published version).talk_to_a_specialistneeds a published mini-site, or a custom web address set on the tool.- The product tools (
list_products,show_product,compare_products,explain_cover,check_availability) show products your firm manufactures. book_callbackuses your business hours and time zone.
The dashboard assistant can also create and change WebMCP integrations.
Next, install the snippet on your pages.
Example pages#
The example pages are complete web pages that show the WebMCP embed in use, from the simplest install up. You can read, copy or download each one.
In this section
- Install WebMCP Add the WebMCP script to your pages with the paste-in snippet or from your own JavaScript, and its options.
- Starting and stopping from JavaScript The SubcontextWebMCP object, the result of init, and the console messages the script writes.
- The tools The tools an integration can offer, their inputs and results, what they save, and what is public and what is protected.
- Troubleshooting WebMCP The content security policy to allow, what each console message and error means, and how to fix it.
- WebMCP examples Complete example pages for WebMCP, from the minimal snippet to a setup checker and a visitor's journey through your tools.