Generic Mock MCP Server
Generic Mock MCP Server
A config-driven mock server that replaces real MCP servers during AI skill evaluation. It reads a tool schema, dynamically registers MCP-compliant tools, and returns configurable responses — no credentials, no infrastructure, no side effects.
Overview
AI skills depend on MCP servers for tool access. Evaluating skills end-to-end requires the agent to call tools, but real MCP servers have side effects, require credentials, and mix skill failures with infrastructure failures. This mock isolates the skill so evaluation measures only how well it guides the LLM.
One image, any MCP. The schema defines the tools; the fixtures define the responses. No per-MCP custom code needed.
Features
Dynamic tool registration from any
schema.jsonThree response strategies: static, fixtures, and LLM-generated
Streamable HTTP and stdio transports
Session-aware fixture sequencing with automatic fallback
Container-ready (UBI 10 minimal, non-root, ~50MB)
Project structure
.
├── README.md
├── Containerfile
├── requirements.txt
├── src/
│ └── server.py # Mock server implementation
├── tests/
│ ├── test_mock.py # Unit tests
│ ├── schema.json # Test fixture schema
│ └── fixtures.json # Test fixture responses
└── configs/ # Pre-built MCP configs
├── openshift-mcp-server/
│ ├── schema.json
│ └── fixtures.json
└── lightspeed-mcp/
├── schema.json
├── fixtures.json
└── USAGE.md # Curl test guidePrerequisites
Python 3.12+
Podman or Docker (for container builds)
Installation
pip install -r requirements.txtConfiguration
The server requires one or two JSON files:
File | Required | Purpose |
| Yes | Tool definitions (name, description, inputSchema, outputSchema, outputExample) |
| For | Ordered sequence of tool responses for multi-step flows |
Schema format
MCP server developers publish a schema.json alongside their server:
{
"name": "my-mcp-server",
"version": "1.0.0",
"tools": [
{
"name": "tool_name",
"description": "What the tool does",
"inputSchema": {
"type": "object",
"properties": { ... },
"required": [...]
},
"outputSchema": { ... },
"outputExample": { ... }
}
]
}Fixtures format
Skill authors provide a fixtures.json for multi-step flows:
{
"sequence": [
{"tool": "tool_a", "input": {...}, "output": {...}},
{"tool": "tool_b", "input": {...}, "output": {...}}
]
}Responses are matched by tool name and served in sequence order. When fixtures for a tool are exhausted, the server falls back to the schema's outputExample.
Response strategies
Strategy | Behavior | Use case |
| Returns the | Single-tool testing, smoke tests |
| Returns ordered responses from | Multi-step skill evaluation, certification gates |
| Generates coherent responses via LLM (requires | Exploratory testing, regression sweeps |
Settings
All settings can be passed as CLI flags (which take precedence) or environment variables.
Variable | CLI flag | Default | Description |
|
| — | Path to tool schema (required) |
|
| — | Path to fixtures file |
|
|
|
|
|
|
|
|
|
|
| Port for HTTP transport |
|
|
| Model for LLM strategy |
Usage
Run locally
# Static strategy (returns outputExample from schema)
python src/server.py --schema configs/lightspeed-mcp/schema.json --strategy static
# Fixtures strategy (returns ordered responses)
python src/server.py \
--schema configs/lightspeed-mcp/schema.json \
--strategy fixtures \
--fixtures configs/lightspeed-mcp/fixtures.json
# HTTP transport (exposes JSON-RPC at POST /mcp)
python src/server.py \
--schema configs/lightspeed-mcp/schema.json \
--strategy fixtures \
--fixtures configs/lightspeed-mcp/fixtures.json \
--transport streamable-http --port 8080Run in container
Build:
podman build -t mock-mcp-server:latest -f Containerfile .HTTP transport (default):
podman run --rm -d -p 8080:8080 \
-v ./configs/<mcp-name>/schema.json:/config/schema.json:ro,Z \
-v ./configs/<mcp-name>/fixtures.json:/config/fixtures.json:ro,Z \
-e MOCK_STRATEGY=fixtures \
mock-mcp-server:lateststdio transport (for local MCP clients like Claude Code):
podman run --rm -i \
-e MOCK_TRANSPORT=stdio \
-e MOCK_STRATEGY=fixtures \
-v ./configs/<mcp-name>/schema.json:/config/schema.json:ro,Z \
-v ./configs/<mcp-name>/fixtures.json:/config/fixtures.json:ro,Z \
mock-mcp-server:latestTesting with curl
The MCP protocol requires a session handshake before tool calls. The server exposes JSON-RPC at POST /mcp.
1. Initialize and capture session ID
SESSION=$(curl -s -D- -X POST http://127.0.0.1:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "curl-test", "version": "1.0"}
},
"id": 1
}' 2>&1 | grep -i 'mcp-session-id' | awk '{print $2}' | tr -d '\r')
echo "Session: $SESSION"2. Send initialized notification
curl -s -X POST http://127.0.0.1:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Mcp-Session-Id: $SESSION" \
-d '{"jsonrpc": "2.0", "method": "notifications/initialized"}'3. List registered tools
curl -s -X POST http://127.0.0.1:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Mcp-Session-Id: $SESSION" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 2}' | python3 -m json.tool4. Call a tool
curl -s -X POST http://127.0.0.1:8080/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Mcp-Session-Id: $SESSION" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "<tool_name>",
"arguments": {}
},
"id": 3
}' | python3 -m json.toolFor MCP-specific curl test guides with complete step-by-step commands, see the USAGE.md inside each configs/<mcp-name>/ directory.
Running tests
python tests/test_mock.pyAdding a new MCP config
Create
configs/<mcp-name>/schema.jsonwith all tools from the real MCP server.Optionally create
configs/<mcp-name>/fixtures.jsonwith a coherent multi-step scenario.Optionally create
configs/<mcp-name>/USAGE.mdwith curl commands that exercise the fixtures.Smoke test:
python src/server.py --schema configs/<mcp-name>/schema.json --strategy static
Available configs
Config | MCP server | Fixtures | Test guide |
| openshift-mcp-server | OOMKilled troubleshooting | — |
| lightspeed-mcp | CVE Impact Analysis, CVE Validation |
License
Apache-2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/r2dedios/generic-mock-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server