About MCPClientMock
MCP server for controlling James Bloom MockServer from AI assistants and test workflows. It provides tools to define HTTP expectations, inspect and verify requests, and manage server state.
Key features
- 01Create HTTP expectations
- 02Match requests by method, path, headers, query, or body
- 03Verify received request counts
- 04Retrieve recorded requests
- 05Clear or reset MockServer state
- 06Check connection status
Use cases
- 01Mock an API while its backend is still in development
- 02Verify that an integration sent expected HTTP requests
- 03Inspect recorded traffic during tests
MCP support
Exposes MockServer expectation creation, request verification and retrieval, state management, and status as tools for MCP clients. It connects to a running MockServer instance.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y mockserver-mcpMOCKSERVER_HOSTMockServer hostnameMOCKSERVER_PORTMockServer portLocal servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
6Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | No | Optional expectation identifier |
| times | object | No | How many times this expectation should be matched |
| times.unlimited | boolean | No | |
| times.remainingTimes | number | No | |
| timeToLive | object | No | How long this expectation should remain active |
| timeToLive.timeUnit | enum | No | MILLISECONDS | SECONDS | MINUTES |
| timeToLive.timeToLive | number | No | |
| httpRequest | object | Yes | Request matching criteria (method, path, headers, body, etc.) |
| httpRequest.body | object | No | Body matcher configuration |
| httpRequest.body.type | enum | No | STRING | JSON | REGEX | XPATH | JSON_PATH |
| httpRequest.body.value | string | No | |
| httpRequest.body.matchType | enum | No | STRICT | ONLY_MATCHING_FIELDS |
| httpRequest.path | string | No | URL path to match |
| httpRequest.method | string | No | HTTP method to match (GET, POST, PUT, DELETE, etc.) |
| httpRequest.headers | object | No | Headers to match |
| httpRequest.pathParameters | object | No | Path parameters to match |
| httpRequest.queryStringParameters | object | No | Query string parameters to match |
| httpResponse | object | No | Response configuration |
| httpResponse.body | any | No | Response body (string or object) |
| httpResponse.delay | object | No | Response delay configuration |
| httpResponse.delay.value | number | No | |
| httpResponse.delay.timeUnit | enum | No | MILLISECONDS | SECONDS |
| httpResponse.headers | object | No | Response headers |
| httpResponse.statusCode | number | No | HTTP status code to return |
Details
From the project READMEmockserver-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:
# Using Docker (easiest)
docker run -d -p 1080:1080 mockserver/mockserver
Installation
Using npx (recommended)
npx mockserver-mcp
Global installation
npm install -g mockserver-mcp
mockserver-mcp
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
MOCKSERVER_HOST | MockServer hostname | localhost |
MOCKSERVER_PORT | MockServer port | 1080 |
MCP Client Configuration
Add to your MCP client configuration file (e.g., Claude Desktop, Kiro, Cursor):
{
"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 criteriamethod: HTTP method (GET, POST, PUT, DELETE, etc.)path: URL path to matchqueryStringParameters: Query parameters to matchheaders: Headers to matchbody: Body matcher withtype(STRING, JSON, REGEX, XPATH, JSON_PATH) andvalue
httpResponse: Response configurationstatusCode: HTTP status codeheaders: Response headersbody: Response body (string or object)delay: Response delay withtimeUnitandvalue
times: How many times to match (remainingTimes,unlimited)timeToLive: Expectation lifetime (timeUnit,timeToLive)
Example:
{
"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 countatLeast: Minimum number of requestsatMost: Maximum number of requestsexactly: Exact number of requests
Example:
{
"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:
{
"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:
{
"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
- npm: https://www.npmjs.com/package/mockserver-mcp
- GitHub: https://github.com/Akkshay10/MCPClientMock
- MCP Registry: https://registry.modelcontextprotocol.io
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.