Mockzilla Mcp

io.github.mockzilla由 GitHub 帳號 mockzilla 發布v0.2.28更新於 Oct 24, 2026

Mock OpenAPI specs locally, or log in to deploy hosted mocks on mockzilla.org from your MCP client.

概覽

AI 產生的概覽

Mockzilla MCP 讓助理檢查 OpenAPI 規格、在本機執行模擬 API 伺服器,並在 mockzilla.org 上部署託管模擬。

可以做什麼
檢查、安裝 Mockzilla CLI 並回報狀態,依分類或關鍵字檢索內建文件。檢查、校驗、簡化、封裝和掃描 OpenAPI 規格,並據此產生 Go 模型、伺服器、用戶端或 MCP 工具。將規格檔、目錄或 URL 啟動為本機模擬伺服器,模擬單一端點、呼叫端點,並列出、停止或清除模擬。查看請求歷史、診斷流量,並設定和列出回放。檢查 GitHub 儲存庫是否可部署,將模擬發布到儲存庫、等待部署完成並取消發布。登入後列出已部署的模擬和目錄產品,並從規格、URL 或目錄包部署託管模擬。
適用情境
適合在沒有真實後端、沙箱帳號或付費額度的情況下開發和測試 API,例如支付、交易所或有限流的 API。也適合需要零外部依賴的 CI 流程,以及希望從編輯器部署託管模擬的團隊。
執行需求
以 stdio 在本機執行,通常透過 npx 和 Node.js 啟動。本機使用無需帳號,Mockzilla CLI 會安裝到受管快取中。託管工具需要瀏覽器登入,或在 MOCKZILLA_TOKEN 中提供 API 金鑰,並需能存取託管端點,可用 MOCKZILLA_MCP_URL 覆寫。MOCKZILLA_MANAGED_PORT 設定偏好的模擬埠。
安裝前請注意
使用託管功能會把規格和部署請求傳送到 mockzilla.org,並在使用者設定目錄中保存登入資訊。MOCKZILLA_TOKEN 是密鑰,不要放入共用設定。發布會把模擬推送到使用者的某個 GitHub 儲存庫,取消發布時可選擇刪除該儲存庫。本機工具會寫入磁碟檔案,包括簡化後的規格、產生的程式碼和模擬定義,clear_mock_endpoints 會清除所有模擬。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

@mockzilla/mcp

MCP server for Mockzilla - an open-source API mock server for OpenAPI specifications. Let Claude Code, Claude Desktop, Cursor, or Gemini CLI install Mockzilla, inspect OpenAPI specs, and spin up realistic local mock APIs in seconds. No account required for local use.

Source: github.com/mockzilla/mockzilla-mcp

Use cases

  • Local API development - mock any OpenAPI spec without a real backend or sandbox account
  • CI/CD integration testing - zero external dependencies in your pipeline
  • PSP and payment API mocking - Stripe, PayPal, Adyen from your editor without test accounts
  • Crypto exchange API mocking - Binance, Bybit without registered accounts
  • Rate limit protection - develop against OpenAI, Twilio without burning quota
  • Agentic workflows - let Claude or Cursor spin up and manage mock servers automatically

Two planes

@mockzilla/mcp exposes two planes of tools to your MCP client.

Local plane (no account required)

Runs on your machine. No Mockzilla account needed.

From an agent you can:

  • Check whether the Mockzilla CLI is installed, and install it into a managed cache (no changes to system PATH).
  • Inspect and lint an OpenAPI spec, or scan a folder for specs.
  • Simplify a spec that is too heavy to mock, or pack services into a .mockz archive.
  • Generate Go code from a spec: models, a server for one of 14 routers, a client, or MCP tools.
  • Serve any OpenAPI spec locally as a portable mock server, and call its endpoints.
  • Mock a single HTTP endpoint without a spec.
  • List, stop, and clear locally managed mocks.

Hosted plane (log in once)

Ask your agent to log in, or ask for something hosted. The agent calls the login tool, your browser opens the Mockzilla login, and you pick an organization and read-only or read-and-write access. The bridge keeps the login on your machine and renews it by itself. Hosted tools are listed from the start; before you log in, the agent is told to log in first.

Agents can then:

  • List deployed sims.
  • Browse catalog products.
  • Deploy hosted mocks from a spec, URL, or catalog bundle.
  • Wait for a deploy and return the live URL.

Before logging in, only the local plane is exposed. Agents can still help users explore Mockzilla and run local mocks before they sign up.

Example prompts

You can use these directly from Claude Code, Claude Desktop, Cursor, or Gemini CLI once mockzilla is configured as an MCP server.

