Panduan WebMCP

WebMCP lets sebuah halaman web expose structured alat untuk sebuah AI agent di browser. Learn how ini differs dari MCP, what Chrome mendukung, security risks, dan when untuk wait.

Pertama kali diterbitkan: 17 Jul 2026 · Terakhir diperbarui: 3 Agu 2026 · Advanced
Bahasa
1 sinyal bukti di halaman ini

WebMCP adalah sebuah experimental browser API itu lets sebuah open halaman web offer structured alat untuk sebuah AI agent. ini adalah berguna untuk bounded halaman tindakan, not web penemuan atau rankings. sebagai dari July 17, 2026, ini adalah sebuah Community Group draft dan Chrome 149 origin trial; saat ini Chrome contoh gunakan document.modelContext, while navigator.modelContext adalah deprecated di Chrome 150.

TL;DR — WebMCP exposes halaman-owned alat dari document.modelContext untuk sebuah agent di active browsing context. imperative API registers sebuah name, deskripsi, JSON Schema input, annotations, dan sebuah async callback; alat dapat menjadi state-dependent dan unregistered dengan sebuah AbortSignal. Chrome documents sebuah declarative form layer too, tetapi July 10, 2026 Community Group draft masih labels -nya declarative bagian TODO. fitur adalah di sebuah Chrome 149 origin trial, not sebuah stable cross-browser baseline. Treat ini sebagai progressive enhancement, not SEO infrastructure, dan secure ini sebagai sebuah authenticated application surface.

Evidence for this claim Chrome documents declarative form annotations such as toolname and tooldescription, but the declarative section of the July 10, 2026 Community Group draft is still marked TODO. Scope: secure browser context Confidence: high · Verified: WebMCP Draft Community Group Report

How WebMCP berfungsi di browser

sebuah berguna WebMCP lifecycle begins dan ends dengan halaman. halaman registers hanya tindakan itu adalah valid di -nya saat ini state; sebuah agent sudah operating di itu browsing context discovers dan invokes one; halaman executes -nya normal application logic, updates human-terlihat interface, dan mengembalikan sebuah bounded hasil. When state perubahan, halaman menghapus alat itu no longer apply. Evidence for this claim The imperative API registers named, described, schema-constrained callbacks and supports state-aware cleanup with AbortSignal plus tool-set change notifications. Scope: Current draft and Chrome experiment; API details may change before stable release. Confidence: high · Verified: WebMCP ModelContext API Chrome: WebMCP Imperative API

WebMCP tools should follow the page's real state: register a valid action, execute the same logic as the UI, and remove it when the action is no longer available. Sumber: Patrick Stox — WebMCP

Five numbered steps run left to right. First, the page registers a name, description, input schema, and callback. Second, an agent already in the page context discovers it. Third, the agent invokes it with validated structured arguments. Fourth, the page reuses its normal application logic and updates the visible interface. Fifth, it returns a bounded result or safe error. A branch from execution shows that state changes or navigation should unregister the tool with AbortSignal and notify observers through toolchange.

© Patrick Stox LLC · CC BY 4.0 ·

ini stateful lifecycle adalah one alasan WebMCP seharusnya not become sebuah static dump dari setiap function di sebuah JavaScript bundle. sebuah alat itu adalah impossible di terlihat UI seharusnya normally menjadi unavailable untuk agent too.

WebMCP vs MCP: two berbeda runtime boundaries

names invite confusion, tetapi operational boundary adalah berbeda. WebMCP lives di sebuah document’s event loop dan saat ini browser session. Remote MCP lives di AI application’s integration boundary dan commonly reaches sebuah persistent backend server. Evidence for this claim WebMCP is designed for tools owned by an active page and its browser context, while remote MCP commonly connects an AI application to a persistent backend server. Scope: Architecture-selection guidance, not a rule that prevents an application from using both technologies. Confidence: high · Verified: Chrome: When to use WebMCP and MCP

WebMCP owns page-context actions; remote MCP owns durable application-to-server integrations. Many products will use both. Sumber: WebMCP

