Enhance McpDocumentTransformer to support JSON-RPC schema#66
Enhance McpDocumentTransformer to support JSON-RPC schema#66foxminchan wants to merge 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request enhances the McpDocumentTransformer class to provide more complete and accurate OpenAPI specifications for MCP (Model Context Protocol) servers by explicitly defining JSON-RPC request and response schemas. The changes improve the generated OpenAPI documentation for the /mcp endpoint by making the schema contracts explicit rather than implicit.
Changes:
- Modified
TransformAsyncto be an async method to support asynchronous schema registration - Added explicit registration of
JsonRpcRequestandJsonRpcResponseschemas to the OpenAPI document components - Enhanced the
/mcpendpoint definition with explicit request body and response content specifications that reference the registered schemas
|
Thanks @foxminchan for this enhancement! Registering In overall, although the current codebase intentionally and cautiously leaves this OpenAPI schema incomplete, it's a great starting point to adopt the JSON-RPC schema. I cross-referenced the changes with the MCP Streamable HTTP spec (2025-11-25) and noticed a few gaps:
|
a0d0048 to
c7381fc
Compare
c7381fc to
9c77521
Compare
|
Hello @justinyoo, Thanks for the thoughtful review and guidance! I’ve updated the changes based on the feedback:
All adjustments are in the latest commits — ready for re-review. Happy to iterate further for alignment with the spec! |
Purpose
This pull request enhances the OpenAPI document transformation logic by introducing support for JSON-RPC request and response schemas and updating the
/mcpendpoint definition. The changes improve the accuracy and completeness of the OpenAPI specification generated by theMcpDocumentTransformer.OpenAPI schema improvements:
JsonRpcRequestandJsonRpcResponseschemas to the OpenAPI document components, ensuring these types are properly referenced in the specification./mcpendpoint to explicitly define the request body and response content as JSON, referencing the newly registered schemas.Codebase enhancements:
TransformAsyncto be anasyncmethod to allow asynchronous schema registration.usingdirectives forSystem.Net.MimeandModelContextProtocol.Protocolto support new functionality. [1] [2]Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
README updated?
The top-level readme for this repo contains a link to each sample in the repo. If you're adding a new sample did you update the readme?