検証: WebMCPのnavigator/document揺れをGitHub Issueで裏取りしフォーム公開PoCを書いた
00:01:37 ・ source: https://zenn.dev/mskbhd/articles/lab-238-webmcpfeature-detectionpoc
Transcript
hostenToday we dive into WebMCP—a browser API that lets websites expose tools directly to AI agents.
guestja今日はWebMCPについて見ていきます。これはWebサイトがAIエージェント向けにツールを直接公開するブラウザAPIです。
hostenThe author found conflicting info: some sources said navigator.modelContext, others said document.modelContext.
guestja記事の著者が情報を集めたら、あるソースではnavigator.modelContextで、別のソースではdocument.modelContextと書かれていました。
hostenBy checking GitHub issues, they discovered the spec changed May 27—window-scoped became document-scoped.
guestjaGitHubのIssueを調べたら、5月27日に仕様が破壊的変更を経ており、Window スコープから Document スコープへ移行していました。
hostenChrome provides navigator.modelContext as an alias for backward compatibility, so old code still works.
guestjaChromeは後方互換性のためnavigator.modelContextをdocument.modelContextのエイリアスとして提供しているので、古いコードも動きます。
hostenChrome 146 had the flag experiment, but Chrome 149 started the official Origin Trial phase.
guestjaChrome 146ではフラグ実験で、Chrome 149からOrigin Trial という本番配布実験がはじまった別ステージです。
hostenThe author proved it works: add HTML attributes to forms, and browsers auto-register them as tools for agents.
guestja著者が実装して動かしたところ、HTMLフォームに属性を足すだけでブラウザが自動的にツールとして登録され、AIエージェントから呼び出せます。