Chrome WebMCP · Early Preview

Drop in one script tag.
Every <form> is instantly callable by AI agents.

auto-webmcp uses the WebMCP imperative API (navigator.modelContext.registerTool()) to auto-register every form on your page — inferred from your existing HTML. Zero manual coding. Gracefully degrades when WebMCP is unavailable.

<script src="https://unpkg.com/auto-webmcp"></script>
npm install auto-webmcp
View on GitHub View on npm

From HTML to AI-callable tools in four steps

auto-webmcp runs entirely in the browser — no server changes, no build pipeline required.

01

Scans forms

Discovers all <form> elements on page load and watches for new ones via MutationObserver. Forms with an existing toolname attribute are skipped — the browser handles those natively.

02

Infers schema

Maps each HTML input type to a JSON Schema property. Text → string, number → number, checkbox → boolean, radio groups → enum. Labels, placeholders, and required attributes become schema metadata.

03

Registers tools

Calls navigator.modelContext.registerTool() per form with the inferred name, description, and input schema. Fills fields and triggers submission when an AI agent invokes the tool.

04

Degrades gracefully

When navigator.modelContext is absent — any browser other than Chrome 146+ with the flag enabled — auto-webmcp silently no-ops. Your page is unaffected for regular users.

Declarative API vs. auto-webmcp

WebMCP offers two paths. auto-webmcp makes the imperative path automatic.

Native Declarative API

  • Add toolname to each individual <form>
  • Full manual control over name and schema
  • Best for new sites built with WebMCP in mind
  • Each form requires explicit annotation

auto-webmcp

  • Drop in one script tag — done
  • Names and schemas inferred from existing HTML
  • Best for existing sites with zero code changes
  • All forms covered automatically
Already using the declarative API? auto-webmcp detects forms with an existing toolname attribute and skips them automatically — no conflicts, no duplicates.

Zero config required. Customize when you need to.

Override the auto-inferred values with data-webmcp-* attributes or the JavaScript API.

JavaScript API

import { autoWebMCP } from 'auto-webmcp';

autoWebMCP({
  // Override tool name globally
  toolName: (form) => form.id || 'my-form',
  // Custom description
  description: (form) => form.title || 'Submit this form',
  // Auto-submit after agent fills fields
  autoSubmit: true,
});

HTML Attributes

<!-- Custom name + description per form -->
<form
  data-webmcp-name="search-products"
  data-webmcp-description="Search the product catalog"
  data-webmcp-autosubmit="true"
>
  <input type="search" name="q" placeholder="Search...">
</form>

<!-- Exclude a form entirely -->
<form data-no-webmcp>
  <input type="password" name="token">
</form>
🔬

Test with Chrome 146+

Enable chrome://flags/#enable-webmcp-testing in Chrome 146+ and install the Model Context Tool Inspector Chrome Extension to inspect and invoke your registered tools in real time. auto-webmcp registers your forms as first-class tools visible directly in the inspector.