Skip to main content

Module mcp_mock

Module mcp_mock 

Source
Expand description

Mock MCP (Model Context Protocol) server for agent-as-MCP-client testing (#913). Mock MCP (Model Context Protocol) server (#913, #79 round 50 follow-up).

Serves a JSON-RPC 2.0 endpoint at POST /mcp so an agent acting as an MCP client (the role Cursor / Claude Code / custom agents play when they call out to tool servers) can talk to MockForge as a fake MCP server. Answers the core MCP methods with a configurable tool catalog and canned results: initialize, tools/list, tools/call, resources/list, prompts/list, plus the notifications/initialized notification.

This is a MOCK: no real tools run. tools/call returns deterministic canned content so agents can be exercised against a predictable (or, with a configured error tool, hostile) MCP server.

Mounted by mockforge serve --mcp-mock.

Structs§

McpMockConfig
Runtime configuration for the mock MCP server.
McpTool
A single mock tool in the catalog.

Functions§

router
Build the axum router exposing the mock MCP JSON-RPC endpoint.