Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mockserver-monorepo

> AI 编程
Open source

MockServer is an HTTP(S) mock server and proxy for testing that lets you mock APIs, inspect and modify live traffic, and inject failures. It supports HTTP/1.1,

4.9K stars0 likes2 views
WebsiteGitHub

About

MockServer is an HTTP(S) mock server and proxy for testing that lets you mock APIs, inspect and modify live traffic, and inject failures. It supports HTTP/1.1,

MockServer           

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:

bash
# 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:

bash
brew install mockserver
mockserver run --port 1080

One-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:

bash
cd examples/docker-compose/mock-from-openapi
docker compose up
curl http://localhost:1080/pets

The 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/bruno in 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

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=true to start MockServer and expose a MockServerClient bean (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-dependencies artifacts bundle all dependencies into a single JAR with packages relocated under shaded_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 executable jar-with-dependencies form for command-line use.

6.0.0 breaking change: the <classifier>shaded</classifier> form has been removed. Replace mockserver-netty:<version>:shaded with mockserver-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

MockServer is available in Homebrew (homebrew-core), the package manager for macOS and Linux:

bash
brew install mockserver   # then run: mockserver -serverPort 1080

See the Homebrew install page and the [command-line usage guide](https://www.mock-server.com/mock

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaaichaos-engineeringgrunt-pluginhomebrew

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.