The left lane shows WebMCP: a browser agent interacts with an open web page, which owns a JavaScript tool and current visible session state. The page must be open for those tools to exist. The right lane shows remote MCP: an AI application connects through an MCP client to a persistent MCP server, which can remain available outside a browser tab. The two lanes are complementary rather than replacements.

© Patrick Stox LLC · CC BY 4.0 ·

InterfaceWhere ini livesWhen ini adalah ditemukanhalaman harus menjadi open?Best fit
WebMCPActive browser documentsetelah client visits halamanYessaat ini UI state dan halaman tindakan
Remote MCPAI client dan sebuah MCP servermelalui client/server configuration atau penemuanNoPersistent alat, data, dan backend workflows
Web/API endpointApplication backendmelalui application-spesifik integrationNoStable programmatic access untuk known consumers
data terstrukturhalaman markupselama halaman processingbiasanya fetched sebagai kontenDescribing entities dan halaman meaning, not executing tindakan
llms.txtStatic text fileWhen sebuah client chooses untuk permintaan iniNo active tab diperlukanProposed konten guidance; not sebuah callable alat surface
browser automationAgent/controller interpreting UIsetelah memuat dan inspecting halamanYesFallback where no explicit halaman alat exists

melakukan not choose dari acronym. Choose dari owner dari tindakan. jika tindakan perlu saat ini DOM, selection, cart, atau UI state, WebMCP dapat fit. jika ini harus run di background, di seluruh banyak situs, atau without sebuah open tab, gunakan API atau remote MCP.

imperative API

imperative API registers sebuah alat melalui document.modelContext.registerTool(). alat mencakup sebuah unique name, deskripsi, JSON Schema input, sebuah execute callback, dan optional annotations. Chrome juga documents getTools(), executeTool() untuk testing, dan sebuah toolchange event. Evidence for this claim Current Chrome documentation uses document.modelContext and says navigator.modelContext is deprecated beginning in Chrome 150. Scope: Chrome implementation guidance checked July 17, 2026; version and API-name claims expire quickly. Confidence: high · Verified: Chrome: WebMCP Imperative API

ini illustrative candidate menampilkan intended shape untuk sebuah future Schema Validator pilot. ini adalah not running pada ini situs, dan API dapat perubahan sebelum sebuah stable release:

if (document.modelContext) {
  const registration = new AbortController();

  await document.modelContext.registerTool({
    name: 'validate_schema',
    description: 'Validate pasted JSON-LD and return bounded issues.',
    inputSchema: {
      type: 'object',
      properties: {
        markup: {
          type: 'string',
          description: 'JSON-LD markup to validate.',
          maxLength: 50000
        }
      },
      required: ['markup'],
      additionalProperties: false
    },
    annotations: {
      readOnlyHint: true,
      untrustedContentHint: true
    },
    execute: async ({ markup }) => {
      const result = await validateWithTheSameEngineAsTheUI(markup);
      renderResultInTheVisibleUI(result);
      return minimizeValidationResult(result);
    }
  }, { signal: registration.signal });

  // When this page state no longer supports validation:
  // registration.abort();
}

penting architecture adalah not wrapper. ini adalah itu callback panggilan sama validator sebagai terlihat UI, server-side limits dan authorization masih apply, dan respons adalah deliberately minimized. fitur detection preserves full human workflow di unsupported browser.

gunakan document.modelContext, not stale contoh dibangun sekitar navigator.modelContext; Chrome marks latter deprecated beginning di Chrome 150. Date itu advice because fitur remains experimental.

Evidence for this claim Current Chrome documentation uses document.modelContext; navigator.modelContext is deprecated in Chrome 150. Scope: browser document Confidence: high · Verified: WebMCP Imperative API

declarative API memiliki sebuah standards mismatch

Chrome documents sebuah declarative approach itu annotates ordinary forms dengan attributes such sebagai toolname, tooldescription, dan toolparamdescription. ini juga documents optional toolautosubmit; otherwise, pengguna clicks Submit. SubmitEvent.agentInvoked identifies sebuah agent-triggered submission. Evidence for this claim Chrome documents declarative WebMCP form annotations, but the July 10, 2026 Community Group draft says its Declarative WebMCP section is entirely TODO. Scope: A direct comparison between Chrome implementation documentation and the current draft; it does not imply Chrome's experimental implementation is unavailable. Confidence: high · Verified: Chrome: WebMCP Declarative API WebMCP: Declarative WebMCP

