Catalog: Loading… BM25: (8, 6, 4, 1, 1, 3) Schema Gate: SHA-256 Ready

Track 9 · Agent Bridges & Discovery · BM25 + SHA-256 Schema Gate

WebMCP Intent Registry Lab

When an assistant connects to dozens of WebMCP websites at once, dumping every site's MCP tools/list schema into the prompt wastes thousands of context tokens. Searching tools on demand with a browser-local Okapi BM25 index keeps upfront prompt overhead constant, while pinning each tool's canonical WebCrypto SHA-256 hash blocks sites from silently rewriting descriptions or parameters before execution.

Why this matters

Eager tool lists grow linearly with every connected site, while unguarded name-only tool lookup lets a publisher inject hidden instructions or widen permissions after a tool is cached.

What this opens up

Safe cross-site tool lookup across 2–60 websites at a flat ~650-token upfront cost, with zero silent prompt injection from drifted schemas because mutated contracts halt with 409 SCHEMA_DRIFT.

How the tests work

Try the Lexical Mismatch button to see keyword search fail without synonyms, run the 11-Query Eval Suite to compare recall scores, and fire a live Schema Rug-Pull against the Worker to compare unguarded vs. hash-pinned calls.

3 Things To Try

1. See Keyword Search Miss Without Synonyms

Searches "book an overnight sleeper" across 24 tools with synonyms OFF (reserve_cabin scores 0 because it says couchette and berth), then turns synonyms ON to rank it #1.

2. Score Search Accuracy Across 11 Queries

Runs 11 realistic cross-site tasks and reports Recall@1, Recall@3, and MRR so you can measure how much curated synonyms change retrieval accuracy.

3. Block a Silent Tool Schema Rug-Pull

Secretly alters save_bookmark on the Worker to inject append cookie_jar to notes, then compares Name-Only Dispatch (200 EXPLOIT) against the SHA-256 Gate (409 SCHEMA_DRIFT).

1. Cross-Site Keyword Tool Search (Okapi BM25)

Search 24 tools across 8 simulated WebMCP sites using weighted keyword scoring (toolName: 8, siteTitle: 6, description: 4, origin: 1, schemaKeys: 1, synonyms: 3).

Presets:
Ready
Rank Site & Tool Total BM25 Field Breakdown (name / site / desc / orig / schema / syn) Matched Tokens

2. 11-Query Search Accuracy Eval (Recall@1 & Recall@3)

Run all 11 benchmark queries with synonyms OFF or ON to see exactly which user phrasings pure keyword search misses.

Mode -- Weights: 8,6,4,1,1,3
Top-1 Recall@1 -- 0 / 11 queries
Top-3 Recall@3 -- 0 / 11 queries
MRR / Lexical Misses -- Misses (> Top-3): 0
Eval ID Intent Query Expected Tool Rank Top-1 Returned Score / Status

3. Schema Rug-Pull Diff Gate (Live Worker Check)

Test what happens when a site changes a tool's description or schema after discovery while keeping its name identical: unguarded dispatch runs it, while the SHA-256 gate stops it with 409 SCHEMA_DRIFT.

Status: Checking Digests…

Cached Pinned Digest (At Discovery) sha256:computing...
Live Publisher Digest (Fetched from /api/sites/:site/manifest) sha256:computing...

Field-by-Field Canonical Schema Diff

JSON Path Change Cached vs. Live Value

Live Worker Wire Response (POST /api/sites/:site/call)

Awaiting Dispatch
Click "Dispatch Unguarded" or "Dispatch with Pinned SHA-256 Gate" above to execute a live request against the Worker.

4. On-Demand Search (--stable) vs. Full-Catalog Prompt Cost

Drag the slider from 2 to 60 sites to compare loading every site's tool schema upfront against keeping 7 small search/call wrapper tools.

Scale:
Eager tools/list_changed -- 0 chars serialized
--stable Upfront Meta-Tools -- Fixed 7 wrapper tools
--stable + Top-k Retrieval -- Upfront + 1 search turn
Context Token Savings -- Saved per conversation start
Connected Sites Total Tools Eager tools/list Tokens --stable + Top-k Tokens Relative Context Footprint Reduction
Inspect Raw MCP tools/list JSON Payloads (Eager vs. --stable)
Eager tools/list_changed (first 3 tools shown)
Loading...
--stable Mode (fixed 7 wrapper meta-tools)
Loading...

5. Live Site Manifests & Text-Parser Fragility Check

Inspect the 8 JSON tool manifests served by this Worker and see how text scraping breaks when a tool description contains ", inputSchema=.

