File: README.md
MockServer [](https://buildkite.com/mockserver/mockserver) [](https://github.com/mock-server/mockserver-monorepo/blob/master/LICENSE.md) [](https://github.com/mock-server/mockserver-monorepo/stargazers) [](https://artifacthub.io/packages/search?repo=mockserver) [](https://mcptoplist.com/server/com.mock-server%2Fmockserver)
MockServer is an HTTP(S) mock server and proxy for testing. It does three things:
- Mock the APIs your application depends on, so you can develop and test against systems that are unavailable, incomplete, or hard to reproduce.
- Proxy real traffic to record, inspect, and modify requests and responses in flight β and pause them at interactive proxy breakpoints to step through, edit, or abort each exchange like a debugger for network traffic.
- Chaos engineering β make dependencies misbehave on demand, injecting latency, dropped connections, and errors to test how your application copes when the systems it relies on degrade or fail.
Speaks every protocol your stack uses. HTTP/1.1 & HTTPS, HTTP/2, gRPC & gRPC-Web, WebSockets and raw TCP are auto-detected from the first bytes of each connection, so one MockServer port handles them all with no per-protocol configuration. Beyond that core: HTTP/3 (QUIC β experimental, on its own UDP port), JSON-RPC for MCP/A2A mocking, AsyncAPI-driven message-broker testing against external Kafka and MQTT brokers, and mocked AI/LLM chat-completion APIs (OpenAI, Anthropic, Gemini, Bedrock, Azure OpenAI, Ollama).
Main Features
- Mock any API β HTTP/1.1, HTTPS, HTTP/2, HTTP/3, gRPC, gRPC-Web, JSON-RPC, WebSockets, raw TCP, and message brokers (Kafka, MQTT). Match requests on method, path, query, headers, cookies and body (JSON, XML, JSONPath, XPath, regex, OpenAPI) and return configured responses.
- Proxy & record β port forwarding, web (HTTP) proxy, HTTPS tunneling (CONNECT) and SOCKS, with full visibility of even TLS-encrypted traffic.
- Dynamic responses β response templating (Velocity, Mustache, JavaScript), class/closure callbacks and webhooks.
- OpenAPI β generate expectations directly from an OpenAPI/Swagger specification.
- Verification β assert which requests were received, in what order, and how many times.
- Chaos & resilience testing β inject latency, dropped/slow connections and failures to test how your system copes with a misbehaving dependency.
- LLM / AI mocking β mock chat-completion APIs for OpenAI, Anthropic, Gemini, Bedrock, Azure OpenAI and Ollama (including streaming), plus a built-in MCP server for AI coding assistants.
- Live dashboard β watch requests, expectations and logs in real time at
/mockserver/dashboard. - Clients & integrations β Java, JavaScript/Node, Python and Ruby clients, plus JUnit and Spring support.
- Run anywhere β Docker, Helm/Kubernetes, JAR or WAR, with optional clustered state for multi-instance deployments.
See the changelog for what has shipped in each version.
Getting started in 60 seconds
Run MockServer with Docker, then mock an endpoint and call it:
# 1. Start MockServer
docker run -d --rm -p 1080:1080 mockserver/mockserver
# 2. Mock an endpoint: GET /hello -> 200 "Hello World"
# (MockServer exposes a REST control plane on the same port)
curl -X PUT http://localhost:1080/mockserver/expectation \
-H 'Content-Type: application/json' \
-d '{
"httpRequest": { "method": "GET", "path": "/hello" },
"httpResponse": { "statusCode": 200, "body": "Hello World" }
}'
# 3. Call your mock
curl http://localhost:1080/hello
# -> Hello Worldβ¦or, on macOS / Linux, install it with Homebrew and run the mockserver command directly:
brew install mockserver
mockserver run --port 1080One-command recipes
For common end-to-end setups, the examples/docker-compose recipes are a single docker compose up each β mock from an OpenAPI spec, a record/replay proxy, a contract-validating proxy, or a chaos proxy:
cd examples/docker-compose/mock-from-openapi
docker compose up
curl http://localhost:1080/petsThe same can be done from any client library or the dashboard at http://localhost:1080/mockserver/dashboard. For more configuration options see the Docker documentation.
For every way to run MockServer yourself β Docker, docker-compose recipes, the mockserver CLI, the JVM-less binary bundle, Helm/Kubernetes, the JAR, and Testcontainers β see the Self-Hosting MockServer guide.
Drive it from Postman or Bruno
Explore MockServer's REST control plane from an API client β create expectations, verify requests, and inspect recorded traffic:
- Postman β click the button above, or import
examples/postman(guide). - Bruno (open-source, git-native) β open
examples/brunoin Bruno via Open Collection (guide).
Documentation
For usage guide please see: www.mock-server.com
Developer Documentation
Architecture, code structure, infrastructure, and operations documentation is available in the docs/ directory.
AI Integration
MockServer includes a built-in MCP server for AI coding assistant integration at /mockserver/mcp. See llms.txt and AI Integration docs.
Change Log
Please see: Change Log
Community
| Discussions | |
|---|---|
| Issues, Bugs & Feature Requests | |
| Roadmap | |
| Security |
Requirements
Runtime: MockServer 6.x requires Java 17+. The minimum was raised from Java 11 as part of the Jakarta EE 10 / Spring 7 platform modernisation β see the Java 17 / Jakarta upgrade guide. If you are still on Java 11, pin to the 5.15.x line (no longer receiving security updates). The official Docker image already bundles a Java 17 runtime.
Building from source: requires JDK 17+; the produced bytecode targets Java 17.
Security Note: MockServer is a development and testing tool only. See SECURITY.md for important security considerations.
Versions
Maven Central [](https://central.sonatype.com/search?q=g:org.mock-server)
Maven Central contains the following MockServer artifacts under the org.mock-server groupId. Every artifact ships in two forms β -no-dependencies (shaded, zero transitive deps, recommended) and the plain form (transitive deps declared in the POM, for the rare case where you need to override versions yourself).
Server:
- mockserver-netty-no-dependencies / mockserver-netty β Netty-based HTTP(S) mock + proxy server (embed in tests or run standalone)
- mockserver-war β deployable WAR for hosting MockServer in a servlet container (mock mode)
- mockserver-proxy-war β deployable WAR for hosting MockServer in a servlet container (proxy mode)
Java client:
- mockserver-client-java-no-dependencies / mockserver-client-java β Java client for the MockServer REST API
Test framework integrations:
- mockserver-junit-rule-no-dependencies / mockserver-junit-rule β JUnit 4
@Rule - mockserver-junit-jupiter-no-dependencies / mockserver-junit-jupiter β JUnit 5 extension (
@MockServerSettings,@MockServerTest) - mockserver-spring-test-listener-no-dependencies / mockserver-spring-test-listener β Spring
TestExecutionListener - mockserver-spring-boot-starter β Spring Boot auto-configuration; set
mockserver.enabled=trueto start MockServer and expose aMockServerClientbean (dev/test) - mockserver-integration-testing-no-dependencies / mockserver-integration-testing β shared integration-test helpers
Build-tool plugin:
- mockserver-maven-plugin β Maven plugin to start, stop, and fork MockServer during the build lifecycle
Tip: The
-no-dependenciesartifacts bundle all dependencies into a single JAR with packages relocated undershaded_package.*, so they declare zero transitive dependencies. This avoids classpath conflicts with versions of Netty / Jackson / Guava / Bouncy Castle that your project already uses, and it removes the noise from CVE scanners flagging unused transitive dependencies. See the Maven Central page for full coordinates, snapshot repository setup, and the executablejar-with-dependenciesform for command-line use.
6.0.0 breaking change: the
<classifier>shaded</classifier>form has been removed. Replacemockserver-netty:<version>:shadedwithmockserver-netty-no-dependencies:<version>(and likewise for the other shaded artifacts). The replacement produces the same shaded bytes; only the coordinates change.
SNAPSHOT builds are published to the Sonatype Central Portal snapshot repository at https://central.sonatype.com/repository/maven-snapshots/org/mock-server/.
Node Module & Grunt Plugin
NPM Registry contains the following module:
- mockserver-node - a Node.js module and Grunt plugin to start and stop MockServer
- mockserver-client-node - a Node.js client for both the MockServer and the proxy
Docker Hub
Docker Hub contains the following artifacts:
- MockServer Docker Container - a Docker container containing the Netty MockServer and proxy
Homebrew [](https://formulae.brew.sh/formula/mockserver)
MockServer is available in Homebrew (homebrew-core), the package manager for macOS and Linux:
brew install mockserver # then run: mockserver -serverPort 1080See the Homebrew install page and the command-line usage guide.
Helm Chart
MockServer Helm Chart - installs MockServer into a Kubernetes cluster. The chart is published to the GitHub Container Registry as an OCI artifact (no
helm repo addneeded):bashhelm upgrade --install --create-namespace --namespace mockserver --version 7.6.0 mockserver oci://ghcr.io/mock-server/charts/mockserverSee the Install MockServer Helm Chart guide for all versions and configuration options. A legacy
.tgzis also available from www.mock-server.com.
MockServer Clients
- mockserver-client-java - a Java client for both the MockServer and the proxy (use the
-no-dependenciesartifact to avoid transitive dependencies) - mockserver-client-node - a Node.js and browser client for both the MockServer and the proxy
- mockserver-client-python - a Python client for both the MockServer and the proxy
- mockserver-client-ruby - a Ruby client for both the MockServer and the proxy
- mockserver-client-go - a Go client for both the MockServer and the proxy
- mockserver-client-php - a PHP client for both the MockServer and the proxy
- mockserver-client-dotnet - a .NET client for both the MockServer and the proxy
- mockserver-client-rust - a Rust client for both the MockServer and the proxy
Community Tools
- MockServer Browser Admin - a React + TypeScript SPA for managing MockServer expectations via a web UI
Previous Versions
Issues
If you have any problems, please check the project issues and avoid opening issues that have already been fixed. When you open an issue please provide the following information:
- MockServer version (i.e. 7.6.0)
- How your running the MockServer (i.e maven plugin, docker, etc)
- MockServer log output, at INFO level (or higher)
- What the error is
- What you are trying to do
Contributions
Pull requests are, of course, very welcome! Please read our contributing to the project guide first. Then head over to the open issues to see what we need help with. Make sure you let us know if you intend to work on something. Also check out the project roadmap to see what is already in the backlog.
Feature Requests
Feature requests are submitted to GitHub issues and tracked on the project roadmap.
Maintainers
File: docs/README.md
MockServer Documentation
Comprehensive internal documentation for the MockServer project covering code architecture, infrastructure, build system, CI/CD, and deployment.
Documentation style. These docs follow the Pyramid Principle with
progressive disclosure β lead with the outcome, then layer detail beneath
it. The Level column below (High / Medium / Low) is that principle applied
across the doc set: start High for the big picture, drill into Low for
subsystem detail. See.opencode/rules/documentation-style.md
for the authoring skeleton.
Documentation Index
Code Architecture
Deep-dive documentation of MockServer's codebase, from high-level module structure down to individual subsystems.
| Document | Level | Description |
|---|---|---|
| Code Overview | High | Module hierarchy, dependency graph, package layout |
| Netty Pipeline | Medium | Port unification, protocol detection, channel handlers, MCP handler, relay pattern |
| Request Processing | Medium | Mock matching, proxy forwarding, action dispatch, WAR bridge |
| Event System | Medium | LMAX Disruptor ring buffer, verification, persistence, observers |
| Dashboard UI | Medium | React SPA, Zustand state, twelve top-level views (Dashboard / Traffic / Sessions / Mocks / Library / Chaos / Drift / Verification / AsyncAPI / Metrics / Breakpoints / Get Started), WebSocket communication, data assembly |
| Domain Model | Low | Model hierarchy, matchers, codecs, OpenAPI support, configuration (incl. MCP) |
| TLS & Security | Low | BouncyCastle CA, SNI, mTLS, JWT auth, control plane security |
| Client & Integrations | Low | MockServerClient, JUnit 4/5, Spring, WebSocket callbacks, VS Code extension, JetBrains plugin |
| Editor Extensions | Low | VS Code and JetBrains extensions: shared JSON Schema generation, REST client architecture, feature inventory, build/CI, gotchas |
| Memory Management | Medium | Log entry and expectation memory analysis, default limit calculation, tuning guide |
| Startup Performance | Medium | Startup anatomy, variant matrix and dead ends, startupWarmup, lazy BC/forward-group, AppCDS/AOT, GraalVM NO-GO verdict, re-measurement harness |
| Metrics & Monitoring | Low | Prometheus metrics, memory monitoring, CSV export |
| Telemetry | Low | OpenTelemetry integration: OTLP export, GenAI spans, W3C trace context propagation |
| AI & RPC Protocol Mocking | Medium | SSE streaming, JSON-RPC matching, MCP and A2A mock builders, gRPC mocking |
| LLM Mocking | Medium | LLM response builder, provider codecs, streaming physics, conversation matchers, isolation, MCP tools, dashboard |
| LLM Codec Golden Files | Low | Automated wire-format drift detection for the LLM provider codecs: golden-master fixtures, normalization, refresh process |
| CLI | Low | picocli command tree, subcommands, preprocessArguments heuristic, legacy flag compatibility, how to add a subcommand |
| Configuration Reference | Low | Property mechanism, resolution order, four equivalent forms, how to add a property |
| Chaos Experiments | Low | Scheduled multi-stage chaos experiments: ChaosExperimentOrchestrator, ordered stages, auto-halt integration, PUT/GET/DELETE /chaosExperiment |
| Breakpoints | Low | Request/response/stream breakpoints: BreakpointRegistry, PausedExchange, request and response phases, stream frame interception |
| Drift Detection | Low | Mock drift detection: comparing forwarded responses against stub expectations |
| SLO Verdicts | Low | Synchronous SLO verdicts over forwarded traffic: SloSampleStore, SloEvaluator, PUT /mockserver/verifySLO (200 PASS / 406 FAIL) |
| Load Generation | Low | API-driven load scenarios: LoadScenarioOrchestrator, ramp profiles, per-iteration templating, PUT/GET/DELETE /mockserver/loadScenario, SLI producer for SLO verdicts |
| WASM Rules | Low | WASM custom rule engine: chicory interpreter, module ABI, REST endpoints, configuration |
| Async Messaging | Low | AsyncAPI broker mocking: spec parsing, example generation, Kafka/MQTT publisher adapters, orchestrator |
| HTTP/3 (QUIC) | Low | Experimental HTTP/3 support: Http3Server, QUIC native dependency, MVP boundaries |
| Clustered State | Low | StateBackend SPI, InMemoryStateBackend, InfinispanStateBackend (LOCAL/CLUSTERED), cross-node invalidation, config knobs, limitations |
| LLM Security Audit | Low | M5 security review: known codec limitations, Bedrock SigV4, Ollama NDJSON, adversarial-response safety |
Infrastructure
AWS accounts, CI/CD pipelines, container images, and Kubernetes deployment.
| Document | Description |
|---|---|
| AWS Infrastructure | AWS accounts, Terraform IaC, EC2 agents, S3 hosting, CloudFront CDN |
| CI/CD | Buildkite pipelines and GitHub Actions workflows |
| Docker | Docker images, variants, multi-arch builds, and Compose examples |
| Helm & Kubernetes | Helm charts, deployment templates, and Kind-based testing |
| Service Mesh / Sidecar | Transparent HTTP interception and Kubernetes sidecar deployment |
| AWS SES Email Forwarding | SES catch-all email forwarding for mock-server.com |
Operations
Build process, releases, dependencies, security scanning, and the documentation website.
| Document | Description |
|---|---|
| Build System | Maven configuration, profiles, plugins, and build scripts |
| Release Process | End-to-end release workflow with Mermaid diagrams |
| Security | Consolidated security overview: CodeQL, Dependabot, Snyk, AI security review, SNAPSHOT policy |
| Snyk Security | Vulnerability scanning, CLI usage, javax/jakarta constraints, triage workflow |
| Website | Jekyll documentation site structure and publishing |
| Testing | Test frameworks, module inventory, architecture, configuration, coverage gaps, CI execution |
| False-Green Guards | The standing CI gate that fails closed on new false-green test shapes (Docker-gated suites, socket-mount-then-deselect, deferred-work skips) |
| Performance Tuning | Internal companion to the website performance page: where the budget goes, rules of thumb, JVM flags, measuring, regression triage |
| AI-Native SDLC Principles | Principles for working with AI across the SDLC: spec-first, verification, context, guardrails, the lethal trifecta |
| AI-Assisted Development | AI development approach, adversarial review, testing backstop, structural safety |
| OpenCode Configuration | AI harness: config, agents, rules, skills, commands, plugins |
| OpenCode Building Blocks | Generic guide to the 9 building blocks: what each controls, when to use which, and how they fit together |
| MCP Registry Publishing | Publishing MockServer's MCP server to public MCP registries |
| Migration: Java 17 + Jakarta | Completed javaxβjakarta namespace migration: scope, approach, and verification |
| Release Principles | Principles and rules governing the release scripts and Buildkite release pipeline |
Plans
| Document | Description |
|---|---|
| Security Defaults | Insecure default flips planned for the next major release |
Other
| Document | Description |
|---|---|
| Architecture | Original high-level architecture overview (see also Code Overview) |
Quick Reference
/* Detailed source-code truncated for AI context efficiency. */Key Links
- Website: https://www.mock-server.com
- GitHub: https://github.com/mock-server/mockserver-monorepo
- Docker Hub: https://hub.docker.com/r/mockserver/mockserver
- Maven Central:
org.mock-server:mockserver-netty - Helm Chart Repo: https://www.mock-server.com/mockserver-7.6.0.tgz
- SwaggerHub API: https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi
- Buildkite: https://buildkite.com/mockserver/mockserver
- Snyk: https://app.snyk.io/org/mockserver/projects