Skip to content

Improvement MCP server for MCP inspector#201

Open
bettercallsaulj wants to merge 5 commits intomainfrom
fix/improve_for_mcp_inspector
Open

Improvement MCP server for MCP inspector#201
bettercallsaulj wants to merge 5 commits intomainfrom
fix/improve_for_mcp_inspector

Conversation

@bettercallsaulj
Copy link
Collaborator

No description provided.

RahulHere added 4 commits March 6, 2026 02:02
Add JsonValue type to ResponseResult variant to support arbitrary nested
JSON responses. This enables proper MCP protocol compliance for responses
like initialize that require nested object structures.

Changes:
- Add json::JsonValue to ResponseResult variant in types.h
- Add JsonValue serialization handler in json_serialization.cc
Fix response formats for initialize, tools/list, and prompts/list to
comply with MCP protocol specification.

Changes:
- handleInitialize: Use proper nested JSON structure instead of flattened
  dot notation (e.g., {"serverInfo": {"name": ...}} not {"serverInfo.name": ...})
- handleListTools: Wrap tools array in {"tools": [...]} object
- handleListPrompts: Wrap prompts array in {"prompts": [...]} object
Add CORS headers to all HTTP responses for browser-based MCP clients
(e.g., MCP Inspector). Also add check to pass through already
HTTP-formatted responses from routing filter.

Changes:
- Add Access-Control-Allow-Origin, Methods, and Headers to JSON responses
- Add same CORS headers to SSE responses
- Skip HTTP framing for responses that already have HTTP headers
Add support for browser-based MCP clients by handling CORS preflight
requests and sending proper HTTP responses for JSON-RPC notifications.

Changes:
- Register OPTIONS handlers for /mcp, /mcp/events, /rpc, /health, /info
- Add default OPTIONS handler for any unregistered path
- Add CORS headers to /health and /info endpoint responses
- Send HTTP 202 Accepted response for JSON-RPC notifications
  (notifications don't have JSON-RPC responses but HTTP requires one)
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

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.

1 participant