Overview
MockServer is an open-source, self-hosted mock server and recording proxy for replacing external dependencies with controllable behavior. It helps development and test environments remain isolated and deterministic while supporting HTTP/1.1, HTTP/2, experimental HTTP/3, HTTPS, and gRPC.
A single instance can mock selected requests, proxy others to a real backend, record traffic, replay interactions, and verify what a system sent. It runs without a SaaS account.
Key Features
- Define request expectations and return fixed or dynamically templated responses.
- Record and replay real traffic to reproduce service behavior.
- Pause requests or responses at interactive breakpoints for inspection and modification.
- Inject latency, errors, dropped connections, malformed responses, and other faults.
- Generate mocks and validate traffic from OpenAPI specifications.
- Monitor logs, active expectations, recordings, breakpoints, and chaos behavior in a web dashboard.
MockServer can also import browser HAR data or Postman collections, model stateful API flows, expose Prometheus metrics, and emit OpenTelemetry traces. Deployment options include Docker, an executable JAR, Helm and Kubernetes, Testcontainers, a JVM-less binary, and clustered shared environments.
AI and Protocol Support
The built-in MCP server allows compatible AI coding assistants to create expectations, inspect captured traffic, verify requests, and support contract or resilience testing. For tools without MCP support, an OpenAPI interface provides a REST-based alternative.
MockServer can emulate LLM providers with streaming and conversation behavior, as well as mock MCP and A2A services. It can also proxy real AI traffic for inspection and deterministic replay, covering prompts, token activity, tool calls, and streamed responses. Additional protocol coverage includes GraphQL, AsyncAPI brokers, OAuth2 and OIDC providers, SSE, WebSocket, and SOCKS.
Testing Use Cases
Teams can use MockServer to develop against APIs that do not yet exist, test application resilience under controlled failures, and assert whether expected requests were made. It also supports declarative load scenarios that vary data, ramp virtual users or arrival rates, and assess service-level objectives without a separate load-testing tool.
For CI, recorded AI or API traffic can be replayed instead of repeatedly calling live dependencies. Contract-based mocks and drift detection help identify when local expectations no longer match the real API.
