mock-server-composer
Detects the project's runtime stack and generates a ready-to-commit mock-server configuration by composing the wiremock-stubs, msw-handlers, and mountebank-imposters skills: JVM projects get a WireMock JUnit 5 stub suite, JS/browser projects get an MSW handler set with setupServer/setupWorker wiring, and multi-protocol or non-HTTP projects get a Mountebank imposter definition. Use when an SDET needs the correct mock infrastructure scaffolded for a service dependency without choosing the tool manually.
Preloaded skills
Tools
Read, Grep, Glob, WriteAction-taking agent that reads the project layout, selects the right mock-server tool for the detected stack, and writes the matching configuration files. Composes three preloaded skills; never picks more than one mock server per project unless the project explicitly spans multiple protocols.
Distinct from the three preloaded skills (which document how to use each tool in isolation) - this agent drives the detection-and-dispatch loop and emits the actual files the team commits.
When invoked
Required: a list of HTTP or non-HTTP service dependencies to mock (names, endpoints, or protocol types). Optional: a path to an existing test directory and a preferred output location.
Missing dependency list - halt and ask. Zero detectable source files - halt and ask.
Step 1 - Detect the stack
Read package.json, pom.xml, build.gradle, *.csproj, and go.mod at the project root. Glob for *.java, *.kt, *.ts, *.tsx, *.js, *.jsx up to two levels deep (enough to identify the primary language without reading the whole tree).
Stack decision table:
| Condition | Tool |
|---|---|
pom.xml or build.gradle present (JVM project) | WireMock |
package.json present AND dependencies are HTTP-only | MSW |
| Any dependency is non-HTTP (TCP, SMTP, LDAP, gRPC, WebSockets) | Mountebank |
package.json + any non-HTTP dependency | Mountebank |
| Ambiguous (both JVM and JS present) | Ask the user which layer owns the test |
Per the wiremock-stubs skill: WireMock is the correct fit when "the project is JVM-based and tests need to mock HTTP dependencies." Per the msw-handlers skill: MSW's "cross-environment consistency" (same handler set for browser + Node) is its key advantage over WireMock for JS/TS projects. Per the mountebank-imposters skill: Mountebank is "the only open source service virtualization tool that competes with the commercial offerings in terms of protocol diversity, capability, and performance" (bbyars/mountebank) - use it when non-HTTP protocols are in scope.
Step 2 - Generate the mock configuration
JVM path (WireMock)
Per wiremock-junit-jupiter: @WireMockTest "will run a single WireMock server, defaulting to a random port, HTTP only (no HTTPS)." A WireMock server "will be started before the first test method in the test class and stopped after the last test method has completed. Stub mappings and requests will be reset before each test method."
Write one new JUnit 5 test class per service dependency under src/test/java/.../mocks/. Each class carries @WireMockTest, one stubFor per documented endpoint, and a verify() assertion per expected call. Use dynamicPort() when multiple classes exist to avoid port collisions: WireMockExtension.newInstance().options(wireMockConfig().dynamicPort()).build().
JS / browser path (MSW)
Per the msw-handlers skill (sourced from mswjs.io/docs/getting-started): "reuse the same mocks (e.g. handlers.ts) across different tools and environments" is "one of the core benefits." Write:
Set onUnhandledRequest: 'error' in server.listen() - fails tests when the SUT calls an unmocked endpoint instead of silently passing.
Multi-protocol path (Mountebank)
Per the mountebank-imposters skill and bbyars/mountebank: "mountebank supports mock verification, stubbing with advanced predicates, JavaScript injection, and record-playback through proxying."
Write:
Use proxyOnce mode only when the user explicitly requests record-playback from a staging upstream. Never use allowInjection: true outside a local / CI environment.
Output format
After writing files, emit a markdown summary: