Websites were built for humans who scroll and click. AI agents don’t work like that. They need to know what a website can do: upfront, in a structured format, without guessing.
WebMCP is how you tell them.
This guide walks through how to enable WebMCP on your website: what to prepare, how both APIs work, how to handle security, and how to test and monitor once you’re live. Whether you’re a developer ready to write code or a business owner trying to understand what the implementation involves, this covers both layers.
Where things stand now: Google has published official WebMCP documentation on developer.chrome.com and confirmed an origin trial in Chrome 149. The Declarative API is stable enough to use in production experiments. The Imperative API is powerful but still evolving: the spec dropped
provideContextandclearContextmethods in March 2026, so check the official Chrome docs before implementing.
Before You Start: What Your Website Needs to Be WebMCP-Ready
Jumping straight to implementation without preparation produces fragile tools. Do this groundwork first.
A Clear Picture of What AI Agents Should Be Able to Do
WebMCP doesn’t expose everything automatically. You choose what to expose. Before writing a line of code, list the specific actions an AI agent should be able to perform on your site.
Start by asking: what do users most frequently want to accomplish here?
- Ecommerce: search products, check availability, add to cart, track an order
- Service businesses: check appointment availability, submit a quote request, retrieve service details
- SaaS: look up account data, trigger a workflow, check feature availability
- Content sites: search articles, retrieve a page summary, filter by topic
Rank them by frequency and business value. Start with the top three. You can add more tools after the first ones are working well.
Clean, Standard HTML Forms
Sites that already have well-built forms need very few changes to become agent-accessible. If your forms use non-standard JavaScript components, custom dropdowns, or third-party widgets rather than native HTML inputs, those forms will require extra work: either converting them to standard HTML or building equivalent Imperative API tools.
Audit your key forms now. Any form using <input>, <select>, <textarea>, and <button type="submit"> is already a good candidate for the Declarative API.
Accurate, Maintained Data
If an AI agent retrieves stale inventory counts, outdated pricing, or closed service areas, it provides bad answers to users. Before implementing WebMCP tools, confirm the data those tools will surface is:
- Updated in real time or at a predictable cadence
- Consistent with what users see in the UI
- Accurate enough to act on
HTTPS and Server-Side Permission Headers
WebMCP requires HTTPS. It also uses a Permissions Policy header to control which pages can register tools. Add this to your server configuration to allow WebMCP on your own pages:
Permissions-Policy: tools=(self)
If you want to restrict it to specific paths only, that’s possible through standard Permissions Policy syntax. By default, tools are scoped to the same origin. Cross-origin tool access requires explicit configuration.
Step-by-Step: How to Implement WebMCP
Step 1: Identify Which Website Functions to Expose
Don’t expose every function at once. Start narrow, validate, then expand.
The best first WebMCP tools have three qualities:
- High frequency: users request this action constantly
- Low risk: the action doesn’t modify sensitive data or make irreversible changes
- Clear output: the tool returns something predictable and useful
Read-only tools (search, availability check, content retrieval) are the safest starting point. Write tools (add to cart, submit form, book appointment) involve more state and should come after the read-only ones are stable.
For the strategic context behind why AI agents need structured tools in the first place, read what WebMCP is and how websites will communicate with AI agents.
Tip: Look at your search and contact analytics before deciding what to expose. The queries users type in your site search are often the exact tools AI agents need. If “appointment availability” is your most common search, that’s your first WebMCP tool.
Step 2: Prepare Your Website’s Data for AI Access
AI agents interpret tool outputs literally. If a tool returns “availability”: “varies by location”, an agent can’t help a user who asked, “is the 3 pm slot open?” They need structured data.
What good tool output looks like:
| Poor response | AI-usable response |
|---|---|
| “Contact us for availability” | {"slots": ["2:00 PM", "3:30 PM", "5:00 PM"]} |
| “Prices from $49” | {"price": 49, "currency": "USD", "billing": "monthly"} |
| “We serve most of the US” | {"regions": ["Northeast", "Southeast", "Midwest"]} |
Before registering tools, make sure the underlying data is structured enough to return useful, typed responses. Unstructured or vague data makes for bad tools. The same structured data principles that improve schema markup performance also apply here.
Read 6 practical uses of schema markup for AI optimization for a practical grounding in how AI systems process structured information.
Step 3: Choose Your Implementation Approach
WebMCP has two APIs. Use the one that fits your situation.
The Declarative API: Two HTML Attributes
You add toolname and tooldescription attributes to a <form> element, along with optional toolparamdescription on individual fields, and the browser generates a JSON schema from the existing form structure.
Here’s a complete example for a service booking form:
<form
toolname="book_appointment"
tooldescription="Book a service appointment by date and service type"
toolautosubmit>
<label>Date
<input type="date" name="date"
toolparamdescription="Preferred appointment date (YYYY-MM-DD)" required>
</label>
<label>Service
<select name="service"
toolparamdescription="Type of service requested">
<option value="consultation">Consultation</option>
<option value="installation">Installation</option>
<option value="repair">Repair</option>
</select>
</label>
<button type="submit">Book</button>
</form>
The browser reads those attributes, builds a JSON Schema with name as a required string, date as a date-formatted string, and generates the required field constraints, then registers the result as a tool agents can call. No JavaScript, no build step required.
toolautosubmit tells the browser to submit the form automatically when an agent calls the tool, without requiring a manual button click.
- Use the Declarative API when: you have standard HTML forms, your forms are relatively simple, and you want the fastest path to agent-readiness.
The Imperative API: Full Control via JavaScript
For dynamic or complex interactions, register tools programmatically using navigator.modelContext.registerTool().
navigator.modelContext.registerTool({
name: 'check_availability',
description: 'Check available appointment slots for a given date range. ' +
'Returns an array of available time slots.',
inputSchema: {
type: 'object',
properties: {
startDate: { type: 'string', format: 'date' },
endDate: { type: 'string', format: 'date' }
},
required: ['startDate', 'endDate']
},
annotations: { readOnlyHint: true }, // marks this as a safe, read-only tool
execute: async ({ startDate, endDate }) => {
const slots = await fetchAvailability(startDate, endDate);
return JSON.stringify(slots);
}
});
Key fields:
| Field | What it does |
|---|---|
name |
Identifier for the tool. Use snake_case and be specific (check_availability not check) |
description |
Natural language explanation: the AI reads this to decide whether to use the tool |
inputSchema |
JSON Schema defining what inputs the tool accepts |
annotations.readOnlyHint |
Set to true for tools that only read data; helps agents make safer decisions |
execute |
The function that runs when an agent calls the tool |
Important: The description field is what the AI agent reads to decide when and whether to call your tool. Write it like documentation for a human developer, not like a marketing headline. Be specific about what it does, what inputs it needs, and what it returns.
- Use the Imperative API when: tools depend on page state, tools need to register or unregister dynamically, or the action is too complex to express through a standard form.
Step 4: Understand How Agents Interact With Your Tools
Once tools are registered, this is what happens when a user asks their AI assistant to do something on your site:
- User sends a request to an AI interface (“Book me an appointment for next Thursday”)
- Agent discovers available tools via
navigator.modelContext.getTools(), which returns names and descriptions to understand what’s possible - Agent selects the right tool based on descriptions and calls it with appropriate inputs
- Your tool executes and returns a structured result
- Agent returns the result to the user in natural language
The agent never sees your source code. It only sees what your tools expose through their names, descriptions, schemas, and return values.
Step 5: Configure Security and Permissions
Security concerns like prompt injection, data exfiltration through tool chaining, and destructive action enforcement are acknowledged in the spec but not fully resolved yet. Until the security model matures, apply these principles:
- Only expose what you need to expose: Every tool is a potential attack surface. If an action doesn’t need to be available to AI agents, don’t register it.
- Use
readOnlyHintannotations: Mark read-only tools explicitly. This signals to agents and browsers which tools are safe to run without user confirmation. - Require confirmation for sensitive actions: The browser prompts users before running tools that can modify data or make purchases. Design your tool descriptions to make it clear when an action is write-based.
- Validate inputs server-side: Don’t trust that inputs passed to your execute function are clean. Apply the same validation you’d apply to any form submission.
- Control access via Permissions Policy: If some pages should never register tools, use the Permissions Policy header to restrict WebMCP to specific paths:
Permissions-Policy: tools=(self "https://app.yoursite.com")
Step 6: Test Before You Launch
Testing WebMCP tools requires checking that they work from an agent’s perspective, not just a human’s.
Set up your test environment:
- Open Chrome 149+ and enable the flag at
chrome://flags/#enable-webmcp-testing - Install the Model Context Tool Inspector from the Chrome Web Store
- Navigate to your page and open the Tool Inspector to see which tools are registered and what schemas they expose
What to test:
| Test type | What to check |
|---|---|
| Tool registration | Does the Tool Inspector show your tool with the correct name, description, and schema? |
| Function testing | Does calling the tool with valid inputs return the expected output? |
| Edge case testing | What happens with missing fields, invalid dates, or out-of-range values? |
| Error handling | Does the tool return a clear, useful error message when something fails? |
| User confirmation | Do write-based tools trigger the browser’s confirmation prompt? |
Tip: Test your tool descriptions as much as your tool logic. Ask a colleague who hasn’t seen your implementation to read just the name and description fields and tell you what they’d expect the tool to do. If their answer doesn’t match what it does, rewrite the description.
Step 7: Monitor and Keep Improving
Implementing WebMCP isn’t a one-time task. Tools need maintenance, and your understanding of what agents need improves over time.
Track these signals after launch:
- Which tools are called most frequently: this tells you what AI agents (and by extension, users) want most
- Which calls fail or return errors: these are gaps in your tool coverage or data quality
- Which queries agents attempt that your tools don’t handle: these are candidates for new tools
Common improvements after launch:
- Writing more specific tool descriptions to help agents select the right tool in ambiguous situations
- Adding new tools for high-frequency actions you didn’t include in the first version
- Improving the structured output format to give agents more useful, actionable data
- Splitting one broad tool into two narrower, more predictable ones
WebMCP implementation sits within a broader AI visibility strategy.
For more on how agent accessibility connects to AI search visibility and content strategy, read how to build an AI SEO strategy that drives visibility.
Implementation Checklist
Before going live, run through this:
- ☐ HTTPS enabled and Permissions Policy header configured
- ☐ Tools list defined and prioritized by value and risk level
- ☐ Data quality validated: tool outputs are accurate, structured, and current
- ☐ Declarative tools have
toolname,tooldescription, and field-leveltoolparamdescriptionattributes - ☐ Imperative tools have clear name, specific description, complete
inputSchema, and correctreadOnlyHint - ☐ Security review done: no unnecessary permissions, write tools prompt user confirmation
- ☐ Tool Inspector confirms all tools register correctly with expected schemas
- ☐ Edge cases and error states tested
- ☐ Monitoring in place for call frequency and failure rates
What WebMCP Implementation Does for Your Business
A WebMCP-enabled website isn’t just technically up-to-date. It’s accessible to an entirely new type of visitor that existing websites were never designed to serve.
AI agents operating on behalf of your users can now book, search, compare, and retrieve on your site, without the friction of navigation, page loads, and manual input. That’s a qualitatively different kind of availability.
Want to make your website accessible to AI agents and optimize it for the next generation of search?
Devenup works with businesses on AI search visibility, technical SEO, and GEO.






