webmcp-testing

Test WebMCP tools with AI agents — Chrome DevTools integration, agent testing workflows, tool discovery verification, and end-to-end commerce flow testing. Use when validating that tools work correctly with real AI agents.

17 stars

Best use case

webmcp-testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Test WebMCP tools with AI agents — Chrome DevTools integration, agent testing workflows, tool discovery verification, and end-to-end commerce flow testing. Use when validating that tools work correctly with real AI agents.

Teams using webmcp-testing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/webmcp-testing/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/webmcp-browser-agents/.agent/skills/webmcp-testing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/webmcp-testing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How webmcp-testing Compares

Feature / Agentwebmcp-testingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Test WebMCP tools with AI agents — Chrome DevTools integration, agent testing workflows, tool discovery verification, and end-to-end commerce flow testing. Use when validating that tools work correctly with real AI agents.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# WebMCP Testing

## Before writing code

**Fetch live docs**:
1. Web-search `webmcp testing tools agents Chrome DevTools` for testing tooling and guidance
2. Web-search `site:developer.chrome.com webmcp testing early preview` for Chrome EPP testing instructions
3. Web-search `webmcp tool discovery verification testing` for testing patterns
4. Web-search `site:github.com mcp-b testing` for polyfill-specific testing utilities

## Conceptual Architecture

### Testing Dimensions

WebMCP tools need testing across multiple dimensions:

1. **Unit testing** — Does the tool logic work correctly in isolation?
2. **Schema testing** — Does the JSON Schema validate correctly?
3. **Integration testing** — Does the tool interact correctly with backend APIs?
4. **Agent testing** — Do real AI agents discover and invoke tools correctly?
5. **Permission testing** — Do annotations and user interactions work as expected?
6. **End-to-end testing** — Does the full agent-to-checkout flow succeed?

### Unit Testing Tool Logic

Test the `execute` callback independently:

```js
// Extract execute logic into a testable function
async function searchProductsLogic(input) {
  const res = await fetch(`/api/products?q=${input.query}`);
  return await res.json();
}

// Unit test
describe("searchProducts tool", () => {
  it("returns products matching query", async () => {
    mockFetch("/api/products?q=headphones", { products: [...] });
    const result = await searchProductsLogic({ query: "headphones" });
    expect(result.products).toHaveLength(3);
  });

  it("handles empty results", async () => {
    mockFetch("/api/products?q=nonexistent", { products: [] });
    const result = await searchProductsLogic({ query: "nonexistent" });
    expect(result.products).toHaveLength(0);
  });
});
```

### Schema Validation Testing

Verify that schemas accept valid input and reject invalid input:

```js
import Ajv from "ajv";

const ajv = new Ajv();
const validate = ajv.compile(searchProductsSchema);

test("accepts valid input", () => {
  expect(validate({ query: "headphones", maxPrice: 100 })).toBe(true);
});

test("rejects missing required field", () => {
  expect(validate({ maxPrice: 100 })).toBe(false);
});

test("rejects invalid type", () => {
  expect(validate({ query: 123 })).toBe(false);
});
```

### Agent Testing Workflow

Test with real AI agents (Gemini, Claude, etc.):

1. **Enable WebMCP** — Chrome Canary with flag, or MCP-B polyfill
2. **Load the page** — Navigate to the page with registered tools
3. **Invoke the agent** — Ask the agent to perform a task (e.g., "Search for wireless headphones")
4. **Observe tool discovery** — Verify the agent sees the registered tools
5. **Observe tool invocation** — Verify the agent calls the correct tool with valid parameters
6. **Check results** — Verify the agent receives and correctly interprets the tool's response

### Chrome DevTools Integration

Chrome may provide DevTools panels for WebMCP:
- View registered tools and their schemas
- Monitor tool invocations in real time
- Inspect tool input/output payloads
- Test tools manually (invoke with custom input)

Check Chrome DevTools documentation for the latest WebMCP debugging features.

### Testing User Interactions

Test `requestUserInteraction` flows:

