Build, configure, validate, and export Web Model Context Protocol (WebMCP) browser tool definitions, DOM interaction handlers, JSON Schema parameter contracts, and TypeScript/JavaScript client scripts for Chrome Built-in AI (`navigator.ai`), Window.ai, `@webmcp/sdk`, and AI browser extensions with 100% client-side memory execution.
All WebMCP tool schemas, JavaScript handlers, and test parameters are constructed strictly in local browser memory.
import { WebMcpClient, defineBrowserTool } from "@webmcp/sdk";
async function extract_page_content(args) {
const selector = args.selector || "main, article, body";
const container = document.querySelector(selector) || document.body;
if (args.includeHeadingsOnly) {
const headings = Array.from(container.querySelectorAll("h1, h2, h3, h4"))
.map(h => ({ tag: h.tagName.toLowerCase(), text: h.textContent?.trim() || "" }))
.filter(h => h.text.length > 0);
return { title: document.title, headingsCount: headings.length, headings };
}
const text = container.innerText.slice(0, 5000);
return {
title: document.title,
url: window.location.href,
contentLength: text.length,
textContent: text
};
}
export const extract_page_contentWebMcpTool = defineBrowserTool({
name: "extract_page_content",
description: "Extracts structured headings, main paragraph text, title, and metadata from the currently active web page DOM.",
inputSchema: {
"type": "object",
"properties": {
"selector": {
"type": "string",
"description": "CSS selector for the target container element (defaults to main or body)",
"default": "main, article, body"
},
"includeHeadingsOnly": {
"type": "boolean",
"description": "Set to true to return only H1, H2, and H3 elements",
"default": false
}
}
},
execute: extract_page_content
});
// Initialize in client browser session
export function initBrowserMcpAgent(client: WebMcpClient) {
client.registerTool(extract_page_contentWebMcpTool);
console.log("Registered WebMCP Tool:", "extract_page_content");
}Select from pre-built browser templates (DOM Content Extractor, Browser Storage Inspector, Image Reader) or specify a custom tool name and description.
Define typed input parameters (strings, booleans, numbers) and write client-side JavaScript DOM manipulation or browser API handler logic.
Test your tool handler live in your local browser console, then copy or download production TypeScript SDK code, JSON manifests, or HTML script tags.
Zero backend server uploads. Your WebMCP tool declarations, DOM selection logic, and API keys stay entirely inside browser memory.
Export standard `@modelcontextprotocol/sdk` browser tools, `window.ai` tool declarations, or native `navigator.ai` / Chrome Built-in AI tool definitions.
Instant starter templates for DOM Text Extractor, Browser Storage Inspector, Client-Side Image Meta Extractor, and Local Storage Manager.
Test your generated WebMCP tool directly in your browser console with live mock parameters and real-time execution feedback.
Copy clean TypeScript/JavaScript snippets or download ready-to-use WebMCP tool JSON manifests for client-side AI agent orchestration.
Our WebMCP Tool Generator is fully open source under HiMat Technology. Inspect the tool builder logic, star the repository, or contribute on GitHub.
Unlike remote AI agent builders that send your API keys and client code to cloud servers, HiMat's WebMCP tool operates 100% inside your local browser runtime memory. Neither your custom DOM logic, input parameters, nor page interaction scripts leave your device.
WebMCP is an extension of the Model Context Protocol (MCP) tailored for web browsers. It allows client-side AI models (like Chrome Built-in Gemini Nano, Window.ai, or WebMCP JS SDK) to safely discover and call local browser tools (DOM querying, storage manipulation, canvas image processing) directly inside the user's browser session.
Standard MCP runs in desktop environments or server containers (using stdio or HTTP SSE) to interface with local files and backend APIs. WebMCP runs 100% inside the web browser DOM runtime, making browser actions (reading page text, filling forms, checking local cache) available to client-side AI agents without network latency or server costs.
Yes! The HiMat WebMCP Tool Generator runs 100% client-side in your browser. No code, tool definitions, or page schemas are ever sent to HiMat servers or any third party.
Copy the generated JavaScript/TypeScript code snippet or JSON tool declaration and embed it in your client script. You can register tools using the WebMCP SDK `client.registerTool()` or with browser AI providers like `window.ai.registerTool()`.
HiMat Technology builds production AI agent architectures, custom Model Context Protocol (MCP & WebMCP) integrations, and high-performance web platforms with 21-day fixed-scope deliverables and complete code ownership.
Continue with related utilities, services, and guides from HiMat.