aicoolies logo
MSW logo

MSW

API mocking for browser and Node.js

Share
open-sourceOpen Source
Visit Website →

Mock Service Worker intercepts network requests at the service worker level, enabling seamless API mocking for tests and development without changing application code. With 16k+ GitHub stars, MSW is the go-to solution for frontend developers who need realistic API simulation during development and testing without spinning up backend servers.

Mock Service Worker (MSW) is an API mocking library for JavaScript that intercepts network requests at the service worker level in the browser and at the request handler level in Node.js. It solves the problem of testing and developing frontend applications that depend on backend APIs by providing a seamless way to mock API responses without modifying application code or setting up proxy servers. MSW operates by intercepting actual network requests rather than stubbing the fetch or XMLHttpRequest implementations, which means your application code behaves identically whether it talks to a real or mocked API.

MSW provides a request handler API for defining mock responses using a familiar Express-like syntax, support for REST and GraphQL APIs, network-level interception that preserves the application's actual networking behavior, and the ability to share the same mock definitions between browser tests, Node.js integration tests, and development environments. It supports response delays, error simulation, and conditional responses for testing edge cases. MSW also offers lifecycle events for observing and modifying requests and responses, and type-safe request handlers when used with TypeScript.

MSW is essential for frontend developers who need reliable API mocking during development and testing without coupling their mocks to specific testing frameworks. It integrates with Jest, Vitest, Cypress, Playwright, Storybook, and React Testing Library, providing a consistent mocking layer across all testing and development contexts. MSW is particularly valuable for teams building applications against APIs that are still in development, frequently changing, or expensive to call, enabling parallel frontend and backend development without blocking dependencies.

Pricing

Free

Platforms

Node.js, Browser

Categories

Tags

Use Cases

Alternatives

Related Tools

Safari MCP Server

Apple's Safari-native MCP server for web debugging agents

Safari MCP Server is Apple's safaridriver-based MCP server in Safari Technology Preview, giving compatible coding agents local access to Safari page content, console logs, network requests, screenshots, JavaScript evaluation, interactions, viewport controls, and accessibility/performance checks.

freeTelemetry
rampart

Rampart

Microsoft’s pytest-native red teaming framework for turning AI agent safety findings into CI tests.

RAMPART is an open-source Microsoft framework for safety and security testing of agentic AI applications. It brings red-team findings into a pytest-native workflow so teams can turn prompt injection, unsafe tool use, and behavioral boundary failures into repeatable regression tests. The strongest aicoolies angle is developer workflow: RAMPART makes agent safety part of CI/CD instead of a one-off security review.

open-sourceOpen Source
Requestly logo

Requestly

One tool for intercepting, mocking, and replaying HTTP — acquired by BrowserStack

Requestly is a BrowserStack-backed API client, HTTP interceptor, mock server, and session replay tool for frontend and QA teams. Its current product is commercial/API-client led, while the legacy interceptor/open-source code is AGPLv3. The free plan covers individual workflows, and Pro lists at $12/user/month monthly or $9/user/month annually for collaborative QA and frontend debugging teams.

freemium
Browserbase logo

Browserbase

Headless browser cloud built for AI agents

Browserbase is cloud infrastructure that runs headless Chromium browsers on demand for AI agents and automation workflows, exposing Playwright, Puppeteer, and Selenium endpoints with built-in session replay, residential proxies, CAPTCHA solving, and stealth fingerprints. It also hosts Stagehand and a Model Gateway, letting teams build browser-using agents without maintaining their own fleet of Kubernetes-managed Chromium instances.

freemium
Anchor Browser logo

Anchor Browser

Cloud browser infrastructure for AI agents

Anchor Browser provides secure cloud-managed browser infrastructure for computer-use agents. Deploy humanized Chromium instances that access any website while maintaining bot-detection evasion and authentication support. Features OmniConnect for authentication lifecycle management, Web Action Cache for deterministic workflows, and built-in VPN infrastructure. Includes free tier and paid plans supporting millions of concurrent browser sessions for scalable agent automation.

freemium
RagaAI Catalyst logo

RagaAI Catalyst

AI testing and evaluation for agents and LLM apps

RagaAI Catalyst is a comprehensive Python SDK for observability, monitoring, and evaluation of LLM and agentic applications. Provides agent tracing with execution graph visualization, self-hosted dashboard with analytics, synthetic data generation, multi-metric evaluation framework, and guardrail management. Built for teams running production RAG systems and AI agents who need systematic testing, debugging, and performance optimization workflows.

open-sourceOpen Source