Local plane (no account)

  • "Is the mockzilla CLI installed on this machine?"
  • "Install Mockzilla for me."
  • "Spin up the Petstore OpenAPI spec locally so I can curl it."
  • "What endpoints does https://example.com/openapi.yaml expose?"
  • "Mock POST /checkout to return a 402 response."
  • "List the mock endpoints you're managing."
  • "Stop the mock server you started."
  • "Generate Go models and a chi server for openapi.yml into ./api."

Hosted plane (after logging in)

  • "Log me in to Mockzilla."
  • "List the sims I have deployed."
  • "Show me the catalog products."
  • "Deploy a Stripe mock named stripe-test and give me the live URL."
  • "Create a hosted mock from this OpenAPI URL on mockzilla.org."

Install

Claude Code

One-liner, no config file editing:

bash
claude mcp add -s user mockzilla -- npx -y @mockzilla/mcp@latest
  • -s user installs for your user account (available in every project).
  • Drop -s user to scope to the current project only.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "mockzilla": {      "command": "npx",      "args": ["-y", "@mockzilla/mcp@latest"]    }  }}

Restart Claude Desktop after editing.

Cursor

Easiest: Settings -> MCP Servers -> Add new MCP server and fill in:

  • Name: mockzilla
  • Command: npx
  • Args: -y @mockzilla/mcp@latest

Or edit ~/.cursor/mcp.json directly:

json
{  "mcpServers": {    "mockzilla": {      "command": "npx",      "args": ["-y", "@mockzilla/mcp@latest"]    }  }}

Restart Cursor after editing.

Gemini CLI

One-liner, no manual JSON editing:

bash
gemini mcp add -s user mockzilla npx -y @mockzilla/mcp@latest
  • -s user writes to ~/.gemini/settings.json (available in every project).
  • Drop -s user (or use -s project) to scope to the current directory's .gemini/settings.json.

Or edit the settings file directly:

json
{  "mcpServers": {    "mockzilla": {      "command": "npx",      "args": ["-y", "@mockzilla/mcp@latest"]    }  }}

Restart the Gemini CLI after editing.

Why @latest?

Without @latest, npx caches the first resolved version and won't pick up new publishes. Pinning to @latest makes npx re-check the registry on every spawn, so a Claude / Cursor / Gemini restart is enough to upgrade. Trade-off: ~200 ms extra startup time.

Local tools

These tools are always available and never leave the user's machine.

Setup and status

  • check_cli Resolve Mockzilla on this machine: system PATH -> bridge cache -> go run invocation. Returns install options if nothing matches.

  • install_cli Install Mockzilla into ~/.cache/mockzilla-mcp/. Methods: download (prebuilt from GitHub releases, default), go-install, go-run. Never touches system PATH.

  • bridge_status Report the bridge's version, check npm for newer publishes, and surface upgrade steps.

OpenAPI exploration and docs

  • info Summarise an OpenAPI spec without serving it: {title, version, openapi_version, endpoint_count, paths}. Also reads .mockz packages.

  • lint Find schemas in a spec that no value can satisfy, so a broken spec is caught before serving it: {clean, defect_count, defects}.

  • discover_specs Scan a directory for OpenAPI specs and folders of static endpoint files. Returns a suggested_input for serve_locally.

  • mockzilla_docs_topics List the Mockzilla docs, by category, with each topic's title and summary. The product docs from mockzilla.org, the engine docs and the mockzilla-codegen docs all ship inside the package, so no network or login is needed.

  • mockzilla_docs_read Return the full markdown for one or more topics, or a whole category.

  • mockzilla_docs_search Keyword search across all docs; returns top sections with snippets.

Reshaping specs

  • simplify Drop or reduce union types, strip x-* extensions, and optionally cap optional properties per schema. Writes the simplified spec to disk and returns its path.

  • pack Pack a directory of services into a .mockz archive that serve_locally can serve, even from a URL.

Generating code

  • generate Run mockzilla generate, the built-in mockzilla-codegen: Go models from a spec, plus a server, a client or MCP tools when asked. Reads codegen.yaml when the folder has one. Writes the files, lists them first with dry_run, or reports stale ones with check, along with the spec's errors and warnings. Needs CLI 2.11.0 or newer.

