<form> is instantly callable by AI agents.Add one script tag to any page (ServiceNow, HubSpot, Zendesk, React apps, plain HTML) and every form on that page becomes invocable by an AI agent. No modifications to your existing forms, no backend changes, no build pipeline. Invisible to regular users until an agent is present.
<script src="https://unpkg.com/auto-webmcp@0.7.0"></script>
npm install auto-webmcp@0.7.0
Works with any web platform
auto-webmcp runs entirely in the browser. No server changes, no build pipeline required.
Discovers all <form> elements on page load and watches for new ones via MutationObserver. Reads native toolname and tooldescription attributes when present, and enhances forms that are missing descriptions.
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.
Calls document.modelContext.registerTool() per form with the inferred name, description, and input schema. Fills fields and triggers submission when an AI agent invokes the tool.
When document.modelContext is absent (browsers without WebMCP, or Chrome 149+ outside the origin trial and without the flag), auto-webmcp silently no-ops. Your page is unaffected for regular users.
WebMCP has two paths: a declarative API (form attributes) and an imperative API (JavaScript). auto-webmcp builds on both.
toolname to each <form> manuallytoolname/tooldescription when presenttoolname attribute and skips them automatically. No conflicts, no duplicates.
Credentials, card data and restricted national IDs are never exposed to agents, with no setup. Country packs add format hints so agents fill IDs correctly, and mask personal IDs in tool results.
packs/inMasks PAN, UPI ID, bank account, passport, voter ID and ABHA. Formats GSTIN (with checksum), IFSC, PIN code and mobile.
packs/usMasks ITIN, bank account, date of birth, driver's license and Medicare number. Formats ABA routing, EIN and NPI (with checksums), ZIP and phone.
packs/sgMasks passport and date of birth. Formats UEN, postal code and phone. NRIC/FIN is always blocked.
packs/gbMasks National Insurance number, NHS number, UTR and bank account. Formats sort code, company number, VAT (with checksum) and postcode.
Permissions-Policy: tools=() on KYC and payment pages.
Checkout is a button and a hosted modal, so form scanning cannot see it. The Razorpay adapter registers checkout tools directly. The agent starts checkout, the user pays in Razorpay's modal with their UPI PIN or card OTP, and your webhook confirms the payment. The agent never sees payment details.
import { razorpay } from 'auto-webmcp/adapters/razorpay';
razorpay({
merchant: 'Acme',
plans: async () => [{ id: 'inr-monthly', name: 'Pro', amount: 49900, currency: 'INR' }],
createSubscription: async (planId) => (await fetch('/billing/subscribe', { method: 'POST', body: planId })).json(),
subscriptionStatus: async () => (await fetch('/billing/status')).json(),
});
get_plans, start_subscription, get_subscription_status and cancel_subscription (asks the user to confirm), plus start_payment and related tools for one-time Razorpay Orders.
Override the auto-inferred values with data-webmcp-* attributes or the JavaScript API.
import { autoWebMCP } from 'auto-webmcp';
import { india } from 'auto-webmcp/packs/in';
autoWebMCP({
// Skip forms by CSS selector
exclude: ['#login-form'],
// Name and describe specific forms
overrides: {
'#search': { name: 'search_products', description: 'Search the product catalog' },
},
// Submit after the agent fills fields (default: false, the user submits)
autoSubmit: false,
// Country packs: format hints and redaction for Indian fields
packs: [india],
});
<!-- 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>
Enable chrome://flags/#enable-webmcp-testing and install the
Model Context Tool Inspector extension to inspect and invoke your
registered tools. Tools from auto-webmcp appear there like any hand-written WebMCP tool.
<meta http-equiv="origin-trial"> tag or an Origin-Trial HTTP header. Visitors on other browsers, or outside the trial, see no difference, because auto-webmcp does nothing when WebMCP is absent.
required attributes). Optionally, add data-webmcp-name and data-webmcp-description attributes to any form to sharpen the descriptions visible to agents.
MutationObserver to watch for forms that are dynamically added to the DOM. Forms rendered by any frontend framework (React, Vue, Angular, Svelte) are picked up automatically after they mount.
data-webmcp-sensitive="allow|redact|block", or exclude a whole form with data-no-webmcp.