Streaming tool responses for long-running calls
A database query over a large table or a report-generating REST endpoint can take tens of seconds. Today the MCP client waits with no signal, and some clients time out before the upstream does.
Scope
- Stream partial results over the existing Streamable HTTP transport where the upstream supports chunked responses.
- Emit MCP progress notifications for calls over a threshold so the client can show something.
- A per-tool timeout that fails with a readable error instead of hanging.
This needs a decision first: which of the three (progress notifications, partial content, timeout) is worth doing alone. Comments welcome before anyone writes code.
Per-tool REST timeouts landed in #1378. Once OneNote is wrapped up, would a small SSE progress PR be useful? I would limit it to calls with a progress token, report elapsed time, and clean up on success, failure or cancellation. JSON responses would stay unchanged; partial results would be separate. Tests would cover both response modes and timer cleanup.
Yes, please, once OneNote is done. The scope you describe fits: progress only when the client sends a progress token, elapsed time only, plain JSON responses unchanged, and timers cleared on success, failure and cancellation. Please keep partial results out of this PR, and add a test that a cancelled call leaves no timer running.
OneNote is merged now. I will pick this up with the agreed progress-only scope and cancellation cleanup tests.