Local mocking

  • serve_locally Start a portable mock server on a free port. Accepts a spec file, directory, or public https URL. Returns {url, port, pid, services}. For a single spec, latency, errors, mount and context add delay, inject error responses, change the mount path, or set replacement values.

  • stop_locally Stop a server started by serve_locally.

  • call_endpoint Make an HTTP request and return {status, headers, body}, to show a mock's response. Localhost only unless allow_remote is set.

  • mock_endpoint Quickly mock a single HTTP endpoint without an OpenAPI spec. Writes a static response into the managed mocks dir and (re)starts the shared server. Takes status and headers for a failure or a redirect with a real body (404 with an error payload, 201 with a Location); omit response for a body-less 204 or 304. Needs mockzilla 2.8.20 or newer.

  • list_mock_endpoints List all endpoints currently mocked, plus the running server's URL and the Mockzilla UI URL.

  • clear_mock_endpoints Wipe all mocks and stop the managed server.

  • request_history List the requests the running server answered: method, URL, status, content type, latency, and whether the response came from an upstream. Pass id with service for one request's full headers and body. Reads the server's own history API, so no account is needed.

  • diagnose_requests Explain what is wrong with the recorded traffic and where its data came from: a breakdown by origin, status and content type, latency p50/p95/max, and findings such as an upstream that failed and silently fell back to a generated mock, a 404 from a wrong mount prefix, or a JSON body under a non-JSON content type.

  • setup_replay Configure replay for a service: record a response once, then serve it back for every matching request. Returns recording_scope saying what each endpoint is keyed by, since with no match fields every call to an endpoint shares one recording. Writes config.yml only inside the bridge's own mocks dir; for a folder from your own project it returns the YAML and where it goes.

  • list_replays List a service's recordings, with the request values each one is keyed by.

  • check_github_deployable Say whether a repository or folder would deploy a mock, and what is missing if not. Knows both kinds: portable service folders and a codegen Go server. Read-only.

  • list_github_repos The user's repositories, flagging which already publish mocks, so the agent can ask which one to use.

  • publish_to_github Push mocks to one of the user's own repositories and let the Mockzilla action deploy them at a host of their own, https://<label>.api.mockz.io. The label is the repository name, with -2, -3 if it is taken. No Mockzilla account needed: the first push registers the repository. Merges into an existing services folder rather than replacing it, and never overwrites an existing workflow.

  • wait_for_github_deploy Wait for the workflow run and return the live URL, as the action reported it.

  • unpublish_from_github Take the mocks down and free the simulation slot, optionally deleting the repository too.

Account

  • login Opens the Mockzilla login in the browser, where the user picks an organization and read-only or read-and-write access. Returns right away with the login link. The agent calls a hosted tool again once the user approves. The login is saved under ~/.config/mockzilla-mcp/, one per server URL, and renewed automatically.

  • logout Revokes the connection and deletes the saved login. Log out and in again to switch organization or access.

Hosted tools

@mockzilla/mcp lists the hosted tools from the start and forwards them to mockzilla.org's MCP endpoint once you log in. At the time of writing, the hosted surface includes:

  • get_context
  • list_sims
  • list_catalog_products
  • deploy_mock_from_catalog
  • deploy_mock_from_spec
  • deploy_mock_from_url
  • wait_for_deploy

Refer to the hosted server's docs or the MCP registry entry for the live tool list.

On a machine without a browser, such as CI or a remote server, set MOCKZILLA_TOKEN to an API key from the dashboard instead of logging in. The hosted tools are then available from the start.

Configuration

Env varDefaultPurpose
MOCKZILLA_TOKENunsetAPI key (mz_*) to use instead of logging in, for machines without a browser.
MOCKZILLA_MCP_URLhttps://platform.mockzilla.org/mcpOverride the hosted endpoint, e.g. http://localhost:8000/mcp for local development.
MOCKZILLA_NO_BROWSERunsetSet to 1 to not open a browser on login; the agent shows the link instead.
MOCKZILLA_MCP_CLIENT_IDhttps://mockzilla.org/mcp-client.jsonOAuth client id login uses. Override only for local development, e.g. with a client registered on a local server.
MOCKZILLA_BIN_VERSIONmatches bridge versionPin a specific Mockzilla CLI version for install_cli to fetch.
MOCKZILLA_MANAGED_PORT2200Preferred port for the mock_endpoint server. Falls back to a kernel-picked port if busy. Avoid 3000 (Next.js/React), 5173 (Vite), 8080. Try 2400 or 4444 if 2200 is unavailable.
MOCKZILLA_DOCS_DIRunsetRead docs from another build of docs/, made by scripts/build.mjs, instead of the packaged one.

Files

The bridge keeps the CLI and mocks under ~/.cache/mockzilla-mcp/, and the login under ~/.config/mockzilla-mcp/:

