Skip to content

MSW Agent Tools — Live API mocking for AI agents and developers

Agent-Native API Mocking

Control your mocks,
live.

msw-cli and msw-mcp let AI agents and developer tools update Mock Service Worker handlers in the browser in real time — no page reload, no server restart.

$ npm install -g msw-cli

Everything you need for dynamic mocking

Purpose-built for AI-assisted development workflows and agent-driven testing scenarios.

Agent-Friendly CLI

Open a session, add handlers — just like Playwright. Any AI agent or script can drive mocks with simple shell commands, no MCP required.

🔄

Zero-Reload Updates

Handlers update live in the browser via WebSocket. Never restart your dev server just to change a mock response.

📋

Session Management

Isolated named sessions per project directory. List, close, and manage concurrent environments without conflicts.

🤖

MCP Integration

AI assistants in Cursor, Claude Code, and VS Code can call msw_add_handlers directly via the Model Context Protocol.

🌐

Framework Agnostic

Works with React, Vue, Svelte, vanilla JS — any framework that supports MSW 2.x service workers.

💾

Handler Persistence

Optionally persist dynamic handlers across page refreshes via localStorage. FIFO limit keeps storage clean.


CLI or MCP — your choice

Both share the same WebSocket core. Pick the integration that fits your workflow.

MCP Server

msw-mcp

A Model Context Protocol server. Register it once in your MCP client and let your AI assistant manage mocks directly.

// .cursor/mcp.json
{
  "mcpServers": {
    "msw-mcp": {
      "command": "npx",
      "args": ["msw-mcp@latest"]
    }
  }
}

// Then ask your AI assistant:
"Mock GET /api/users to return 500"
msw-mcp docs →

Ready to mock faster?

Set up msw-cli in under five minutes and start controlling your mocks from any agent or terminal.