Open-source AI browser agent for Chrome and Firefox (monorepo) π§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
feat: enable WebMCP by default
Emre Sokullu05af6610fc97
diff --git a/docs/agent-tools.md b/docs/agent-tools.mdindex 0d8afe7fd..3681789cb 100644--- a/docs/agent-tools.md+++ b/docs/agent-tools.md@@ -132,9 +132,9 @@ before the skill is loaded (or if it is removed), the tools are absent. Ask modestill filters out mutating and download tools even when their owning skill isloaded. See [skills](skills.md).-**WebMCP (experimental, opt-in).** The `list_webmcp_tools` /-`execute_webmcp_tool` rows apply only when **Experimental WebMCP** is enabled-under Settings β General β Advanced. The setting is off by default; while off,+**WebMCP (experimental, on by default).** The `list_webmcp_tools` /+`execute_webmcp_tool` rows apply when **Experimental WebMCP** is enabled+under Settings β General β Advanced. The setting is on by default; while off,the tools and their prompt guidance are omitted from model requests. WebMCPannotations such as `readOnly` are page-authored hints, not a security boundary.Every invocation requires Act or Dev, fresh per-call confirmation, and thediff --git a/docs/architecture.md b/docs/architecture.mdindex 5c2a525bc..46e26d80e 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -838,9 +838,9 @@ This does not handle browser permission requests, authentication windows, orOS file pickers. Firefox WebExtensions provide no equivalent native-dialog API;those dialogs still require manual handling in Firefox.-WebMCP is an experimental Chrome-only fast path that is off by default. The-user must enable **Experimental WebMCP** under Settings β General β Advanced;-until then, neither WebMCP tool schemas nor WebMCP prompt guidance enter model+WebMCP is an experimental Chrome-only fast path that is on by default. The+user can disable **Experimental WebMCP** under Settings β General β Advanced;+when disabled, neither WebMCP tool schemas nor WebMCP prompt guidance enter modelrequests. When enabled, `list_webmcp_tools` isavailable in Ask, Act, and Dev; `execute_webmcp_tool` is restricted to Act/Devand every invocation requires fresh confirmation plus permission against thediff --git a/docs/claude-chrome-comparison.md b/docs/claude-chrome-comparison.mdindex 03cefe794..7b3d9aa81 100644--- a/docs/claude-chrome-comparison.md+++ b/docs/claude-chrome-comparison.md@@ -99,7 +99,7 @@ core surface, including Dev-only `execute_js`, is shared.| Reading/extraction | `read_page`, `read_pdf`, `read_page_source`, `extract_data`, `inspect_element_styles`, `get_selection`, `find_text` || Dev editing and diagnostics | `inject_css`, `remove_injected_css`, `patch_element`, `revert_patch`, `execute_js`, `read_console`, `inspect_network_requests`, `inspect_event_listeners`, `highlight_element` || Shadow DOM and frames | `get_shadow_dom`, `shadow_dom_query` on Chrome, `get_frames`, `iframe_read`, `iframe_click`, `iframe_type`, `promote_iframe` |-| WebMCP (experimental) | `list_webmcp_tools`, `execute_webmcp_tool` on supported Chrome builds when enabled |+| WebMCP (experimental, on by default) | `list_webmcp_tools`, `execute_webmcp_tool` on supported Chrome builds when enabled || Network and files | `fetch_url`, `research_url`, `list_downloads`, `read_downloaded_file`, `download_resource_from_page`, `download_files`, `upload_file` || Long-running work | `schedule_resume`, `schedule_task`, `scratchpad_write`, `progress_update`, `progress_read` || Safety/workflow | `verify_form`, `clarify`, `done`, `solve_captcha` |diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 03864d006..c7ba30d23 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -1018,10 +1018,10 @@ export class Agent extends LoopDetector {// Defaults to true at extension runtime via background.js and Settings.this.strictSecretMode = false;- // Experimental Chrome WebMCP integration. Off by default so ordinary- // runs do not pay for unused tool schemas or prompt guidance. Users can- // opt in from Settings β General β Advanced.- this.webMcpEnabled = false;+ // Experimental Chrome WebMCP integration. On by default so supported+ // pages can expose structured tools without an opt-in step. Users can+ // opt out from Settings β General β Advanced.+ this.webMcpEnabled = true;// Profile auto-fill: when enabled, the user's profile text (name,// email, throwaway password, etc.) is appended to the system promptdiff --git a/src/chrome/src/background.js b/src/chrome/src/background.jsindex 879769a33..9b79e0cd4 100644--- a/src/chrome/src/background.js+++ b/src/chrome/src/background.js@@ -593,7 +593,7 @@ const strictSecretModeReady = loadStrictSecretMode().catch(() => {});async function loadWebMCPEnabled() {const stored = await chrome.storage.local.get('webMcpEnabled');- agent.setWebMCPEnabled(stored.webMcpEnabled === true);+ agent.setWebMCPEnabled(stored.webMcpEnabled !== false);}const webMcpEnabledReady = loadWebMCPEnabled().catch(() => {});@@ -1264,7 +1264,7 @@ chrome.storage.onChanged.addListener((changes, areaName) => {refreshPrompts = true;}if (changes.webMcpEnabled) {- agent.setWebMCPEnabled(changes.webMcpEnabled.newValue === true);+ agent.setWebMCPEnabled(changes.webMcpEnabled.newValue !== false);}if (changes.profileEnabled) {agent.profileEnabled = !!changes.profileEnabled.newValue;diff --git a/src/chrome/src/config-transfer.js b/src/chrome/src/config-transfer.jsindex 1aac9a21b..7ea6e1bb2 100644--- a/src/chrome/src/config-transfer.js+++ b/src/chrome/src/config-transfer.js@@ -41,7 +41,7 @@ export const DEFAULT_CONFIG_SETTINGS = Object.freeze({alwaysAllowApiMutations: true,apiMutationObserverEnabled: true,pdfViewerEnabled: true,- webMcpEnabled: false,+ webMcpEnabled: true,openaiAskStreamingEnabled: true,planBeforeActMode: 'try',planBeforeAct: true,diff --git a/src/chrome/src/ui/locales/en.js b/src/chrome/src/ui/locales/en.jsindex 416efc5e1..ac6bc84f6 100644--- a/src/chrome/src/ui/locales/en.js+++ b/src/chrome/src/ui/locales/en.js@@ -651,7 +651,7 @@ export default {'st.display.api_mutation_observer.label': 'API mutation observer','st.display.api_mutation_observer.desc': 'Observe same-tab XHR/fetch request URLs and methods so WebBrain can detect repeated UI actions and suggest API shortcut patterns. On by default.','st.display.webmcp.label': 'Experimental WebMCP',- 'st.display.webmcp.desc': 'Allow WebBrain to discover and run structured tools exposed by supported Chrome pages. Enabling this adds experimental WebMCP tools and guidance to the model context. Off by default.',+ 'st.display.webmcp.desc': 'Allow WebBrain to discover and run structured tools exposed by supported Chrome pages. Enabling this adds experimental WebMCP tools and guidance to the model context. On by default.',// TRANSLATORS: Updated for multi-provider Ask streaming and silent transport fallback.'st.display.openai_ask_streaming.label': 'Stream Ask responses','st.display.openai_ask_streaming.desc': 'Show text as it arrives in Ask mode for supported providers. Interrupted streams show a notice and retry once without streaming; provider/API errors are still shown. Tool calls wait for stream completion; Act, Dev, scheduled, cloud, and Continue runs stay non-streaming. On by default.',diff --git a/src/chrome/src/ui/settings.html b/src/chrome/src/ui/settings.htmlindex f3f40e4fd..f1ac29d1d 100644--- a/src/chrome/src/ui/settings.html+++ b/src/chrome/src/ui/settings.html@@ -1770,7 +1770,7 @@<div class="setting-desc" data-i18n="st.display.webmcp.desc"></div></div><label class="toggle">- <input type="checkbox" id="toggle-webmcp">+ <input type="checkbox" id="toggle-webmcp" checked><span class="toggle-slider"></span></label></div>diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.jsindex c2086941e..145ad4676 100644--- a/src/chrome/src/ui/settings.js+++ b/src/chrome/src/ui/settings.js@@ -863,7 +863,7 @@ async function init() {if (voiceInputToggle) voiceInputToggle.checked = stored.voiceInputEnabled ?? true;alwaysAllowApiMutationsToggle.checked = stored.alwaysAllowApiMutations === undefined || stored.alwaysAllowApiMutations === true;apiMutationObserverToggle.checked = stored.apiMutationObserverEnabled === undefined || stored.apiMutationObserverEnabled === true;- if (webMcpToggle) webMcpToggle.checked = stored.webMcpEnabled === true; // off by default+ if (webMcpToggle) webMcpToggle.checked = stored.webMcpEnabled !== false; // on by defaultif (openAIAskStreamingToggle) openAIAskStreamingToggle.checked = stored.openaiAskStreamingEnabled !== false;if (planBeforeActModeSelect) {planBeforeActModeSelect.value = normalizePlanBeforeActMode(stored);diff --git a/src/firefox/src/config-transfer.js b/src/firefox/src/config-transfer.jsindex 1aac9a21b..7ea6e1bb2 100644--- a/src/firefox/src/config-transfer.js+++ b/src/firefox/src/config-transfer.js@@ -41,7 +41,7 @@ export const DEFAULT_CONFIG_SETTINGS = Object.freeze({alwaysAllowApiMutations: true,apiMutationObserverEnabled: true,pdfViewerEnabled: true,- webMcpEnabled: false,+ webMcpEnabled: true,openaiAskStreamingEnabled: true,planBeforeActMode: 'try',planBeforeAct: true,diff --git a/test/run.js b/test/run.jsindex 4faa4ce7b..0b443fc79 100644--- a/test/run.js+++ b/test/run.js@@ -61990,33 +61990,37 @@ test('MCP bridge settings are Chromium-only, live under Advanced, and keep setup}});-test('Experimental WebMCP is Chrome-only, opt-in, and absent from default model context', async () => {+test('Experimental WebMCP is Chrome-only, on by default, and present in default model context', async () => {const html = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/settings.html'), 'utf8');const firefoxHtml = fs.readFileSync(path.join(ROOT, 'src/firefox/src/ui/settings.html'), 'utf8');const settings = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/settings.js'), 'utf8');const background = fs.readFileSync(path.join(ROOT, 'src/chrome/src/background.js'), 'utf8');const locale = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/locales/en.js'), 'utf8');- assert.match(html, /id="toggle-webmcp"/, 'Chrome Advanced settings should expose the opt-in');- assert.doesNotMatch(html, /id="toggle-webmcp"\s+checked/, 'WebMCP must default off');+ assert.match(html, /id="toggle-webmcp"/, 'Chrome Advanced settings should expose the toggle');+ assert.match(html, /id="toggle-webmcp"\s+checked/, 'WebMCP must default on');assert.doesNotMatch(firefoxHtml, /id="toggle-webmcp"/, 'Firefox should not show an unsupported toggle');- assert.match(settings, /webMcpToggle\.checked = stored\.webMcpEnabled === true/, 'setting should load only explicit true');+ assert.match(settings, /webMcpToggle\.checked = stored\.webMcpEnabled !== false/, 'setting should default on unless explicitly disabled');assert.match(settings, /webMcpEnabled:\s*webMcpToggle\.checked/, 'setting should persist changes');- assert.match(background, /agent\.setWebMCPEnabled\(stored\.webMcpEnabled === true\)/, 'background should hydrate the default-off gate');- assert.match(background, /changes\.webMcpEnabled[\s\S]*agent\.setWebMCPEnabled\(changes\.webMcpEnabled\.newValue === true\)/, 'storage changes should update the live gate');+ assert.match(background, /agent\.setWebMCPEnabled\(stored\.webMcpEnabled !== false\)/, 'background should hydrate the default-on gate');+ assert.match(background, /changes\.webMcpEnabled[\s\S]*agent\.setWebMCPEnabled\(changes\.webMcpEnabled\.newValue !== false\)/, 'storage changes should update the live gate');assert.match(locale, /'st\.display\.webmcp\.label': 'Experimental WebMCP'/, 'English setting label missing');- assert.equal(ConfigTransferCh.DEFAULT_CONFIG_SETTINGS.webMcpEnabled, false, 'Chrome config export should preserve the opt-in default');- assert.equal(ConfigTransferFx.DEFAULT_CONFIG_SETTINGS.webMcpEnabled, false, 'Firefox config schema should preserve cross-browser config compatibility');+ assert.equal(ConfigTransferCh.DEFAULT_CONFIG_SETTINGS.webMcpEnabled, true, 'Chrome config export should preserve the default-on value');+ assert.equal(ConfigTransferFx.DEFAULT_CONFIG_SETTINGS.webMcpEnabled, true, 'Firefox config schema should preserve cross-browser config compatibility');const originalDisableAll = cdpClientCh.disableAllWebMCP;let cleanupCalls = 0;cdpClientCh.disableAllWebMCP = async () => { cleanupCalls++; return 0; };try {const agent = new AgentCh({});- assert.equal(agent.webMcpEnabled, false);- assert.doesNotMatch(agent._buildSystemPrompt('ask'), /WEBMCP/i, 'default Ask prompt should not mention WebMCP');- assert.equal(getToolsForModeCh('ask', { webMcpAvailable: agent.webMcpEnabled }).some(tool => tool.function.name === 'list_webmcp_tools'), false);+ assert.equal(agent.webMcpEnabled, true);+ assert.match(agent._buildSystemPrompt('ask'), /WEBMCP \(experimental/i, 'default Ask prompt should explain WebMCP');+ assert.equal(getToolsForModeCh('ask', { webMcpAvailable: agent.webMcpEnabled }).some(tool => tool.function.name === 'list_webmcp_tools'), true);+ agent.setWebMCPEnabled(false);+ await Promise.resolve();+ assert.equal(cleanupCalls, 1, 'turning the setting off should close active WebMCP sessions');+ assert.doesNotMatch(agent._buildSystemPrompt('ask'), /WEBMCP/i, 'disabling should remove prompt guidance again');const disabledList = await agent.executeTool(77, 'list_webmcp_tools', {});assert.equal(disabledList.featureDisabled, true);assert.equal(disabledList.noDispatch, true);@@ -62026,11 +62030,6 @@ test('Experimental WebMCP is Chrome-only, opt-in, and absent from default modelagent.setWebMCPEnabled(true);assert.match(agent._buildSystemPrompt('ask'), /WEBMCP \(experimental/i, 'enabled Ask prompt should explain WebMCP');assert.equal(getToolsForModeCh('ask', { webMcpAvailable: agent.webMcpEnabled }).some(tool => tool.function.name === 'list_webmcp_tools'), true);-- agent.setWebMCPEnabled(false);- await Promise.resolve();- assert.equal(cleanupCalls, 1, 'turning the setting off should close active WebMCP sessions');- assert.doesNotMatch(agent._buildSystemPrompt('ask'), /WEBMCP/i, 'disabling should remove prompt guidance again');} finally {cdpClientCh.disableAllWebMCP = originalDisableAll;}diff --git a/test/webmcp-e2e.mjs b/test/webmcp-e2e.mjsindex d511f54b3..8972dfbcf 100644--- a/test/webmcp-e2e.mjs+++ b/test/webmcp-e2e.mjs@@ -272,6 +272,8 @@ async function initializeExtensionAgent(harness, tabId) {const { Agent } = await import(chrome.runtime.getURL('src/agent/agent.js'));const agent = new Agent({});globalThis.__webMCPAgentSmoke = agent;+ // Explicitly exercise the disabled gate before running the enabled flow.+ agent.setWebMCPEnabled(false);const disabledCatalog = await agent.executeTool(targetTabId, 'list_webmcp_tools', {});agent.setWebMCPEnabled(true);return disabledCatalog;