Skip to content

Add JSON response mode to Streamable HTTP server#1714

Open
lntutor wants to merge 1 commit into
modelcontextprotocol:mainfrom
lntutor:feat/json-only-545
Open

Add JSON response mode to Streamable HTTP server#1714
lntutor wants to merge 1 commit into
modelcontextprotocol:mainfrom
lntutor:feat/json-only-545

Conversation

@lntutor

@lntutor lntutor commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • add opt-in EnableJsonResponse configuration for ASP.NET Core and StreamableHttpServerTransport
  • return the final correlated JSON-RPC response directly as application/json without SSE framing
  • omit intermediate request-related messages and POST event-store writes in JSON mode
  • preserve default SSE behavior, empty 202 Accepted notification responses, and standalone GET SSE streams
  • reject polling when JSON responses are enabled and document the transport tradeoffs

Testing

  • dotnet test tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj --filter FullyQualifiedName~JsonResponseModeTests --no-restore (15 passed across net8.0, net9.0, and net10.0)
  • dotnet test tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj -f net10.0 --no-restore --filter "(Execution!=Manual)" (512 passed)
  • dotnet test ModelContextProtocol.slnx --configuration Release --no-build --filter "(Execution!=Manual)" (8,454 passed)
  • dotnet build ModelContextProtocol.slnx --configuration Release (36 projects, 0 warnings)
  • dotnet format ModelContextProtocol.slnx --no-restore --verify-no-changes --include ...
  • dotnet docfx docs/docfx.json --warningsAsErrors true (0 warnings)

Fixes #545

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.

Support a non-SSE JSON-only mode similar to the TypeScript SDKs enableJsonResponse: true

1 participant