```js
test("checkout requires user confirmation", async () => {
  const mockClient = {
    requestUserInteraction: jest.fn((callback) => {
      // Simulate user approving
      return new Promise((resolve) => callback(resolve));
    })
  };

  const result = await checkoutTool.execute({}, mockClient);
  expect(mockClient.requestUserInteraction).toHaveBeenCalled();
  expect(result.status).toBe("confirmed");
});

test("checkout canceled when user declines", async () => {
  const mockClient = {
    requestUserInteraction: jest.fn(() => Promise.resolve(false))
  };

  const result = await checkoutTool.execute({}, mockClient);
  expect(result.status).toBe("canceled");
});
```

### End-to-End Commerce Flow Test

Test the full shopping journey:

```
1. Navigate to catalog page → verify search tools registered
2. Agent calls searchProducts("headphones") → verify results returned
3. Agent calls addToCart(productId, 1) → verify cart updated
4. Navigate to cart page → verify cart tools registered
5. Agent calls checkout() → verify user interaction prompted
6. Simulate user approval → verify order placed
7. Verify order confirmation returned to agent
```

### Testing Annotation Behavior

Verify that annotations affect browser behavior:
- `readOnlyHint: true` tools → agent can invoke without user prompt
- `destructiveHint: true` tools → browser prompts user before invocation
- Test with different annotation combinations

### Performance Testing

- Measure tool registration time (should be < 100ms)
- Measure tool invocation latency (execute callback + API call)
- Compare WebMCP vs manual UI interaction timing
- Test under concurrent tool invocations

### Best Practices

- Write unit tests for tool logic, separate from WebMCP registration
- Use schema validation libraries (Ajv) to test input schemas
- Test with at least two different AI agents to catch agent-specific issues
- Mock `ModelContextClient` for unit testing user interaction flows
- Document expected agent behavior for each tool
- Keep a test script of agent prompts that exercise all tools

Fetch the latest Chrome DevTools documentation and testing utilities for WebMCP before setting up test infrastructure.

Related Skills

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

webmcp-user-interaction

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement human-in-the-loop flows with requestUserInteraction() — confirmation dialogs, approval workflows, and user prompts during tool execution. Use when building tools that require user consent before performing actions.

webmcp-tool-schemas

17
from OrcaQubits/agentic-commerce-skills-plugins

Design JSON Schemas for WebMCP tool inputs and outputs — proper types, constraints, nested objects, and agent-friendly documentation. Use when defining or refining tool schemas for agent consumption.

webmcp-tool-annotations

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WebMCP tool annotations — readOnlyHint, destructiveHint, idempotentHint safety hints that inform browser permission prompts and agent behavior. Use when marking tools with appropriate safety metadata.

webmcp-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Set up a WebMCP project — enable Chrome flags, install MCP-B polyfill, scaffold tool registration, and configure development environment. Use when starting a new WebMCP-enabled website from scratch.

webmcp-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WebMCP security best practices — permission model, data minimization, honest descriptions, input validation, fingerprinting prevention, and fraud mitigation. Use when auditing or hardening WebMCP tool implementations.

webmcp-register-tool

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement the WebMCP Imperative API — register tools via navigator.modelContext.registerTool() with proper schemas, execute callbacks, and lifecycle management. Use when building dynamic tool registration in JavaScript.

webmcp-polyfill

17
from OrcaQubits/agentic-commerce-skills-plugins

Set up and use the MCP-B polyfill — vanilla JS and React packages that implement navigator.modelContext for browsers without native WebMCP. Use when developing for browsers that don't yet support WebMCP natively.

webmcp-mcp-bridge

17
from OrcaQubits/agentic-commerce-skills-plugins

Integrate WebMCP client-side tools with backend MCP servers and UCP endpoints — bridge browser-based agent interactions with server-to-server protocols. Use when connecting front-end WebMCP to existing backend API infrastructure.

webmcp-context-provider

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement the WebMCP provideContext API — bulk tool registration, contextual metadata, page state sharing, and dynamic context updates. Use when providing rich context and multiple tools to agents simultaneously.

webmcp-commerce-tools

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement commerce-specific WebMCP tools — product search, cart management, checkout, returns, subscriptions, and support. Use when building agentic shopping experiences on e-commerce websites.

webmcp-authentication

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WebMCP authentication patterns — browser session inheritance, cookie-based auth, role-gated tool registration, and conditional tool exposure. Use when managing which tools are available based on user authentication state.