text
~/.cache/mockzilla-mcp/├── bin/mockzilla        # downloaded or go-installed binary├── config.json          # { method, version, invocation? }└── mocks/               # mock_endpoint persists static endpoints here    └── services/        └── <first path segment>/<rest of path>/<method>/            ├── index.<ext>   # the response body            └── meta.json     # status and headers, written only when set
~/.config/mockzilla-mcp/└── credentials.json     # saved logins, one per server URL, readable only by you
  • rm -rf ~/.cache/mockzilla-mcp resets the CLI and all mocked endpoints. The login stays.
  • To wipe just the mocks: rm -rf ~/.cache/mockzilla-mcp/mocks.
  • To drop the login, ask the agent to log out. That also revokes it on mockzilla.org.
  • The system PATH is never touched, so reset doesn't affect a separate brew install of Mockzilla.

Updates

Recommended way to stay current:

  1. Pin @mockzilla/mcp@latest in your MCP client config so npx re-checks the registry on every spawn.
  2. Restart Claude Desktop / Cursor / Gemini periodically. That's when the new tarball is fetched.
  3. If something seems off, ask the agent: "Run bridge_status and tell me if @mockzilla/mcp is up to date."

If it's stale, run:

bash
npx clear-npx-cache @mockzilla/mcp

and restart your MCP client.

The Mockzilla CLI version is pinned by the bridge (via MOCKZILLA_VERSION in lib/install.js). Updating the bridge updates the pin; the next install_cli call brings the CLI itself up to date.

Development

See CLAUDE.md for project conventions and a walkthrough of adding a new tool.

Releasing

The bridge has two registries to keep in sync: npm (@mockzilla/mcp) and the MCP registry (server.json). Skipping the second one leaves discovery clients pinned to the previous tarball.

The usual way is to bump version in package.json, merge, and publish a GitHub release tagged v<version>. That covers both registries: see From GitHub Actions below.

To release by hand instead:

  1. Bump version in package.json.

  2. Run:

    bash
    make publish-all

    This will:

    • Build docs/ and hosted-tools.json from the published docs bundle, plus the engine docs at the pinned CLI version. Maintainers only: it needs DOCS_BUNDLE_CMD in local.mk.
    • Run the smoke tests: the stdio round-trip, login against a fake OAuth server, the docs tools, mock_endpoint against the real CLI, and the behavior checks that each tool reports only what the server really does (CLI-dependent ones skip when no CLI is installed).
    • npm publish the new tarball.
    • Mirror the version into server.json.
    • Log mcp-publisher in with the GitHub token from Keychain (see below).
    • Run mcp-publisher publish against the MCP registry.
  3. Commit the server.json bump.

If you only want one side:

  • make publish for npm only.
  • make publish-mcp for the MCP registry only (server.json is always re-synced from package.json first).

mcp-publisher must be on PATH (brew install mcp-publisher or follow the installation docs).

MCP registry login

A registry login lasts 5 minutes, so make publish-mcp logs in before every publish. It reads a GitHub token from macOS Keychain, because the browser login (mcp-publisher login github without a token) can't publish under io.github.mockzilla.

One-time setup:

  1. Create a classic GitHub token with read:org and read:user.

  2. Store it in Keychain. The command prompts for the token:

    bash
    security add-generic-password -a "$USER" -s mcp-publisher-github -w

From GitHub Actions

Publishing a GitHub release whose tag matches package.json runs .github/workflows/publish.yml, which builds the docs, runs the smoke tests and publishes to npm with provenance. It skips a version npm already has, so it is safe to run after make publish.

Two things have to be set up for it, both one-time:

  • npm Trusted Publishing. On npmjs.com, under the package's settings, add a trusted publisher: repository mockzilla/mockzilla-mcp, workflow publish.yml. No token is stored anywhere.
  • AWS_ROLE_ARN repository secret, set to the github_mcp_release_role_arn output of infra's live/aws/iam-github-oidc. The docs bundle is only in S3 - nothing serves it, and the CDN in front of that bucket caches for a day - so the release assumes a role that can read that one key.

.github/workflows/publish-mcp.yml starts on the same release and covers the other registry. It skips versions the MCP registry already has, waits up to 10 minutes for the version to appear on npm, then publishes server.json using GitHub OIDC, so no token is needed. It can still be started by hand from the Actions tab.

The two run in parallel rather than in sequence. The wait loop is what keeps that safe, and it is needed anyway: npm accepts a tarball before it can be read back.

Related

License

Copyright © 2026-present

Licensed under the MIT License

來源:README.md,提交 d2b387c

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

7
  1. v0.2.28最新Oct 9, 2026
  2. v0.2.27Sep 26, 2026
  3. v0.2.26Sep 19, 2026
  4. v0.2.25Sep 17, 2026
  5. v0.2.24Sep 17, 2026
  6. v0.2.22Sep 17, 2026
  7. v0.2.21Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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