MCP server for msw

by JasonBoy

85 stars
359 downloads
Not rated
GitHub Website

About

Cli & MCP server for msw (Mock Service Worker) for AI Agents with dynamic mocking

Details

Author
JasonBoy
GitHub stars
85
Downloads
359
Categories
Other

- Generate MSW handlers with AI assistance
- Update mocks without reloading the page
- WebSocket bridge between CLI/MCP and the browser
- Scaffold MSW setup with /msw-setup prompt
- Terminal and script control via msw-cli
- Configurable port, persistence, and client targeting

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP server for msw
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Register the server in your MCP client using the command npx msw-mcp@latest. Then use the /msw-setup prompt to scaffold the browser‑side integration (requires msw, @msw-mcp/client, and the worker bridge). Alternatively, use the msw-cli for terminal control.

msw_add_handlers

Add MSW request handlers to the browser service worker at runtime. Accepts JavaScript handler code strings that will be executed in the browser.

msw_reset_handlers

Reset MSW request handlers in the browser service worker. If no handlers provided, removes all runtime handlers and keeps only initial ones. If handlers provided, replaces all handlers with the new ones.

msw_remove_handlers

Remove specific MSW request handlers from the browser service worker by URL patterns and optional HTTP methods.

msw_update_handlers

Update existing MSW request handlers by replacing handlers that match specified URL patterns with new handler code. This is an atomic operation that removes old handlers and adds new ones in a single transaction.

msw_get_status

Get the current status of the MSW service worker, including connection state, worker status, and active handlers.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server for msw": {
            "msw-mcp": {
                "command": "npx",
                "args": [
                    "msw-mcp@latest"
                ]
            }
        }
    }
}

McpServers

{
    "msw-mcp": {
        "command": "npx",
        "args": [
            "msw-mcp@latest"
        ]
    }
}

Quick setup: msw-mcp (MCP)

1. Register the server in your MCP client (example for JSON config):

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

2. In the client, use the /msw-setup prompt (or follow manual steps) so the browser app loads msw, @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.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.