However, July 10 Community Group Report says -nya Declarative WebMCP bagian adalah “entirely a TODO” (terjemahan) “entirely sebuah TODO” dan leaves form-untuk-JSON-Schema algorithm undefined. itu tidak berarti Chrome’s experiment adalah imaginary. ini berarti implementation documentation adalah ahead dari normative draft. Treat declarative markup sebagai sebuah experimental Chrome surface, not settled cross-browser HTML.

Evidence for this claim Chrome documents declarative WebMCP form annotations, but the July 10, 2026 Community Group draft says its Declarative WebMCP section is entirely TODO. Scope: A direct comparison between Chrome implementation documentation and the current draft; it does not imply Chrome's experimental implementation is unavailable. Confidence: high · Verified: Chrome: WebMCP Declarative API WebMCP: Declarative WebMCP

untuk now, ordinary semantic forms remain durable base. sebuah experimental annotation layer seharusnya enhance them, tidak pernah replace labels, validation, accessibility, confirmation, atau server-side authorization.

alat penemuan, lifecycle, dan cross-origin boundaries

saat ini API memiliki several boundaries worth designing explicitly:

  • Browsing context: Chrome’s experiment memerlukan sebuah browser context. client visits situs sebelum ini discovers situs’s alat.
  • Dynamic availability: register alat when mereka adalah valid dan abort mereka registration when state atau navigation invalidates them. Observers dapat listen untuk toolchange.
  • sama origin oleh default: tools Permissions Policy defaults untuk 'self'. Cross-origin iframes perlu explicit delegation such sebagai allow="tools".
  • Two-sided cross-origin consent: sebuah alat dapat gunakan exposedTo untuk list allowed secure origins, while sebuah caller permintaan alat dari named origins dengan fromOrigins. One side opting di adalah not enough.
  • Progressive enhancement: unsupported atau disabled WebMCP harus leave ordinary halaman fully usable.
Evidence for this claim WebMCP tool exposure is origin-isolated and controlled by the tools Permissions Policy; cross-origin iframes require explicit delegation. Scope: browser document Confidence: high · Verified: WebMCP Imperative API

ini adalah berguna platform controls, tetapi mereka melakukan not turn sebuah risky application tindakan ke sebuah safe one.

Security: browser session raises stakes

sebuah browser agent dapat operate inside pengguna’s authenticated session. itu dapat menjadi fitur—access untuk saat ini cart, account, atau workspace—dan danger. Chrome dan draft discuss prompt injection, misleading alat metadata, contaminated alat output, di atas-broad parameters, privacy leakage, cross-origin exposure, dan misuse dari signed-di authority. Evidence for this claim WebMCP tool hints can communicate read-only and untrusted-output intent, but they do not eliminate prompt injection, misleading metadata, privacy leakage, cross-origin risk, or misuse of authenticated browser authority. Scope: Threat-model and defensive guidance; application authorization and confirmation remain implementation responsibilities. Confidence: high · Verified: WebMCP security and privacy considerations Chrome: WebMCP tool security Chrome: Agent security considerations

Treat setiap alat sebagai sebuah public application endpoint dengan sebuah unusual caller:

  1. pertahankan alat narrow. One job, explicit inputs, tight enums dan lengths, no hidden “do anything” (terjemahan) “melakukan anything” parameter.
  2. Enforce authorization di application logic. agent melakukan not gain more authority daripada signed-di pengguna, dan sebuah hint adalah not permission.
  3. Separate reads dari writes. readOnlyHint dan untrustedContentHint communicate risk; mereka melakukan not enforce ini.
  4. memerlukan terlihat confirmation untuk consequences. Purchases, submissions, deletions, messages, dan account perubahan perlu sebuah human-understandable checkpoint.
  5. Minimize output. kembalikan hanya what task perlu; tidak pernah spill session data, raw headers, secrets, atau unrelated records.
  6. Treat output sebagai untrusted. sebuah string dikembalikan oleh one alat dapat become input untuk later model reasoning. melakukan not allow ini untuk smuggle instructions atau authority.
  7. Log boundary. Record alat, input class, authorization decision, confirmation, hasil class, error, origin, dan lifecycle without logging secrets.

