
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.
概览
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 设置首选模拟端口。
安装
在 SourceWeft 中
- 打开 控制台中的 Mockzilla Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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
.mockzarchive. - 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.yamlexpose?" - "Mock
POST /checkoutto 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.ymlinto./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-testand 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:
-s userinstalls for your user account (available in every project).- Drop
-s userto scope to the current project only.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
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:
Restart Cursor after editing.
Gemini CLI
One-liner, no manual JSON editing:
-s userwrites 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:
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_cliResolve Mockzilla on this machine: systemPATH-> bridge cache ->go runinvocation. Returns install options if nothing matches. -
install_cliInstall Mockzilla into~/.cache/mockzilla-mcp/. Methods:download(prebuilt from GitHub releases, default),go-install,go-run. Never touches systemPATH. -
bridge_statusReport the bridge's version, check npm for newer publishes, and surface upgrade steps.
OpenAPI exploration and docs
-
infoSummarise an OpenAPI spec without serving it:{title, version, openapi_version, endpoint_count, paths}. Also reads.mockzpackages. -
lintFind schemas in a spec that no value can satisfy, so a broken spec is caught before serving it:{clean, defect_count, defects}. -
discover_specsScan a directory for OpenAPI specs and folders of static endpoint files. Returns asuggested_inputforserve_locally. -
mockzilla_docs_topicsList 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_readReturn the full markdown for one or more topics, or a whole category. -
mockzilla_docs_searchKeyword search across all docs; returns top sections with snippets.
Reshaping specs
-
simplifyDrop or reduce union types, stripx-*extensions, and optionally cap optional properties per schema. Writes the simplified spec to disk and returns its path. -
packPack a directory of services into a.mockzarchive thatserve_locallycan serve, even from a URL.
Generating code
generateRunmockzilla generate, the built-in mockzilla-codegen: Go models from a spec, plus a server, a client or MCP tools when asked. Readscodegen.yamlwhen the folder has one. Writes the files, lists them first withdry_run, or reports stale ones withcheck, along with the spec's errors and warnings. Needs CLI 2.11.0 or newer.
Local mocking
-
serve_locallyStart a portable mock server on a free port. Accepts a spec file, directory, or publichttpsURL. Returns{url, port, pid, services}. For a single spec,latency,errors,mountandcontextadd delay, inject error responses, change the mount path, or set replacement values. -
stop_locallyStop a server started byserve_locally. -
call_endpointMake an HTTP request and return{status, headers, body}, to show a mock's response. Localhost only unlessallow_remoteis set. -
mock_endpointQuickly mock a single HTTP endpoint without an OpenAPI spec. Writes a static response into the managed mocks dir and (re)starts the shared server. Takesstatusandheadersfor a failure or a redirect with a real body (404 with an error payload, 201 with aLocation); omitresponsefor a body-less 204 or 304. Needs mockzilla 2.8.20 or newer. -
list_mock_endpointsList all endpoints currently mocked, plus the running server's URL and the Mockzilla UI URL. -
clear_mock_endpointsWipe all mocks and stop the managed server. -
request_historyList the requests the running server answered: method, URL, status, content type, latency, and whether the response came from an upstream. Passidwithservicefor one request's full headers and body. Reads the server's own history API, so no account is needed. -
diagnose_requestsExplain 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_replayConfigure replay for a service: record a response once, then serve it back for every matching request. Returnsrecording_scopesaying what each endpoint is keyed by, since with no match fields every call to an endpoint shares one recording. Writesconfig.ymlonly inside the bridge's own mocks dir; for a folder from your own project it returns the YAML and where it goes. -
list_replaysList a service's recordings, with the request values each one is keyed by. -
check_github_deployableSay 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_reposThe user's repositories, flagging which already publish mocks, so the agent can ask which one to use. -
publish_to_githubPush 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,-3if 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_deployWait for the workflow run and return the live URL, as the action reported it. -
unpublish_from_githubTake the mocks down and free the simulation slot, optionally deleting the repository too.
Account
-
loginOpens 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. -
logoutRevokes 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_contextlist_simslist_catalog_productsdeploy_mock_from_catalogdeploy_mock_from_specdeploy_mock_from_urlwait_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
Files
The bridge keeps the CLI and mocks under ~/.cache/mockzilla-mcp/, and the login under ~/.config/mockzilla-mcp/:
rm -rf ~/.cache/mockzilla-mcpresets 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
PATHis never touched, so reset doesn't affect a separatebrewinstall of Mockzilla.
Updates
Recommended way to stay current:
- Pin
@mockzilla/mcp@latestin your MCP client config sonpxre-checks the registry on every spawn. - Restart Claude Desktop / Cursor / Gemini periodically. That's when the new tarball is fetched.
- If something seems off, ask the agent: "Run
bridge_statusand tell me if@mockzilla/mcpis up to date."
If it's stale, run:
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:
-
Bump
versioninpackage.json. -
Run:
This will:
- Build
docs/andhosted-tools.jsonfrom the published docs bundle, plus the engine docs at the pinned CLI version. Maintainers only: it needsDOCS_BUNDLE_CMDinlocal.mk. - Run the smoke tests: the stdio round-trip, login against a fake OAuth server, the docs tools,
mock_endpointagainst 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 publishthe new tarball.- Mirror the version into
server.json. - Log
mcp-publisherin with the GitHub token from Keychain (see below). - Run
mcp-publisher publishagainst the MCP registry.
- Build
-
Commit the
server.jsonbump.
If you only want one side:
make publishfor npm only.make publish-mcpfor the MCP registry only (server.jsonis always re-synced frompackage.jsonfirst).
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:
-
Create a classic GitHub token with
read:organdread:user. -
Store it in Keychain. The command prompts for the token:
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, workflowpublish.yml. No token is stored anywhere. AWS_ROLE_ARNrepository secret, set to thegithub_mcp_release_role_arnoutput of infra'slive/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
- mockzilla.org - hosted API simulation, per-PR mock URLs, GitHub Actions integration
- mockzilla/mockzilla - the core open-source API mock server
- Documentation - full usage guide for portable and codegen modes
- mockzilla/mockzilla-codegen - the Go code generator behind
mockzilla generate
License
Copyright © 2026-present
Licensed under the MIT License
来源:README.md,提交 d2b387c
工具
0版本历史
7- v0.2.28最新Oct 9, 2026
- v0.2.27Sep 26, 2026
- v0.2.26Sep 19, 2026
- v0.2.25Sep 17, 2026
- v0.2.24Sep 17, 2026
- v0.2.22Sep 17, 2026
- v0.2.21Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分