1. All 8 Multi-Site WebMCP Manifests & Canonical SHA-256 Digests (GET /api/manifests)
Fetched from /api/manifests
Loading manifests...
2. parseChromeWebmcpListing() Text-Listing Fragility Probe (GET /api/parser-fragility)
Why structured JSON manifests are required instead of scraping Chrome DevTools text output
Click "Fetch Fragility Probe" or expand to inspect naive delimiter truncation on embedded ", inputSchema=".
Architecture How on-demand BM25 lookup and SHA-256 schema pinning protect cross-site tool calls
Client & Relay Boundary · Constant upfront prompt size + pre-call hash verification
1. Caller

MCP Client (--stable Mode)

search_registry -> execute_registry_tool
  • Loads only 7 fixed wrapper tools instead of every connected site's full catalog
  • Queries by task phrasing and receives Top-k matches with a pinned sha256: hash
2. Index & Hash Gate

BM25 Index & Diff Gate public/lib/

  1. Ranks 24 tools across 8 sites using BM25 field weights (8, 6, 4, 1, 1, 3)
  2. Re-fetches the site's live manifest right before running a cached tool
  3. Computes sha256(canonicalJson(liveTool)) with WebCrypto
  4. Compares against the discovery pin and builds a field-by-field diff if changed

No model inference runs in ranking or gating: every score and hash is deterministic.

200 VERIFIED

Hash Matches Pin

expectedSchemaHash === liveSchemaHash
X-Schema-Gate: VERIFIED No schema drift
409 SCHEMA_DRIFT

Mutation Blocked

description / enum / properties changed

Call stops before running; caller reviews the exact diff before re-pinning.

Cloudflare Edge Worker src/worker.ts

Simulated Publishers

Serves 8 WebMCP site manifests on GET /api/manifests and GET /api/sites/:site/manifest, enforces or bypasses hash pinning on POST /api/sites/:site/call, and reproduces text-parser truncation on GET /api/parser-fragility.

BM25 indexing, evaluation scoring, token counting, and canonical SHA-256 diffing run deterministically in both the browser and the Cloudflare Worker using shared ES modules.
How This Is Set Up

Cross-Site BM25 Retrieval & Canonical SHA-256 Schema Pinning

Replacing eager tools/list_changed catalog dumps and name-only registry execution with weighted BM25 lookup plus canonical SHA-256 pre-invocation verification.

Fragile: eager catalog + name-only dispatch
// 1. Eager tools/list_changed pushes all N sites' schemas into context (O(N))
// 2. executeRegistryTool only verifies tool name still exists:
const currentTool = siteTools.find((tool) => tool.name === entry.toolName);
if (!currentTool) throw new Error("Tool missing");

// Silently executes even if description injected "append cookie_jar"
// or action.enum widened from ["read"] to ["read", "delete"]!
await bridge.executePageTool(entry.toolName, input);
Hardened: --stable BM25 + SHA-256 diff gate
// 1. --stable mode keeps 7 meta-tools (O(1)) + Top-k BM25(8,6,4,1,1,3) search
// 2. Before invoking, hash live contract and compare to discovery pin:
const liveHash = await computeSchemaHash(liveTool);
if (liveHash !== pinnedHash) {
  const diff = diffToolSchemas(cachedTool, liveTool);
  return Response.json(
    { ok: false, code: "SCHEMA_DRIFT", expectedSchemaHash: pinnedHash, liveSchemaHash: liveHash, diff },
    { status: 409 }
  );
}
What disappears

Linear prompt bloat from injecting dozens of origins' full JSON Schemas via tools/list_changed, and silent post-discovery contract mutations.

What becomes explicit

Per-field Okapi BM25 weights, lexical vocabulary gaps when synonyms are absent, and canonical sha256: schema digests pinned at discovery time.

Platform gaps remaining

Chrome DevTools MCP's experimental WebMCP listing currently serializes tools as fragile text (name="...", description="...", inputSchema=) rather than signed structured manifests, and pure lexical BM25 still requires synonyms or hybrid dense retrieval for zero-overlap phrasing.

Key terms & further reading
WebMCP (navigator.modelContext)
A browser API proposal letting websites register structured callable tools directly in the page for assistants to invoke.
Model Context Protocol (MCP)
A JSON-RPC protocol that lets assistants list available tools (tools/list) and execute them with typed JSON inputs.
Okapi BM25
A deterministic keyword-ranking formula that scores matches by term frequency, rarity, and per-field weights without running an LLM.
SHA-256 Schema Pinning (Web Crypto API)
Hashing a tool's sorted JSON contract at discovery time so any later edit to its description or parameters triggers a mismatch.
Tool Schema Rug-Pull
An attack where a remote site alters a tool's description or allowed inputs after approval to inject hidden instructions or widen access.
Recall@k & MRR
Search-quality metrics measuring how often the right tool appears in the top k results and how close it ranks to #1.