mcp-mock
Spin up deterministic mock MCP servers from a JSON fixture file for agent and client testing.
π― Why?
Trending repos show a wave of MCP gateways, agent harnesses, and CLI clients, but testing tooling is still primitive. Developers need deterministic offline MCP servers to validate clients and agent tool use without hitting real APIs. Existing MCP examples are SDK snippets, not a fixture-driven mock server with CLI ergonomics.
Target audience: Developers building MCP clients, agent harnesses, and CI pipelines who need reproducible offline tool endpoints.
β¨ Features
- β¨ JSON fixture specs for MCP tools
- β¨ stdio JSON-RPC server supporting initialize, tools/list, and tools/call
- β¨ canned results, tool-level errors, latency simulation, and {{argument}} templating
- β¨ CLI commands to init, validate, list, run, and call mock tools
π Quick Start
# Install
pip install mcp-mock
# Run
mcp-mock --help
π¦ Installation
From Source
git clone https://github.com/YOUR_USERNAME/mcp-mock.git
cd mcp-mock
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest -v
π¬ Demo
The GIF above was recorded using Charm VHS:
vhs < demo.tape
π Usage
# Show help
mcp-mock --help
# Common usage examples
mcp-mock --example
ποΈ Architecture
graph LR
A[Input] --> B[Core Engine]
B --> C[Output]
B --> D[Plugins]
D --> E[Extensions]
π€ Contributing
Contributions are welcome! Please:
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
MIT Β© 2026 β See LICENSE for details.
If this project helped you, please β star it!