msw-mcp
Provides tools for dynamically adding, updating, and removing Mock Service Worker (MSW) network mocks via MCP, enabling AI agents to manage request handlers without restarting the application.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@msw-mcpadd a mock for GET /api/user that returns { id: 1 }"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MSW AI Agent Bridge Monorepo
This monorepo provides a suite of tools that bridge AI agents with Mock Service Worker (MSW). It enables dynamic addition, updating, and removal of MSW network mocks directly from a command-line interface or AI tool execution, completely independently of the application source code restarts.
Demo
Walkthrough of the MCP-driven MSW workflow (browser bridge, live handler updates):
https://github.com/user-attachments/assets/06959759-b198-4cd1-ae2b-11ede32acd8e
Related MCP server: msw-mcp
Key features
🤖 Generate MSW handlers with AI
⚡ Update mocks without reloading the page
🌉 WebSocket bridge between Cli/MCP and the browser
🛠️ Scaffold MSW setup with
msw-cli setupor MCP's/msw-setupprompt💻 Terminal and script control via
msw-cli⚙️ Configurable port, persistence, and client targeting
✨ Agent skills for AI agents to use
Structure
This project is set up as a monorepo using pnpm and turbo.
apps/docs(@msw-mcp/docs): Starlight documentation site for MSW Agent Tools (CLI, MCP, guides). Source lives underapps/docs/src/content/docs/.packages/msw-cli: The command-line interface (msw-cli) used by AI agents or developers to send dynamic handler updates. Runmsw-cli setupto scaffold a project, thenmsw-cli openplus handler commands.packages/msw-mcp: The published Model Context Protocol server (msw-mcp) so assistants can manage mocks via MCP tools.packages/client(@msw-mcp/client): The browser/environment client that listens for updates and registers them with the local MSW setup.packages/core(@msw-mcp/core): The core daemon process and session management logic that brokers communication between the CLI or MCP server and the client.
Documentation site
From the repo root:
pnpm --filter @msw-mcp/docs devOpens the local docs dev server (default Astro port, often http://localhost:4321). Production search (Pagefind) is easiest to verify after pnpm --filter @msw-mcp/docs build and pnpm --filter @msw-mcp/docs preview.
More detail: apps/docs/README.md.
Quick setup: msw-cli
Install the CLI globally:
npm install -g msw-cli(or use your package manager’s equivalent).In a new project, run
msw-cli setupand follow the printed steps for MSW +@msw-mcp/client.Start a session, then drive handlers from the shell:
msw-cli open msw-cli add "http.get('/api/user', () => HttpResponse.json({ id: 1 }))" msw-cli status msw-cli close
Full command reference, flags, and workflows: packages/msw-cli/README.md.
Quick setup: msw-mcp (MCP)
Register the server in your MCP client (example for JSON config):
{ "mcpServers": { "msw-mcp": { "command": "npx", "args": ["msw-mcp@latest"] } } }In the client, use the
/msw-setupprompt (or follow manual steps) so the browser app loadsmsw,@msw-mcp/client, and the worker bridge.
Installation options (VS Code, Claude Code, Cursor, etc.), architecture, MCP tools, and manual setup: packages/msw-mcp/README.md.
Development Scripts
Run these scripts from the root directory using pnpm:
pnpm build: Compiles all packages using Turborepo.pnpm dev: Starts the development pipelines for all packages.pnpm format: Formats the code using Prettier.pnpm lint: Runs linting checks across the repository.
Getting Started
Install dependencies:
pnpm installBuild the project:
pnpm buildUse the CLI:
You can navigate to the CLI directory or use it directly via node after building:node packages/msw-cli/build/index.js help
License
This project is licensed under the MIT License — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Build, validate, and manage API simulations in WireMock Cloud from MCP-compatible AI agents.
AI-native mock API server with MCP. Create REST/SOAP mocks from Claude, Cursor, or Windsurf.
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to read and modify Mendix application models through MCP tools for creating modules, entities, pages, microflows, deploying, and querying runtime data.1ISC
- AlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP clients to dynamically add, update, and remove Mock Service Worker network mocks via MCP tools, including live handler updates without restarting the application source code.12 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to dynamically add, update, and remove Mock Service Worker network mocks through MCP tools, without restarting or reloading the application.12 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to dynamically add, update, and remove Mock Service Worker network handlers in a running browser app through a WebSocket bridge, without touching application source code or reloading the page. It also provides a setup prompt to scaffold the MSW and client integration in a project.12 npmMIT