jasonboy/msw-mcp 是从 https://github.com/jasonboy/msw-mcp. 导入的 MCP 服务器候选人。
概览
jasonboy/msw-mcp 是从 https://github.com/jasonboy/msw-mcp. 导入的 MCP 服务器候选人。
概述(AI 翻译)
该单仓库提供了一套工具,连接 AI 代理与 Mock Service Worker(MSW)。它支持直接从命令行界面或 AI 工具执行中动态添加、更新和移除 MSW 网络模拟文件,完全独立于应用源代码重启。
演示
MCP驱动的MSW工作流程(浏览器桥接,实时处理程序更新)的演示:
https://github.com/user-attachments/assets/06959759-b198-4cd1-ae2b-11ede32acd8e
主要特征
- 🤖 用AI生成MSW处理器
- ⚡ 无需重新加载页面即可更新模拟功能
- 🌉 Cli/MCP 与浏览器之间的 WebSocket 桥接
- 🛠️ 脚手架MSW设置,使用
msw-cli setup或MCP的/msw-setup提示 - 💻 **通过
msw-cli进行终端和脚本控制 - ⚙️ 可配置端口、持久化和客户端定位
- ✨ 人工智能代理可用的智能代理技能
结构
该项目以单存储库形式搭建,使用 pnpm 和 turbo。
apps/docs(@msw-mcp/docs):MSW 代理工具(CLI、MCP、指南)的Starlight文档网站。源代码位于apps/docs/src/content/docs/下。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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
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 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
-
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
安装
npx msw-mcp@latest配置
{
"mcpServers": {
"msw-mcp": {
"command": "npx",
"args": ["msw-mcp@latest"]
}
}
}