MCPClientMock

io.github.Akkshay10由 GitHub 账号 Akkshay10 发布v1.0.2更新于 Oct 24, 2026

MCP server for James Bloom MockServer - create expectations, verify requests, and manage mock state

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

面向 James Bloom MockServer 的 MCP 服务器,让助手创建模拟 HTTP 期望、校验收到的请求,并清理或重置模拟状态。

可以做什么
  • 创建模拟 HTTP 期望,可设置请求匹配条件(方法、路径、查询参数、请求头、请求体)与响应(状态码、响应头、响应体、延迟、次数、有效期)
  • 校验 MockServer 是否收到符合条件的请求,可指定至少、至多或精确次数
  • 按匹配条件筛选并获取已记录的请求
  • 按条件清理或全部清理期望与已记录请求,并可整体重置 MockServer
  • 查看 MockServer 的连接状态与配置
适用场景
适合在后端尚未就绪时开发或测试 HTTP 接口,或让助手针对某个 MockServer 实例搭建并检查模拟端点,用于前端与集成测试。
运行要求
需要 Node.js 18 或更高版本,通过 npx 或全局 npm 安装运行。还需一个正在运行的 MockServer 实例,通过环境变量 MOCKSERVER_HOST(默认 localhost)和 MOCKSERVER_PORT(默认 1080)指定。仅支持桌面客户端。
安装前请注意
清理与重置工具会删除目标 MockServer 上的期望和已记录请求,不带匹配条件的重置会清空全部内容,应指向测试实例而非共享实例。创建期望会改变服务器状态。未声明任何凭据,但主机设置可将其指向团队共享服务器。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCPClientMock,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mockserver-mcp

An MCP (Model Context Protocol) server for interacting with James Bloom's MockServer. This enables AI assistants to create mock HTTP expectations, verify requests, clear state, and manage MockServer instances programmatically.

Prerequisites

You need a running MockServer instance:

bash
# Using Docker (easiest)docker run -d -p 1080:1080 mockserver/mockserver

Installation

Using npx (recommended)

bash
npx mockserver-mcp

Global installation

bash
npm install -g mockserver-mcpmockserver-mcp

Configuration

Environment Variables

VariableDescriptionDefault
MOCKSERVER_HOSTMockServer hostnamelocalhost
MOCKSERVER_PORTMockServer port1080

MCP Client Configuration

Add to your MCP client configuration file (e.g., Claude Desktop, Kiro, Cursor):

json
{  "mcpServers": {    "mockserver": {      "command": "npx",      "args": ["-y", "mockserver-mcp"],      "env": {        "MOCKSERVER_HOST": "localhost",        "MOCKSERVER_PORT": "1080"      }    }  }}

For shared team MockServer, change MOCKSERVER_HOST to your server's address.

Available Tools

mockserver_create_expectation

Create a mock HTTP expectation on MockServer.

Parameters:

  • httpRequest (required): Request matching criteria
    • method: HTTP method (GET, POST, PUT, DELETE, etc.)
    • path: URL path to match
    • queryStringParameters: Query parameters to match
    • headers: Headers to match
    • body: Body matcher with type (STRING, JSON, REGEX, XPATH, JSON_PATH) and value
  • httpResponse: Response configuration
    • statusCode: HTTP status code
    • headers: Response headers
    • body: Response body (string or object)
    • delay: Response delay with timeUnit and value
  • times: How many times to match (remainingTimes, unlimited)
  • timeToLive: Expectation lifetime (timeUnit, timeToLive)

Example:

json
{  "httpRequest": {    "method": "GET",    "path": "/api/users"  },  "httpResponse": {    "statusCode": 200,    "body": { "users": [] }  }}

mockserver_verify

Verify that requests matching criteria were received by MockServer.

Parameters:

  • httpRequest (required): Request matching criteria (same as create_expectation)
  • times: Expected request count
    • atLeast: Minimum number of requests
    • atMost: Maximum number of requests
    • exactly: Exact number of requests

Example:

json
{  "httpRequest": {    "method": "POST",    "path": "/api/orders"  },  "times": {    "atLeast": 1  }}

mockserver_clear

Clear expectations and recorded requests from MockServer.

Parameters:

  • httpRequest (optional): Request matcher to clear specific expectations. If not provided, clears all.

Example:

json
{  "httpRequest": {    "path": "/api/users"  }}

mockserver_reset

Perform a full reset of MockServer, clearing all expectations and recorded requests.

Parameters: None

mockserver_retrieve_requests

Retrieve recorded requests from MockServer.

Parameters:

  • httpRequest (optional): Request matcher to filter recorded requests

Example:

json
{  "httpRequest": {    "method": "GET"  }}

mockserver_status

Get MockServer connection status and configuration.

Parameters: None

Why Mocking?

API mocking enables early testing — start building and testing your frontend or integrations before the backend is ready. No more waiting. Ship faster.

Requirements

  • Node.js >= 18.0.0
  • A running MockServer instance

Links

License

MIT

来源:README.md,提交 d4bf387

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分