Skip to content

feat: support incremental MCP SSE responses - #114

Open
thicien wants to merge 1 commit into
prooflinedev:mainfrom
thicien:feat/mcp-sse-streaming
Open

thicien wants to merge 1 commit into
prooflinedev:mainfrom
thicien:feat/mcp-sse-streaming

Conversation

@thicien

@thicien thicien commented Dec 2, 2026

Copy link
Copy Markdown

Summary

This change adds incremental handling of MCP Server-Sent Events (SSE) responses to the TypeScript SDK.

Previously, waiting for the complete response body could prevent the client from returning a matching MCP response when the server kept the stream open. This implementation processes incoming chunks incrementally and returns once the expected JSON-RPC response is received.

Changes

  • Added incremental SSE response parsing.
  • Added streaming UTF-8 decoding and support for fragmented events.
  • Added response-size limits and timeout handling.
  • Cancels the remaining response stream after receiving the matching response.
  • Added tests covering fragmented responses, EOF, cancellation, and timeout behavior.

Verification

  • pnpm test — 109 tests passed.
  • pnpm lint — passed.
  • pnpm typecheck — passed.
  • pnpm build — passed.
  • git diff --check — passed.

Scope

Changes are limited to:

  • src/mcp.ts
  • src/transport.ts
  • tests/http.test.mjs

This branch has not been deployed

No deployments
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