WebMCP for AI agents

ImgFlow registers compression queue tools on the homepage and tool pages for in-browser AI agents (WebMCP draft API). Images still process on your device; agents can only call tools the page registered — there is no upload bypass.

Before you start

  • Desktop Google Chrome (latest Canary/Dev recommended; stable builds vary — check your version).
  • Visit this site over HTTPS (localhost is fine for development).
  • Open chrome://flags/#enable-webmcp-testing, set “WebMCP for testing” to Enabled, and fully relaunch Chrome.
  • The API is experimental — flag names and behavior can change between Chrome releases. Follow Google’s docs.

Enable the WebMCP testing flag

  1. Open chrome://flags/#enable-webmcp-testing
  2. Choose Enabled from the dropdown
  3. Click Relaunch at the bottom and wait for Chrome to exit and restart

chrome://flags/#enable-webmcp-testing · Chrome WebMCP documentation

Tools registered on this site

After the tool island loads on the homepage or any tool page, these tools register on document.modelContext:

  • add_image_from_url
  • set_compression_settings
  • get_compression_status
  • download_image
  • download_all_results
  • reset_queue

Smoke test (~1 minute)

On the homepage, open DevTools → Console, paste the script below, and run it. When WebMCP is enabled and the tool island loaded, you should get a list of tool names including get_compression_status.

Open the homepage to run the smoke test

(async () => {
  const mc = document.modelContext;
  if (!mc?.getTools) {
    return {
      ok: false,
      reason: 'document.modelContext.getTools is missing. Enable chrome://flags/#enable-webmcp-testing, relaunch Chrome, open the homepage, then retry.',
    };
  }
  const tools = await mc.getTools();
  const names = tools.map((tool) => tool.name).sort();
  return {
    ok: names.includes('get_compression_status'),
    names,
  };
})();

This only checks registration — not a full compress run. For an end-to-end agent flow, use a WebMCP-capable AI client or Chrome’s Model Context Tool Inspector extension and call add_image_from_url plus get_compression_status.

Limitations

  • Browsers without WebMCP never download webmcp.ts — zero change to normal use.
  • add_image_from_url is subject to CORS; use data: URLs or ask the user to drag files onto the page.
  • navigator.modelContext is deprecated — use document.modelContext (same as ToolApp).