MSW MCP Server logo

MSW MCP Server

Community
JasonBoy

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

PublisherJasonBoy
Repositorymsw-mcp
LanguageTypeScript
Forks
2
Stars
81
Available tools
5
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MSW MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 5 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    81 stars and 2 forks from the linked repository.

MSW AI Agent Bridge Monorepo

npm version npm version CI License: MIT

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

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 setup or MCP's /msw-setup prompt
  • 💻 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 under apps/docs/src/content/docs/.
  • packages/msw-cli: The command-line interface (msw-cli) used by AI agents or developers to send dynamic handler updates. Run msw-cli setup to scaffold a project, then msw-cli open plus 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:

bash
pnpm --filter @msw-mcp/docs dev

Opens 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

  1. Install the CLI globally: npm install -g msw-cli (or use your package manager’s equivalent).

  2. In a new project, run msw-cli setup and follow the printed steps for MSW + @msw-mcp/client.

  3. Start a session, then drive handlers from the shell:

    bash
    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)

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

    json
    {
      "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.

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

  1. Install dependencies:

    bash
    pnpm install
  2. Build the project:

    bash
    pnpm build
  3. Use the CLI:
    You can navigate to the CLI directory or use it directly via node after building:

    bash
    node packages/msw-cli/build/index.js help

License

This project is licensed under the MIT License — see LICENSE.

Installation

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

Available Tools

  • 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.

Use MSW MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MSW MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MSW MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MSW MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "msw-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "msw-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MSW MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MSW MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MSW MCP Server to help me with this task?
MSW MCP Server
Sure. I read it.
Here is what I found using MSW MCP Server.

Frequently asked questions

What is the MSW MCP Server MCP server used for?

MSW MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MSW MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MSW MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MSW MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MSW MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MSW MCP Server MCP to TypingMind?

MSW MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MSW MCP Server MCP provide in TypingMind?

MSW MCP Server exposes 5 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MSW MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MSW MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

msw-setup

Setup MSW (Mock Service Worker) with AI-driven dynamic handler support in your web application

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