Real-World Mocking for MCP and Agents
Real-world mocking for MCP and agents means serving realistic, contract-accurate mocks of Model Context Protocol (MCP) servers and A2A agent cards — with lifelike tools, resources, prompts, authentication, and error cases — so you can build and test clients and agents before the real backend exists. A²D makes this design-first: you design the specification, and the mock is generated from it and stays in sync with the contract.
This is the pillar guide. It ties together MCP mocking, API mocking, and agent mocking into one workflow and links to the focused guides for each.
New to A²D? Start with Creating your first MCP server, then come back here for the end-to-end mocking workflow.
Why mock MCP servers and agents
Agentic systems depend on services that are often unfinished, rate-limited, expensive, or non-deterministic. Mocking removes that dependency during development and testing:
- Build before the backend exists — agree on the contract, then develop against a mock.
- Deterministic tests — realistic but stable responses make agent behavior reproducible.
- No cost or rate limits — exercise tools thousands of times without hitting real APIs.
- Failure coverage — simulate error and edge cases that are hard to trigger for real.
The design-first mocking workflow
A²D turns a specification into a running mock, so the mock never drifts from the contract:
- Design — define the MCP server or agent card spec (tools, resources, prompts, skills).
- Mock — A²D serves a secure mocking endpoint with configurable scenarios per tool.
- Validate — run design rules to enforce quality and organizational consistency.
- Test — run suites against the mock across environments and track coverage.
- Publish — push the validated spec to Anypoint Exchange when it is ready.
Real-world realism
A mock is only useful if it behaves like the real thing. A²D supports:
- Multiple scenarios per tool — success, empty, partial, and error responses.
- Authentication types — exercise auth flows the way clients will really use them.
- Environments — Mock, Pre-prod, and Prod per asset for targeted testing.
- Structured content — output schemas so responses match the real contract shape.
{
"scenario": "get_weather.success",
"response": {
"city": "San Francisco",
"temperatureC": 18,
"condition": "Partly cloudy",
"updatedAt": "2026-01-01T12:00:00Z"
}
}Focused guides
Go deeper on each dimension of real-world mocking:
- MCP mocking — mock an MCP server’s tools, resources, and prompts.
- API mocking — design-first mocking of REST and MCP contracts.
- Mock AI agents — mock A2A agent cards and agent behavior.
- Design-first MCP — designing MCP server specs before code.
- Design-first agents — defining agent behavior up front.
Next Steps
- MCP mocking - Mock a Model Context Protocol server
- Mock AI agents - Mock A2A agent cards
- Testing MCP endpoints - Exercise your mock
- Using design rules - Validate before you publish
Mock the real world first — design, mock, and test MCP servers and agents before the backend exists.