mockserver-monorepo: a multi-protocol mock server and proxy for simulating API dependencies and performing chaos engineering

mockserver-monorepo: a multi-protocol mock server and proxy for simulating API dependencies and performing chaos engineering

What it solves

MockServer provides a way to test applications that depend on external APIs without needing those actual systems to be available, complete, or stable. It prevents development bottlenecks caused by unavailable dependencies and allows developers to simulate edge cases, such as network failures or slow responses, that are difficult to reproduce in real environments.

How it works

MockServer acts as an HTTP(S) server and proxy that can be configured via a REST control plane. It intercepts network traffic and performs three primary functions:

  1. Mocking: It matches incoming requests (based on method, path, headers, body, etc.) and returns pre-configured responses.
  2. Proxying: It forwards real traffic to a destination, allowing users to record, inspect, and modify requests and responses in flight using "proxy breakpoints" similar to a debugger.
  3. Chaos Engineering: It intentionally injects latency, dropped connections, or errors to test how an application handles system degradation.

It supports a wide array of protocols including HTTP/1.1, HTTP/2, gRPC, WebSockets, and raw TCP, and includes specialized mocking for AI/LLM chat-completion APIs (such as OpenAI, Anthropic, and Gemini).

Who it’s for

It is designed for software developers and QA engineers who need to isolate their application from external dependencies during integration and end-to-end testing.

Highlights

  • Broad Protocol Support: Handles HTTP, gRPC, WebSockets, and message brokers like Kafka and MQTT.
  • AI/LLM Mocking: Built-in support for mocking streaming chat-completion APIs from major providers and an MCP server for AI coding assistants.
  • Dynamic Responses: Supports response templating using Velocity, Mustache, and JavaScript.
  • OpenAPI Integration: Can generate expectations directly from OpenAPI/Swagger specifications.
  • Chaos Testing: Tools to inject failures and latency for resilience testing.
  • Multi-platform Deployment: Available via Docker, Kubernetes (Helm), JAR, and various language clients (Java, Python, Node, Go, etc.).

Sources