Route web application tasks through learned MCP servers instead of raw browser automation.
This manual covers the runtime routing skill — how AutoWebMCP intercepts web app tasks and routes them through semantic MCP tools instead of computer use.
- Overview
- How It Works
- Automatic Routing
- Using MCP Tools
- Execution Flow
- Error Handling & Recovery
- When MCP Tools Aren't Enough
- Important Rules
- Catalogue Format
The /webmcp skill is the runtime counterpart to /learn-webapp. While the learning
skill generates MCP servers, the webmcp skill uses them.
It fires automatically whenever Claude Code is about to interact with a web application that has a learned MCP server. You don't need to invoke it manually — it intercepts the task and routes through semantic tools.
Before (computer use):
screenshot() → analyze image → click([672, 195]) → type("My Title") → screenshot()
~12 seconds, 7 tool calls, may fail on layout changes
After (webmcp routing):
set_page_title("My Title")
~0.5 seconds, 1 tool call, reliable
You say: "Update the title to Welcome and add a new page called About"
WebMCP:
1. Identifies the target app (Google Sites)
2. Finds matching MCP in catalogue (google-sites, 33 tools)
3. Plans: set_page_title("Welcome") + add_page("About")
4. Executes both MCP tool calls
5. Reports: "Done. 2 tools called, 0 errors."
The webmcp skill triggers on any web application interaction:
- "edit this site", "build a page", "add content"
- "change the theme", "fill this form"
- "create a site", "update the title"
- Any task involving a web app that has a learned MCP
Trigger keywords: web app interaction, site editing, form filling, content management, theme changes, page creation.
Each learned operation is exposed as a separate MCP tool with typed parameters:
set_page_title({ title: "Welcome" })
→ { success: true, readback: "Welcome" }
add_question({ text: "How was your experience?", type: "multiple choice" })
→ { success: true }
set_theme({ theme: "Diplomat" })
→ { success: true }
Every generated MCP server includes a run_script tool that executes arbitrary
JavaScript in the page context with all helper functions pre-injected. This enables
batch operations in a single CDP round-trip:
run_script(`
// Set title, add 5 pages, and change theme — all in one call
await set_page_title("My Site");
await add_page("About");
await add_page("Services");
await add_page("Portfolio");
await add_page("Blog");
await add_page("Contact");
await set_theme("Diplomat");
return { success: true, pages_added: 5 };
`)Performance: One run_script call can replace 40+ individual tool calls.
The entire batch executes in ~1 second.
Every generated MCP server includes four built-in tools:
| Tool | Purpose |
|---|---|
health_check |
Verify browser connectivity — returns Chrome version and page URL |
get_page_state |
Current URL, page title, active element, count of open dialogs/menus |
show_scripts |
List all JavaScript functions with names, parameters, and descriptions |
run_script |
Execute arbitrary JavaScript with all helpers pre-injected |
The webmcp skill needs a CDP-enabled Chrome instance. It follows the same setup procedure as the learning skill — tests port 9222, offers to launch Chrome if needed, supports user profile and sandbox modes.
The skill extracts the target URL from:
- The user's message (explicit URL)
- The current browser tab
- Context clues ("update the Google Sites page" →
sites.google.com)
Reads catalogue.json to find a matching MCP server:
{
"applications": {
"google-sites": {
"urlPattern": "sites\\.google\\.com",
"mcps": [{
"name": "google-sites-mcp",
"path": "MCPs/google-sites/server",
"operationCount": 33
}]
}
}
}Local check: Looks for the MCP server directory at the catalogued path.
Remote check: If the MCP server isn't installed locally, it can be downloaded from the GitHub repository automatically.
| Scenario | Action |
|---|---|
| MCP exists, tools cover the task | Execute via MCP tools |
| MCP exists, some tools missing | Use available tools + fall back to browser automation for gaps |
| No MCP exists | Suggest running /learn-webapp or fall back to computer use |
Before executing, the skill analyzes the user's request against available tools:
- Decompose the task into individual operations
- Match each operation to an MCP tool
- Identify gaps — operations with no matching tool
- Plan execution order — respecting dependencies (e.g., create page before editing it)
If gaps are found, the skill reports them:
Task requires 5 operations. 4 have MCP tools, 1 requires browser automation:
✅ set_page_title → MCP tool
✅ add_page (×3) → MCP tool
⚠️ upload_header_image → no MCP tool, will use browser automation
5.1 Navigate: Ensure the browser is on the correct app page.
5.2 Execute MCP tools: Call each planned tool in order.
5.3 Batch when possible: Group independent operations into a single run_script
call for performance.
5.4 Handle errors: If a tool fails, diagnose and retry or fall back.
5.5 Verify results: After mutations, verify the DOM state matches expectations.
5.6 Authentication handling: If the app redirects to login mid-task, pause and ask the user to re-authenticate.
Done. 4 MCP tools called, 0 errors.
- set_page_title("Welcome") ✅
- add_page("About") ✅
- add_page("Services") ✅
- set_theme("Diplomat") ✅
The webmcp skill handles errors at multiple levels:
Each tool returns structured errors with categories:
| Category | Meaning | Recovery |
|---|---|---|
selector_not_found |
Element selectors don't match the DOM | App may have updated — re-learn the tool |
timeout |
Element exists but didn't reach expected state | Retry after page stabilizes |
state_error |
Precondition not met (wrong view, not logged in) | Navigate to correct view first |
unknown |
Unexpected error | Report to user with context |
- Retry with re-injection: If a tool fails because navigation cleared injected helpers, the server re-injects and retries once automatically
- URL re-check: If the page URL changed within the app (e.g., clicking a form opens the editor), helpers are re-injected for the new page
- Fallback to browser automation: If an MCP tool consistently fails, the skill can fall back to computer use for that specific operation
If Chrome crashes or the CDP connection drops:
- The skill detects the failure via health check
- Offers to relaunch Chrome
- Re-navigates to the app
- Resumes from the last successful operation
The webmcp skill gracefully handles situations where MCP tools don't cover everything:
- Missing tools: Falls back to browser automation (computer use) for operations without MCP tools
- Broken tools: If a tool fails after retry, switches to browser automation
- Complex interactions: For highly dynamic or unusual operations,
run_scriptcan execute custom JavaScript - New features: When an app adds new UI that wasn't present during learning,
use
/learn-webappwith "Update/extend" mode to add new tools
- Always prefer MCP tools over raw browser automation when available
- Never skip the catalogue check — always look up available tools first
- Use
run_scriptfor batching — don't call 10 individual tools when one batch script can do it in a single round-trip - Report gaps honestly — tell the user when tools are missing
- Don't modify MCP server code at runtime — if tools need fixing, use
/learn-webappwith validate mode - Respect tool confidence scores — prefer high-confidence tools over low-confidence ones when alternatives exist
- Verify mutations — after setting values, confirm the change took effect
- Handle auth gracefully — if redirected to login, pause and notify the user
- Use health_check proactively — verify CDP connectivity before long operations
- Chain tools logically — respect operation dependencies and execution order
The catalogue.json file maps applications to their MCP servers:
{
"version": "2.0.0",
"repository": "https://github.com/ApartsinProjects/AutoWebMCP",
"applications": {
"google-sites": {
"displayName": "Google Sites",
"url": "https://sites.google.com/",
"urlPattern": "sites\\.google\\.com",
"mcps": [{
"name": "google-sites-mcp",
"version": "1.0.0",
"path": "MCPs/google-sites/server",
"operationCount": 33,
"confidence": 0.88,
"generatedAt": "2025-11-15"
}]
},
"google-forms": {
"displayName": "Google Forms",
"url": "https://docs.google.com/forms/",
"urlPattern": "docs\\.google\\.com/forms",
"mcps": [{
"name": "google-forms-mcp",
"version": "1.0.0",
"path": "MCPs/google-forms/server",
"operationCount": 30,
"confidence": 0.85,
"generatedAt": "2025-12-01"
}]
}
}
}Multiple MCPs per app: The mcps array supports multiple server versions.
When re-learning creates a new version, both coexist for rollback capability.
URL pattern matching: The urlPattern field is a regex tested against the
current browser URL. When a match is found, the corresponding MCP server is used.
Generated by AutoWebMCP.