msw-cli

msw-cli is a skill for Claude Code, Codex from JasonBoy/msw-mcp. It costs 41 tokens per session (1,521 once invoked), scanned A, original, MIT.

A command-line tool for changing Mock Service Worker (MSW) API responses while an application is running. MSW is a testing tool that intercepts network requests and returns simulated responses.

In plain words
What is it for?
Use it to open a mock session, add, update, remove, or reset request handlers, and debug how the application responds to mocked APIs.
Why use it?
It lets you change test data and API behavior without editing handler files or restarting the application.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jasonboy/msw-mcp/msw-cli
Any agent
npx skills add JasonBoy/msw-mcp --skill msw-cli
Clone the repo
git clone --depth 1 https://github.com/JasonBoy/msw-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for msw-cli

README.md
[![agentmods](https://agentmods.dev/badge/skills/jasonboy/msw-mcp/msw-cli.svg)](https://agentmods.dev/skills/jasonboy/msw-mcp/msw-cli)
Your own site
<a href="https://agentmods.dev/skills/jasonboy/msw-mcp/msw-cli"><img src="https://agentmods.dev/badge/skills/jasonboy/msw-mcp/msw-cli.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,521 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.01521
Opus 5 $0.00020 $0.00760
Sonnet 5 $0.00008 $0.00304
Haiku 4.5 $0.00004 $0.00152

Measured 4d ago against content hash 591308923094, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

msw-cli scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

msw-cli add "http.get('*/api/user', async ({ request }) => { const res = await fetch(bypass(request)); const data = await res.json(); return HttpResponse.json({ ...data, role: 'admin' }) })"
skills/msw-cli/SKILL.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

msw-cli

Dynamically add, update, and remove MSW handlers while the app keeps running. Run commands from the project directory (or pass -s <name> for a named session).

Project not set up yet? Use the msw-setup skill or run msw-cli setup first.

Agent guidelines

When using this skill to change mocks:

  1. Do not edit local handler files (e.g. handlers.ts, mocks/handlers). msw-cli applies add / update / remove / reset to the browser runtime over the WebSocket session. Changing on-disk handler modules is the wrong tool and can confuse the next dev reload.

  2. Before open, check whether a session is already running: run msw-cli list (all open sessions) and, if a session for this project already exists, msw-cli status (or status -s <name>) to see connection and handlers. Only run open when no suitable session is active—avoid duplicate daemons for the same work.

Quick start

msw-cli open                    # prints WebSocket URL + port
# If port ≠ app config, update MSW_WS_URL (or VITE_MSW_WS_URL / NEXT_PUBLIC_MSW_WS_URL) to match output
msw-cli add "http.get('/api/users', () => HttpResponse.json([{ id: 1 }]))"
msw-cli status                  # connected must be true for mocks to apply
msw-cli close

Use msw-cli open --port 6789 when the app already hard-codes that port. list works without a session. Handler commands (add, update, remove, reset, status) require an open session for that cwd (or -s) — otherwise you get "Session not open".

Workflow

  1. list / status — confirm no session is already open (or reuse it). Then open only if needed — start daemon; read Port and WebSocket from markdown output.
  2. Sync app — if port auto-changed (6789 busy), set ws://127.0.0.1:<port> in MSW_WS_URL / VITE_MSW_WS_URL / NEXT_PUBLIC_MSW_WS_URL env.
  3. add / update / remove / reset — handler changes.
  4. status — confirm browser connected.
  5. close when finished.

Read the full file on GitHub · 90 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 90 lines · 41 tokens per session scan A 591308923094

Subscribe to this mod's changes

msw-cli is a skill published in the GitHub repository JasonBoy/msw-mcp (81 stars, last pushed 2mo ago), licensed MIT. It adds 41 tokens to every session and 1,521 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.