Why Mock?
- Fast — No subprocess or network overhead
- Deterministic — Predictable responses for every test
- Isolated — No external dependencies or credentials
- CI-friendly — Works in any environment
Basic Mock Server
Create a mock by defining the tools, resources, and prompts you want to simulate:Testing Agent with MCP Tools
CombineMockModel with a mock MCP server to test the full agent-MCP integration:
Writing a Mock MCP Server
Create a simple Python script that implements the MCP protocol over stdio:Testing Tips
Use MockModel
Combine mock MCP servers with
MockModel to test the full pipeline without any real API calls.Test Tool Filtering
Verify that
allowed_tools and blocked_tools configuration works correctly with your mock server.Test Error Paths
Make your mock server return errors to verify your agent handles MCP failures gracefully.
Test Reconnection
Simulate connection drops to verify the reconnection logic works.