agentleFS
JasonBoyJasonBoy/msw-mcp/AGENTS.md

msw-mcp

AGENTS.md81 starsChanged 5 months agoMITView on GitHub

This project is a monorepo managed by pnpm and Turborepo. It is designed to house multiple packages related to MSW (Mock Service Worker) and MCP (Model Context Protocol). The repo uses Vitest (v4.x). Test dependencies live in the root package.json; each package has its own vitest.config.ts and "test" script. Add or update tests whenever you change behavior — new features, bug fixes, refactors, or CLI/MCP tool output. Skip tests only for docs-only or purely cosmetic changes. CI runs pnpm run…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Add or update tests whenever you change behavior — new features, bug fixes, refactors, or CLI/MCP tool output.

    line 34
  2. Very specific:

    Build: Test files are excluded from tsc output via each package's tsconfig.json exclude.

    line 39
  3. Very specific:

    Style: Prefer unit tests with injected/mocked dependencies.

    line 41
  4. Very specific:

    Scope: Test real behavior and edge cases — not trivial getters or framework wiring.

    line 42
  5. Very specific:

    Workspaces: Always perform actions from the root using pnpm and turbo.

    line 65
  6. Very specific:

    Dependencies: Add shared devDependencies to the root package.json.

    line 66
  7. Very specific:

    Code Style: Follow the Prettier configuration.

    line 67
  8. Very specific:

    Builds: Use pnpm run build to ensure all packages compile correctly.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Monorepo Overview

This project is a monorepo managed by pnpm and Turborepo. It is designed to house multiple packages related to MSW (Mock Service Worker) and MCP (Model Context Protocol).

Tooling

  • Package Manager: pnpm (Workspaces)
  • Build System: Turborepo
  • Linting & Formatting: Prettier, lint-staged, Husky
  • Language: TypeScript

Structure

  • packages/: Contains the individual workspace packages.
    • msw-mcp: The core MCP server for MSW AI interaction.
  • package.json (root): Orchestrates the workspace, shared dependencies, and scripts.
  • turbo.json: Defines the task pipeline and caching strategy.

Common Commands

  • pnpm install: Install all dependencies across the workspace.
  • pnpm run build: Build all packages using Turbo.
  • pnpm run test: Run all package tests via Turbo.
  • pnpm run test:coverage: Run tests with v8 coverage reporting.
  • pnpm run format: Format the entire codebase.
  • pnpm turbo run <task>: Run specific Turbo tasks.

Testing

The repo uses Vitest (v4.x). Test dependencies live in the root package.json; each package has its own vitest.config.ts and "test" script.

When to add tests

Add or update tests whenever you change behavior — new features, bug fixes, refactors, or CLI/MCP tool output. Skip tests only for docs-only or purely cosmetic changes.

Conventions

  • Location: Co-locate tests as src/**/*.test.ts next to the code they cover.
  • Build: Test files are excluded from tsc output via each package's tsconfig.json exclude.
  • Environment: Node for core, msw-cli, and msw-mcp; jsdom for @msw-mcp/client (browser APIs).
  • Style: Prefer unit tests with injected/mocked dependencies. Use integration tests sparingly for real WebSocket/HTTP round-trips (see packages/core/src/server.integration.test.ts).
  • Scope: Test real behavior and edge cases — not trivial getters or framework wiring. Mock console.error when exercising expected error paths to keep output clean.

Package-specific notes

PackageWhat to testMocking tips
@msw-mcp/coreSessionManager, ConnectionManager, loadMswSetupPrompt, WSServer integrationFake WebSocket clients, vi.spyOn(os, 'homedir'), fake timers for timeouts
@msw-mcp/clientMSWWebSocketBridge message routing, pattern matching, persistenceMock window.msw, fake MSW worker (use/resetHandlers)
msw-cliPure helpers in src/helpers.tsImport helpers directly — do not import index.ts (triggers CLI parse)
msw-mcpTool factories in src/tools/Inject a fake wsServer with stubbed sendMessage

Running tests

pnpm run test                              # all packages
pnpm --filter @msw-mcp/core exec vitest run  # single package
pnpm --filter @msw-mcp/core exec vitest run --coverage

CI runs pnpm run build then pnpm run test (see .github/workflows/ci.yml).

Development Guidelines

  • Workspaces: Always perform actions from the root using pnpm and turbo.
  • Dependencies: Add shared devDependencies to the root package.json. Package-specific dependencies go into the package's package.json.
  • Code Style: Follow the Prettier configuration. Use pnpm run format before committing.
  • Builds: Use pnpm run build to ensure all packages compile correctly.
  • TypeScript: The project uses TypeScript. Ensure types are correct and avoid any or @ts-ignore unless absolutely necessary.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.