Skip to content

Feat/mcp mock mode#236

Open
jlouvel wants to merge 4 commits intomainfrom
feat/mcp-mock-mode
Open

Feat/mcp mock mode#236
jlouvel wants to merge 4 commits intomainfrom
feat/mcp-mock-mode

Conversation

@jlouvel
Copy link
Copy Markdown
Contributor

@jlouvel jlouvel commented Apr 3, 2026

Related Issue

Closes #189


What does this PR do?

Adds mock mode to the MCP server adapter, allowing MCP tools to return static const-valued outputs without consuming any upstream HTTP API.

Schema — Adds MockOutputParameter (name + type + const) to naftiko-schema.json, accepted when a tool declares no call or steps.

Engine — Extracts MockResponseBuilder from ResourceRestlet to build static responses from const-valued output parameters. ToolHandler detects mock tools (no call/steps) and delegates to MockResponseBuilder instead of the HTTP pipeline.

Docs & wiki — Updates Specification-Schema, FAQ (new entry), Roadmap, Guide-Use-Cases (key features for all 9 use cases), design-guidelines, and wrap-api-as-mcp skill reference.

Example — Adds mock-mcp.yml to schemas/examples/ demonstrating a standalone mock MCP capability.


Tests

  • MockResponseBuilderTest — unit tests for static response building from const-valued output parameters (string, number, boolean, object, array, nested)
  • MockMcpIntegrationTest — end-to-end integration test loading mock-mcp-capability.yaml fixture and exercising the full MCP mock tool chain
  • ToolHandlerTest — extended with mock-mode detection and delegation scenarios
  • ResourceRestletTest — updated after extracting MockResponseBuilder

Checklist

  • CI is green (build, tests, schema validation, security scans)
  • Rebased on latest main
  • Small and focused — one concern per PR
  • Commit messages follow Conventional Commits

Agent Context (optional)

agent_name: GitHub Copilot
llm: Claude Opus 4.6
tool: VS Code Chat
confidence: high
source_event: "#189"
discovery_method: user_report
review_focus: MockResponseBuilder.java, ToolHandler.java, naftiko-schema.json (MockOutputParameter)

jlouvel added 4 commits April 3, 2026 13:41
MCP tools can now return static responses from const values in
outputParameters without requiring a consumes block or call/steps.

- Add third anyOf branch to McpTool schema for mock mode
- Extract MockResponseBuilder shared by REST and MCP adapters
- Add mock mode check in ToolHandler.handleToolCall()
- Add unit, integration tests and mock-mcp.yml example
- Specification-Schema: add mock mode to McpTool (third mode)
- FAQ: add Q&A for MCP mock tools with const values
- Roadmap: mark MCP mock feature as completed
- Guide-Use-Cases: add MCP no-adapter line item
- wrap-api-as-mcp: add mock mode to core concept and constraints
- design-guidelines: add MCP mock mode guidance
MappedOutputParameter uses unevaluatedProperties:false and does not
allow 'name'. Add a dedicated MockOutputParameter definition with
name, type, and const (all required) for mock mode tools.

- Add MockOutputParameter to naftiko-schema.json
- Reference it in McpTool mock anyOf branch
- Document MockOutputParameter in Specification-Schema.md
@jlouvel jlouvel requested a review from eskenazit April 3, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Framework : Add mocking feature to MCP server adapter similar to REST server adapter

1 participant