Improvement MCP server for OAuth flow#205
Open
bettercallsaulj wants to merge 4 commits intofix/improve_for_mcp_inspectorfrom
Open
Improvement MCP server for OAuth flow#205bettercallsaulj wants to merge 4 commits intofix/improve_for_mcp_inspectorfrom
bettercallsaulj wants to merge 4 commits intofix/improve_for_mcp_inspectorfrom
Conversation
added 4 commits
March 8, 2026 16:09
The handleCallTool function was manually building a response with
content as a plain string, which violates the MCP protocol spec.
MCP requires content to be an array of content blocks with type/text.
Before: {"content": "Hello", "isError": false}
After: {"content": [{"type": "text", "text": "Hello"}]}
Changes:
- Use json::to_json(result) to properly serialize CallToolResult
- Add unit tests for MCP format compliance
#203) The HTTP routing filter now properly handles POST/PUT/PATCH requests by accumulating the request body before calling the handler. Previously, handlers were called immediately in onHeaders without access to the body. Additionally, the filter now strips query strings from paths for routing purposes while still providing the full URL (with query string) to handlers. Changes: - Add state variables for pending POST requests and body accumulation - Defer POST/PUT/PATCH handler execution until onMessageComplete - Strip query strings in extractPath for route matching - Provide full URL with query string in RequestContext.path - Add unit tests for POST body handling and query string routing
This commit adds two extensibility features to the HTTP/SSE filter chain, using the existing FilterFactoryCb pattern for consistency: 1. Filter factory support: Allows adding custom filter factories that run before protocol filters (HTTP/SSE/JSON-RPC). Useful for authentication, logging, and other cross-cutting concerns. Uses addFilterFactory() which matches the existing pattern in FilterChainFactoryImpl. 2. Route registration callback: Allows registering custom HTTP endpoints when the filter chain is created. Useful for OAuth discovery endpoints, health checks, and other custom routes. Changes: - Add HttpRouteRegistrationCallback type for route registration - Add addFilterFactory() and getFilterFactories() to HttpSseFilterChainFactory - Add setRouteRegistrationCallback() to HttpSseFilterChainFactory - Add filter_factories and route_registration_callback to McpServerConfig - Update McpServer to apply config options to filter chain factory - Add unit tests for filter factory and route callback functionality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR must be merged after #201