anythingmcp icon indicating copy to clipboard operation
anythingmcp copied to clipboard

Streaming tool responses for long-running calls

Open helpcodeai opened this issue 1 month ago • 3 comments

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.

helpcodeai avatar Oct 10 '26 10:10 helpcodeai

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.

Coding-Professional avatar Nov 24 '26 13:11 Coding-Professional

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.

helpcodeai avatar Nov 25 '26 08:11 helpcodeai

OneNote is merged now. I will pick this up with the agreed progress-only scope and cancellation cleanup tests.

Coding-Professional avatar Nov 27 '26 17:11 Coding-Professional