safe pertanyaan adalah not “Can an agent call this?” (terjemahan) “dapat sebuah agent panggil ini?” ini adalah “Would I expose this as a reviewed endpoint to a caller that can misunderstand instructions and relay untrusted text?” (terjemahan) “akan I expose ini sebagai sebuah reviewed endpoint untuk sebuah caller itu dapat misunderstand instructions dan relay untrusted text?”

Test contracts dan agent perilaku separately

Chrome’s eval guidance separates deterministic product tests dari probabilistic agent tests. Evidence for this claim WebMCP testing should combine deterministic contract and UI-state tests with probabilistic evaluation of agent tool selection and use. Scope: Chrome's evaluation guidance; teams must define product-specific tasks, models, risks, and thresholds. Confidence: high · Verified: Chrome: Evals for WebMCP Both penting:

Deterministic tests seharusnya verify registration, schema rejection, valid dan invalid inputs, authorization, rate limits, side effects, error shape, output minimization, UI parity, unregister perilaku, dan unsupported-browser fallback.

Probabilistic evals seharusnya mengukur whether representative agents menemukan right alat, hindari irrelevant alat, choose correct parameters, tanyakan untuk clarification when diperlukan, respect confirmations, stop setelah success, dan resist adversarial deskripsi atau output.

jangan gunakan one demo prompt sebagai release gate. sebuah successful callback proves code ran; ini melakukan not prove itu models select ini reliably atau itu tindakan adalah safe.

Cloudflare browser Run: berguna lab, not enablement

Cloudflare documents WebMCP mendukung di browser Run’s experimental lab pool dan says lab sessions seharusnya not menjadi digunakan untuk production workloads. -nya April 23 halaman juga berisi older Chrome-era testing names, so gunakan itu halaman sebagai evidence dari Cloudflare’s saat ini product offering—not sebagai authority untuk latest WebMCP API shape. Evidence for this claim Cloudflare Browser Run offers experimental lab sessions that can consume and test page-provided WebMCP tools, but the page still owns tool registration and Cloudflare says lab sessions are not for production workloads. Scope: Cloudflare product documentation last updated April 23, 2026; its example API names lag current Chrome documentation and should not be used as the API authority. Confidence: high · Verified: Cloudflare Browser Run: WebMCP

Cloudflare dapat menyediakan sebuah browser session dan sebuah agent path itu consumes alat. ini cannot infer safe contract untuk Anda application atau register halaman-owned alat Anda melakukan not bangun.

Proposed patrickstox.com pilot: Schema Validator

Schema Markup Validator adalah sebuah baik future pilot candidate, not sebuah live WebMCP implementation. ini sudah memiliki sebuah bounded pasted input, deterministic logic, structured issues, dan sebuah terlihat hasil. sebuah future validate_schema alat dapat reuse yang sama validation mesin sebagai UI dan existing remote MCP alat suite.

pilot seharusnya wait until browser API reaches sebuah stable, non-experimental release dan passes sebuah fresh security review. pertama versi seharusnya menjadi read-hanya, fitur-detected, input-limited, respons-minimized, dan unavailable pada preview, admin, atau owner-hanya surfaces. ini situs melakukan not currently claim WebMCP mendukung.

Decision: bangun, experiment, wait, atau skip

SituationDecision
Stable browser mendukung adalah diperlukan untuk sebuah customer workflowWait dan pertahankan normal UI/API complete
Anda memiliki sebuah bounded read-hanya tindakan dan dapat run sebuah private labExperiment, dengan fitur detection dan no production dependency
task perlu background atau headless executiongunakan API atau remote MCP
halaman hanya publishes kontenSkip WebMCP; meningkatkan semantic, accessible HTML
tindakan writes, purchases, submits, deletes, atau exposes private datamelakukan not pilot casually; memerlukan sebuah separate threat model dan confirmation design
sebuah stable implementation ships dan semua contract/security/parity tests passpertimbangkan sebuah progressive production pilot

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.