Skip to main content

WebMCP

The Website Widget can expose your knowledge sources to AI agents that run in the browser. It uses WebMCP, a proposed web standard that lets a page register tools for in-browser agents. When an agent visits a page with the widget, it can search your documentation and other sources directly from that page. The user does not need to install or connect an MCP server.

WebMCP complements the hosted MCP server. The hosted MCP server serves agents in editors and desktop tools. WebMCP serves agents that browse your website.

Enabling WebMCP​

WebMCP is not enabled by default. To enable it, add the data-webmcp-enabled parameter to your widget configuration:

<script
async
src="https://widget.kapa.ai/kapa-widget.bundle.js"
data-website-id="YOUR-WEBSITE-ID"
data-project-name="Acme"
data-webmcp-enabled="true"
></script>

The widget registers the tool only when all of these conditions are true:

  • data-webmcp-enabled is "true".
  • The browser supports WebMCP. Browsers without WebMCP support ignore the parameter, and the widget works as usual.
  • The user gave consent, if you set data-consent-required="true".

The search tool​

The widget registers one read-only tool, search_<PROJECT_NAME>_knowledge_sources. The widget makes the name from data-project-name in snake case. For example, "Acme Docs" gives search_acme_docs_knowledge_sources. This is the same name as the search tool of the hosted MCP server.

The tool takes one input, query, which is a natural-language question. It returns the most relevant chunks from your knowledge sources. Each chunk has its source URL and its content in Markdown.

The tool uses the same configuration as the widget:

  • If you set data-source-group-ids-include, the tool searches those source groups, related parent or child groups, and any global sources.
  • Searches use the same anonymous user identifiers as the widget. They follow your user tracking settings.

Bot protection​

Each tool call goes through the same captcha check as the widget. Usually the check passes without user action. If the check needs the user, the widget opens the verification challenge on the page. The tool then tells the agent to ask the user to complete the check and to call the tool again.

If the check does not finish in time, or does not pass, the tool returns an error. The error tells the agent to try one more time.