Mockserver

com.mock-server由 mock-server.com 發布v9.4.0更新於 Nov 20, 2026

Mock, record/replay, verify and chaos-test any HTTP, REST, gRPC or LLM dependency over MCP.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

MockServer 內建的 MCP 伺服器讓助理為 HTTP、gRPC 與 LLM 相依服務建立模擬、錄製回放流量、驗證請求並注入故障。

可以做什麼
  • 建立與管理期望,回傳固定、範本化或回呼回應,涵蓋 HTTP、gRPC 等協定
  • 以代理方式執行,錄製、檢視並修改真實流量,包含 TLS 加密的往來內容
  • 驗證預期請求是否送達,並檢視已記錄的請求歷程
  • 注入延遲、連線中斷與錯誤,對應用程式進行混沌測試
  • 模擬 OpenAI、Anthropic、Gemini、Bedrock、Azure OpenAI 與 Ollama 的對話補全 API,含串流回應
  • 從 OpenAPI/Swagger 規格產生期望,並透過 REST 控制面統一操作
適用情境
適合在開發或測試會呼叫外部 HTTP、gRPC 或 LLM 服務的程式時使用,以可控且可重現的回應取代真實相依服務,或先錄製真實流量再回放。
執行需求
需要一個可透過 streamable HTTP 存取的執行中 MockServer 實例,通常是監聽 1080 埠的 Docker 映像;MCP 端點位於 /mockserver/mcp。非容器自架安裝需要 Java 17+(Docker 映像自帶 JVM)。未宣告驗證方式或環境變數。
安裝前請注意
文件明確指出 MockServer 僅供開發與測試使用,不適用於正式環境。它能代理並檢視流量(包含 TLS 加密內容)並即時修改請求,因此只應指向測試系統與測試資料。建立期望與代理設定會改變伺服器狀態,且宣告的設定沒有驗證機制,請勿將埠公開到網際網路。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mockserver,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MockServer            [Build status] [OpenSSF Best Practices] [GitHub license] [GitHub stars] [Artifact Hub] [MCP Toplist]

MockServer mocks, records, and chaos-tests any HTTP(S) dependency your application talks to — one binary, no per-protocol setup.

Why MockServer

  • One port, every protocol — HTTP/1.1, HTTPS, HTTP/2, gRPC & gRPC-Web, WebSockets and raw TCP are auto-detected from the first bytes of each connection. Beyond that: HTTP/3 (QUIC, experimental), JSON-RPC for MCP/A2A mocking, and AsyncAPI-driven testing against Kafka/MQTT brokers.
  • Mock, proxy, or both — return canned/templated/callback responses, or sit as a proxy (port forwarding, HTTP proxy, HTTPS tunneling, SOCKS) and record, inspect, and modify real traffic in flight, with full visibility into TLS-encrypted exchanges.
  • Chaos engineering built in — inject latency, dropped connections, and errors on demand to see how your application copes when a dependency misbehaves.
  • Mock AI too — chat-completion APIs for OpenAI, Anthropic, Gemini, Bedrock, Azure OpenAI and Ollama (including streaming), plus a built-in MCP server so AI coding assistants can drive MockServer directly.
  • Generate mocks, don't hand-write them — from an OpenAPI/Swagger spec, with request matching on method, path, query, headers, cookies, and body (JSON, XML, JSONPath, XPath, regex).
  • Fits your stack — Java, JavaScript/Node, Python, Ruby, Go, .NET, Rust, and PHP clients, plus JUnit and Spring support; runs as Docker, Helm/Kubernetes, a JAR, or a WAR, with a live dashboard and optional clustered state for multi-instance deployments.

See the changelog for what 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 with Homebrew and run the mockserver command directly:

brew install mockserver
mockserver run --port 1080

For every way to run MockServer — Docker, docker-compose recipes, the mockserver CLI, a JVM-less binary bundle, Helm/Kubernetes, the JAR, and Testcontainers — see the Self-Hosting MockServer guide. The same setup can be driven from any client library or the dashboard at http://localhost:1080/mockserver/dashboard.

One-command recipes

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/pets

Drive it from Postman or Bruno

[Run in Postman]

Install

ChannelCommand
Dockerdocker run -d --rm -p 1080:1080 mockserver/mockserver
Docker from GitHub Container Registry (avoids Docker Hub's pull limit)docker run -d --rm -p 1080:1080 ghcr.io/mock-server/mockserver
Homebrew (macOS/Linux)brew install mockserver
Helm (chart guide)helm upgrade --install --namespace mockserver mockserver oci://ghcr.io/mock-server/charts/mockserver
Maven Central [mockserver]org.mock-server:mockserver-netty-no-dependencies — see all Maven artifacts (server, WARs, JUnit 4/5, Spring, Maven plugin)
npmmockserver-node (start/stop)

Client libraries (create expectations, verify requests, drive the control plane from your tests):

[Java] [Node] [PyPI] [Gem] [Go] [Packagist] [NuGet] [Crates.io]

Full install options (SNAPSHOT repository, WAR deployment, Testcontainers modules, package-manager channels) are on the Self-Hosting guide and Where to find MockServer.

Requirements

Runtime: Java 17+ (raised from Java 11 in MockServer 6.0.0 — see the Java 17 / Jakarta upgrade guide; pin to 5.15.x if you need Java 11). The official Docker image bundles its own JVM, so containerised users need no JVM of their own.

Building from source: JDK 17+.

Security note: MockServer is a development and testing tool only — see SECURITY.md.

Documentation

Versions

[Latest release]

  • What changed: changelog and GitHub releases (every version is also a git tag mockserver-<version>).
  • API docs for a version: Java API at https://mock-server.com/versions/<version>/apidocs/index.html; REST API on SwaggerHub (one spec per major.minor.x).
  • Java 11: the last Java 11-compatible release is 5.15.0 (January 2023).

6.0.0 breaking change: the <classifier>shaded</classifier> Maven form was removed. Replace mockserver-netty:<version>:shaded with mockserver-netty-no-dependencies:<version> (same shaded bytes, new coordinates).

Community & Contributing

Maintainers

來源:README.md,提交 7db1289

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:該軟體包類型無法在沙箱中執行。

版本歷史

6
  1. v9.4.0最新Nov 20, 2026
  2. v9.3.0Nov 17, 2026
  3. v9.2.0Oct 29, 2026
  4. v9.1.0Oct 21, 2026
  5. v9.0.0Oct 16, 2026
  6. v8.0.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分