Configures and uses the CrestApps Orchard Core WebMCP module, which exposes site tools to browser AI agents via document.modelContext. Covers settings, permissions, endpoints, page tools, storefront tools, and the AI chat bridge.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
WebMCP is a proposed W3C Community Group standard that lets a web page give tools to an AI agent in the browser (the browser's own assistant, an extension, or a chat on the page). The page registers each tool with document.modelContext.registerTool(); an agent lists them with getTools() and runs one with executeTool(). The tool runs in the page with the signed-in user's session.
The CrestApps.OrchardCore.AI.WebMcp module is a thin Orchard Core layer over CrestApps.Core's CrestApps.Core.AI.WebMcp package and @crestapps/webmcp scripts. It uses only the standard API and adds the W3C reference polyfill for browsers without native WebMCP.
CrestApps.OrchardCore.AI.WebMcp (category Artificial Intelligence - MCP), depending on CrestApps.OrchardCore.AI. Install the CrestApps.OrchardCore.AI.WebMcp package in the web/startup project. Do not look for sub-features:
[RequireFeatures] on CrestApps.OrchardCore.AI.Chat);EnablePageTools).ExposeAllTools. Front-end pages are off by default.UseWebMcpTools) get the site tools. Anonymous visitors get nothing unless Offer storefront tools to visitors is on, and then only selected tools marked safe for anyone (see Storefront tools). Changing the WebMCP settings needs Manage the WebMCP settings (ManageWebMcpSettings). Administrators hold both by default.AccessAnyAITool or the per-tool permission), checked on the server on every list and call. A browser agent can never do more than the user.AddCoreAITool<T>().Selectable() plus configured tool instances. System and hidden tools are never offered. WebMCP adds no tools of its own to that catalog.localhost while developing).MCP Server (orchardcore-ai-mcp-server) | WebMCP | |
|---|---|---|
| Caller | A remote MCP client | An agent in the user's browser |
| Transport | Streamable HTTP at /mcp | document.modelContext plus same-origin endpoints |
| Authentication | API key, OpenID Connect or none | The user's cookie, plus the antiforgery token on calls |
| Tool selection | Exposed tools card (MCP server fields) | Exposed tools card (WebMCP fields) |
| Per-user tool permission | No | Yes |
A full page (MVC view or Razor page) gets the scripts when the user is signed in, the page kind is turned on (admin pages by default, front-end pages only with Offer tools on front-end pages), and the user has UseWebMcpTools. The page then loads, in order: the polyfill (CrestAppsWebMcpPolyfill), webmcp.js (CrestAppsWebMcp), the page tools (CrestAppsWebMcpPageTools, unless turned off), and scripts added by IWebMcpClientConfigurationHandler.
| Endpoint | Purpose | Responses |
|---|---|---|
GET /api/ai/webmcp/tools | Lists the tools the user may call | 401 not signed in, 403 without UseWebMcpTools |
POST /api/ai/webmcp/tools/{name}/invoke | Calls a tool with the JSON body as arguments; returns { "content": [...], "isError" } | 400 without the RequestVerificationToken header, a non-object body or a body over 256 KB; 404 when the tool is not listed for the user |
A tool that throws answers isError: true with a generic message; details go to the log. A hidden or forbidden tool always answers 404, so the endpoint does not reveal which tools exist. The module maps Core's endpoints with MapWebMcpTools() and replaces Core's access check with PermissionWebMcpAccessEvaluator.
Saving the card releases the tenant (Core reads IOptionsMonitor<WebMcpOptions>). While Expose all tools is on, the card hides the tool lists.
The CrestApps:AI:WebMcp shell section overrides the stored settings: ExposeAllTools, Tools, EnableOnAdminPages, EnableOnFrontEndPages, EnablePageTools, and PageToolOrigins (origins of cross-origin frames whose shared tools the AI chat may use; empty by default). CrestApps:AI:WebMcp:Chat:ToolCallTimeout (default 00:01:00) bounds how long the chat waits for the browser to run a page tool.
{
"OrchardCore": {
"CrestApps": {
"AI": {
"WebMcp": {
"EnableOnFrontEndPages": false,
"Tools": [ "listTimeZones" ],
"Chat": { "ToolCallTimeout": "00:00:30" }
}
}
}
}
}
The WebMCP tools part (WebMcpPart, property Tools) lets each content item pick the tools its own page exposes.
UseWebMcpTools who may view the item get those tools, in addition to the site tools.| Endpoint | Purpose |
|---|---|
GET /api/ai/webmcp/content-items/{contentItemId}/tools | Lists the item's tools the user may call |
POST /api/ai/webmcp/content-items/{contentItemId}/tools/{name}/invoke | Calls one, with the antiforgery token |
Every list and call checks the user, UseWebMcpTools, that the published item has the part with that tool, that the user may view the item, and Access AI tool. An item's tools are added even when front-end pages are off on the card.
With Add page tools on (default), CrestApps.Core's page tools are registered for any agent:
| Tool | Read-only | What it does |
|---|---|---|
page_get_info | Yes | Title, address, description, first 20 h1/h2 headings, whether it is an admin page |
page_read_content | Yes | The text of main (or [role="main"], else the body), one line per block, cut to 8,000 characters, plus up to 10 tables (caption, headers, first 50 rows). Menus, forms, scripts, hidden parts, the chat and data-webmcp-ignore elements are left out |
page_list_links | Yes | Up to 200 same-origin navigation links, optional filter |
page_navigate | No | Opens a page of this site (a path starting with / or a full same-site address). It checks the page with a HEAD request first and refuses bare relative paths, 404/410 pages, other origins and script addresses, telling the agent to call page_list_links |
page_list_form_fields | Yes | Up to 200 form fields; hidden, password, file, button, disabled and antiforgery fields are left out |
page_set_form_field | No | Sets one field and raises input and change; never submits the form |
Offer storefront tools to visitors (EnableStorefrontTools, off by default) gives visitors' browser agents a small set of tools on front-end pages. A tool is given only when it is marked safe for anyone by the module that registers it and selected on the card (or offered by Expose all tools). Tool instances, unmarked tools and page tools are never given; admin pages never get storefront tools.
Who gets them: visitors who are not signed in, and signed-in users who don't get the site tools. The page gets only the polyfill and webmcp.js, pointed at the storefront endpoints.
| Endpoint | Purpose | Responses |
|---|---|---|
GET /api/ai/webmcp/storefront/tools | Lists the storefront tools | 404 while the setting is off |
POST /api/ai/webmcp/storefront/tools/{name}/invoke | Calls one, with the antiforgery token | 404 while off or when the tool is not a storefront tool; 400 as for site tools |
The setting, the mark and the selection are checked on every list and call. Tools run as the caller (guest or user) with no per-tool permission check. With Orchard Core's Rate Limits feature on, each IP may call the storefront endpoints 60 times a minute (WebMcpConstants.StorefrontRequestsPerMinute, rate-limit group webmcp-storefront); turn it on for public sites.
Mark a tool with MarkAIToolAnonymousSafe (CrestApps.OrchardCore.AI.Core.Extensions; marks kept in AnonymousAIToolOptions) only when it reads public data or acts on the caller's own data, never shows another person's data, and never pays, deletes or changes the site. The Agentic Commerce store tools are marked (see orchardcore-agentic-commerce).
services.AddCoreAITool<SearchStoreProductsTool>(SearchStoreProductsTool.ToolName)
.WithTitle(S["Search store products"])
.Selectable();
services.MarkAIToolAnonymousSafe(SearchStoreProductsTool.ToolName);
With AI Chat enabled, the chat reads every tool document.modelContext.getTools() lists (not only CrestApps ones), sends them to the AI chat hub with SetPageTools, and the hub runs a call in the tab through ExecutePageTool (SignalR client results). No extra connection or sticky session is needed.
^[A-Za-z0-9_.-]{1,128}$, descriptions up to 2,000 characters and object schemas up to 16 KB.WebMcpProfileSettings.AllowPageTools) on the profile's Capabilities tab. Tools annotated consequentialHint ask the user to Allow or Deny each call in the chat (AG-UI tool approval, see orchardcore-ai-chat); with Allow consequential page tools (AllowConsequentialPageTools) they run without asking.page_navigate opens another page, the turn ends and the widget on the new page continues it with that page's tools, up to five pages in a row. A run keeps going on the server for two minutes after its page closed, so its answer is saved.. is offered to the model with _ (store.add_to_cart becomes store_add_to_cart). Results of tools annotated untrustedContentHint reach the model as data.exposedTo, the page must allow it with <iframe allow="tools">, and the origin must be listed in PageToolOrigins.Register page tools with the standard API from a script resource that depends on CrestAppsWebMcpPolyfill (or CrestAppsWebMcp when it reads window.crestAppsWebMcp.config). Prefix the name with your module and use the readOnlyHint, consequentialHint and untrustedContentHint annotations.
const registration = new AbortController();
document.modelContext.registerTool({
name: 'contoso.find_store',
title: 'Find a store',
description: 'Finds the Contoso store nearest to a postal code.',
inputSchema: {
type: 'object',
properties: { postalCode: { type: 'string' } },
required: ['postalCode'],
},
annotations: { readOnlyHint: true },
execute: async ({ postalCode }) => findStore(postalCode),
}, { signal: registration.signal });
To expose an existing server AI tool, do not write a page tool: register it with .Selectable() and select it on the card or on an item's WebMCP tools part.
IWebMcpClientConfigurationHandler.ConfigureAsync(WebMcpClientConfigurationContext) runs after the user and page qualified. context.AddScript(...) loads a resource after webmcp.js; context.Settings is written to the crestapps-webmcp-config JSON block and read as window.crestAppsWebMcp.config. context.IsAdminPage and context.HttpContext are available.
using CrestApps.OrchardCore.AI.WebMcp.Models;
using CrestApps.OrchardCore.AI.WebMcp.Services;
internal sealed class ContosoWebMcpHandler : IWebMcpClientConfigurationHandler
{
public Task ConfigureAsync(WebMcpClientConfigurationContext context)
{
context.AddScript("ContosoWebMcpTools");
context.Settings["storesUrl"] = $"{context.HttpContext.Request.PathBase}/stores";
return Task.CompletedTask;
}
}
// In a startup marked [RequireFeatures("CrestApps.OrchardCore.AI.WebMcp")]:
services.AddScoped<IWebMcpClientConfigurationHandler, ContosoWebMcpHandler>();
{
"steps": [
{
"name": "Feature",
"enable": [ "CrestApps.OrchardCore.AI.WebMcp" ],
"disable": []
},
{
"name": "Settings",
"WebMcpSettings": {
"EnableOnAdminPages": true,
"EnableOnFrontEndPages": false,
"EnablePageTools": true,
"EnableStorefrontTools": false,
"ExposeAllTools": false,
"Tools": [ "listAIProfiles" ]
}
},
{
"name": "AIProfile",
"Profiles": [
{
"Name": "admin-assistant",
"Settings": {
"WebMcpProfileSettings": {
"AllowPageTools": true,
"AllowConsequentialPageTools": false
}
}
}
]
}
]
}
Per-item tools: attach WebMcpPart with the ContentDefinition step and set "WebMcpPart": { "Tools": [ "checkStock" ] } on the item in the Content step. See references/webmcp-examples.md.
orchardcore-ai-mcp and orchardcore-ai-mcp-server for remote MCP clients.orchardcore-ai-tools for registering selectable AI tools; orchardcore-ai-tool-instances for tool instances.orchardcore-ai-chat for AI profiles and the chat widget.orchardcore-nlweb for the ask tool, which can be selected on the WebMCP card.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, webmcp, browser-ai, ai-tools, content-management
/crestapps-orchardcore:orchardcore-ai-webmcpfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job