Skip to content

MCP protocol lacks a mechanism for tools to stream incremental results #2932

Open

Description

@fy2ne

The current tool call flow in MCP is strictly request-response. A client sends tools/call and waits for a full response. For long-running tools this means the client sees nothing until the tool completes completely. This is inconsistent with how MCP already handles prompt/message streaming via SSE. Tools should have a similar streaming capability. A practical approach: add a notifications/tool/progress message that servers can emit during tool execution. Include a progress percentage and optional intermediate result chunks. The final tools/call response is still the authoritative result. This would let clients show progress for slow tools, stream search results as they arrive, and enable progressive rendering. The change is fully backward compatible.

Activity

  1. kuwatly commented on Jun 21, 2026

    @kuwatly

    Adding a concrete use case from MCP Apps: apps render UI in an iframe and currently only see tool-input-partial followed by the final tool-result for a given tools/call. For a 10+ second rendering or search agent, the app has effectively zero visibility into progress during that window. The only practical workaround today is to poll a separate status tool repeatedly, which is token-expensive and also requires explicit LLM cooperation to keep that polling wired into the call graph.

    MCP already defines notifications/progress plus a progressToken mechanism, but the spec focuses on numeric progress, totals, and human-readable messages rather than structured partial results. From the MCP Apps perspective, what is missing is a standard, interoperable way to stream intermediate tool outputs (for example, partial search results or incremental render state) during a single long-running tools/call, not just a percentage or status string.

    Two scoping questions:

    1- Would SEP-2632 (Structured Content for Progress Notifications) be considered the right place to address this, assuming we define a standard schema for partial tool results carried inside notifications/progress payloads? Or is the intent here closer to a dedicated partial tool result notification type that sits alongside tool-input-partial and tool-result with clearer semantics for incremental chunks?

    2- Is the intent for this proposal to act as a lighter-weight option compared to the Tasks extension / SEP-2663, for tools that do not need a full task lifecycle handle and out-of-band task management, but do need incremental output during a single synchronous tools/call?

    Happy to help iterate on a concrete shape for progress plus partial-result payloads. The MCP Apps iframe-UI scenario is a strong motivator here, because polling-based approaches are particularly expensive and awkward in that environment compared to a single tools/call with structured streaming notifications.

  2. fy2ne commented on Jun 21, 2026

    @fy2ne
    Author

    Thanks for the thorough feedback @kuwatly the MCP Apps iframe-UI scenario is the absolute perfect example of why this is needed. Polling is definitely too heavy and awkward for tracking inline execution state.

    To answer your scoping questions:

    1. Regarding SEP-2632 vs. a dedicated notification type:
      I think addressing this within the scope of SEP-2632 makes a lot of sense, provided we can establish a standardized schema for intermediate payload delivery. If a standard notifications/progress payload can carry explicit chunk types (like a delta chunk or an incremental UI state array), it preserves backward compatibility beautifully. It allows existing clients to gracefully ignore the rich chunks if they don't support them, while allowing advanced clients/iframes to progressively render the data.

    2. Regarding Tasks Extension (SEP-2663):
      Yes, the intent here is absolutely to provide a lighter-weight, synchronous alternative. SEP-2663 is excellent for asynchronous, durable background jobs that require complete task management (pause, resume, out-of-band polling). However, for standard synchronous tool calls that take 5-15 seconds (like web scraping, complex API aggregations, or live streaming search results), spinning up an entire asynchronous state machine is overkill. We need a way to keep the execution bound to a single synchronous tools/call loop while gaining the UX benefits of a live stream.

    I'd be more than happy to collaborate on defining a concrete shape for these progress payloads!

  3. arsalanhashmi-path commented on Jun 22, 2026

    @arsalanhashmi-path

    What does a client do when chunks arrive out of order? In a streaming search scenario where results come back asynchronously, clients need either an explicit sequence number on each chunk or a defined merging strategy. Without that, progressive rendering becomes implementation-specific and the interoperability goal breaks.
    Happy to test whatever shape this lands on against 4 of my personal projects.
    The core test project is here: https://gullak-mvp-xi.vercel.app

  4. kuwatly commented on Jun 24, 2026

    @kuwatly

    Thanks for your thorough reply @fy2ne

    I agree on both points. One additional dimension worth raising: the A2UI protocol (Google's declarative agent-to-UI protocol) has already solved the “what shape should partial UI updates take?” problem via its streaming JSONL design, especially surfaceUpdate (incremental component tree updates) and dataModelUpdate (data‑model patches for bound state), both of which are explicitly designed for progressive rendering as each message arrives.

    When A2UI runs inside an MCP App iframe, the gap this issue is targeting becomes even more concrete. The A2UI renderer in the iframe is built to consume an incremental JSONL stream, but today the MCP host only streams tool-input-partial (LLM‑generated arguments) and then sends a single tool-result at the end, so the renderer is effectively starved of exactly the intermediate data it was designed to process incrementally.

    That suggests the content payload shape for the extended progress/notification messages (as discussed in SEP-2632) could align directly with what A2UI already expects: structured, typed chunks (component tree deltas via surfaceUpdate and data‑model patches via dataModelUpdate) that the iframe’s A2UI renderer can apply incrementally with minimal bridging logic. The MCP host would simply forward each notifications/progress payload to the iframe as a tool-output-partial/UI notification, and the A2UI message processor would treat each chunk just like the next line in a JSONL stream. This give us native, progressive UI updates over the new MCP streaming channel.

  5. fy2ne commented on Jun 24, 2026

    @fy2ne
    Author

    Good callout, and I think the A2UI parallel is genuinely useful here not because MCP should bake in a specific UI framework's wire format, but because it's a working example that the "structured typed chunks" approach is viable in practice for incremental rendering. I'd rather frame SEP-2632's payload as a generic envelope (sequence number + chunk type + opaque chunk data) than hardcode surfaceUpdate/dataModelUpdate semantics into the spec itself. That way A2UI-based renderers can map their JSONL chunks straight into it, but it's not coupled to one vendor's protocol.

    That also ties back to @arsalanhashmi-path's ordering question if every chunk carries an explicit monotonic sequence number scoped to the progressToken, clients/iframes can buffer and reorder before applying, regardless of whether the payload inside is A2UI-shaped or something else. Without that, yeah, this becomes implementation-specific fast.

    Could sketch a minimal schema (seq, chunkType, data) as a strawman in SEP-2632 if that's useful happy to take a first pass.

  6. lizzyly7 commented on Jul 2, 2026

    @lizzyly7

    We've been running a production MCP gateway with streaming tool results for 6+ months. Here's what we've learned and a concrete proposal.

    Problem

    ClientSession.call_tool() blocks until the complete CallToolResult is assembled. The Streamable HTTP transport does receive SSE events, but the session layer buffers them in a memory stream and only returns the final assembled result — intermediate chunks are silently consumed and never exposed to the caller.

    For tools that take 3-8 seconds (search, report generation), this means the user sees nothing until the tool finishes completely.

    What We Built

    We bypass call_tool() and read the raw SSE stream directly. The approach:

    1. Send standard tools/call JSON-RPC over HTTP POST with SSE Accept header
    2. Read data:` lines as they arrive** — each line may be a progress notification, an intermediate content chunk, or the final JSON-RPC response
    3. Forward chunks to a ContextVar sink — a per-request asyncio.Queue that the SSE layer drains and pushes to the frontend in real time
    4. Accumulate the final result — when the stream ends, concatenated content is returned as a standard result dict, compatible with non-streaming consumers

    Core pattern:

    # Per-request sink for real-time chunk forwarding
    _sse_chunk_sink: ContextVar[asyncio.Queue | None] = ContextVar(
    "_sse_chunk_sink", default=None
    )
    # In the SSE read loop:
    async for raw_line in resp.aiter_lines():
    line = raw_line.strip()
    if not line.startswith("data:"):
    continue
    payload = line[5:].strip()
    if payload == "[DONE]":
    break
    msg = json.loads(payload)
    text = _extract_mcp_tool_result(msg)
    if text:
    # 1. Forward to frontend via ContextVar sink (real-time)
    _push_chunk_to_sink(tool_name, text)
    # 2. Accumulate for final result
    chunks.append(text)
    # Non-streaming tools: break on first "id" response
    # Streaming tools: keep reading until [DONE]
    if "id" in msg and not is_streaming_tool:
    break
    # Final assembled result
    full_content = "".join(chunks)

    Measured Impact

    Metric | Non-streaming (call_tool) | Streaming (our approach) -- | -- | -- Time to first byte | 2-5s (full tool execution) | ~200ms (first SSE chunk) Frontend progressive render | No (blank until complete) | Yes (results appear incrementally) Long-running tool UX | Blocking spinner | Progressive content reveal

    For search and report generation tools, streaming is the difference between a responsive and a broken-feeling UX.

    Protocol Proposal

    1. New notification: notifications/tool/progress

    {
    "jsonrpc": "2.0",
    "method": "notifications/tool/progress",
    "params": {
    "toolName": "search_kb",
    "progress": 0.5,
    "total": null,
    "message": "Searching...",
    "contentChunk": {
    "type": "text",
    "text": "Found 3 documents matching query..."
    }
    }
    }
    • contentChunk is optional — servers that only report progress (no intermediate content) can omit it
    • contentChunk follows the existing ContentBlock type for consistency
    • The final tools/call response remains the authoritative result
    • Fully backward compatible — clients that don't handle this notification simply ignore it

    2. SDK API: call_tool_streaming()

    async def call_tool_streaming(
    self,
    name: str,
    arguments: dict[str, Any] | None = None,
    ) -> AsyncIterator[ToolProgressEvent | CallToolResult]:
    """
    Like call_tool, but yields intermediate progress events.
    The final yielded item is always a CallToolResult.
    """

    This mirrors the existing progress_callback but uses an async iterator, which composes better with async for.

    3. Relationship to Tasks (SEP-1686)

    Tasks solve a different problem — asynchronous execution with status polling. Our use case is synchronous execution with streaming content delivery. They're complementary:

    • Tasks: Tool runs for minutes/hours → poll status → retrieve result later
    • Streaming: Tool runs for seconds → see content chunks in real-time → get final result when done

    What We Can Contribute

    We have 6+ months of production traffic on SSE streaming tool results, including:

    • A working httpx-based SSE streaming client with session management (TTL, error-driven eviction)
    • A ContextVar-based chunk forwarding pattern tested under concurrent multi-tool dispatch
    • Real-world data on TTFB improvements and frontend progressive rendering

    Happy to contribute a reference implementation or write a SEP if there's interest in moving this forward.

  7. fy2ne commented on Jul 2, 2026

    @fy2ne
    Author

    This is incredible data, @lizzyly7. The TTFB drop from 2-5s to ~200ms is exactly the production proof this feature needs.
    Your protocol proposal aligns perfectly with the consensus we've been building above. Utilizing the existing notifications/tool/progress but allowing an optional contentChunk keeps it fully backward-compatible while solving the exact UX bottleneck you measured.
    To move this forward quickly, I would love to co-author this SEP with you.
    How about we split the initial draft like this:

    1. The Protocol Spec: I will fork the repo and open a Draft PR containing the JSON schema updates and Markdown specification changes for notifications/tool/progress and contentChunk (incorporating the monotonic seq ordering for safety).
    2. The Reference Implementation: You can link your call_tool_streaming() Python implementation alongside it to prove it works in practice.

    Let me know if that works for you! I can get the schema PR drafted immediately so we have a concrete diff to look at.

  8. lizzyly7 commented on Jul 2, 2026

    @lizzyly7

    That split works perfectly. Go ahead with the schema PR — happy to review it once it's up.

    On my side, I'll prepare the reference implementation. To be precise about what we currently have in production:

    1. Standalone SSE streaming client — a module-level async function that sends standard tools/call JSON-RPC over raw httpx and reads data: lines via resp.aiter_lines(). It bypasses the SDK's ClientSession.call_tool() entirely, because the SDK's transport layer buffers SSE events into a memory stream and only returns the fully assembled CallToolResult. For the reference implementation, I'd adapt this into a proper ClientSession.call_tool_streaming() method that hooks into the existing transport rather than replacing it.

    2. ContextVar chunk forwarding — a per-request asyncio.Queue (_sse_chunk_sink) that receives intermediate chunks via _push_chunk_to_sink(), tested under concurrent multi-tool dispatch where multiple tools stream simultaneously in the same request.

    3. Session resilience — per-endpoint session cache with TTL-based eviction (30min) + error-driven invalidation on HTTP 400/404/409/410, which we've found essential for production reliability.

    A couple of design notes for the schema side:

    • We distinguish streaming tools (keep reading until [DONE] or stream close, ignore intermediate id responses) from non-streaming tools (break on first id response). The contentChunk approach works for both — non-streaming tools simply never emit progress notifications.
    • On the seq ordering — we hit out-of-order chunks in production under concurrent tool dispatch. Our fix was routing by tool_use_id rather than a sequence number, but a monotonic seq per tools/call request would be a cleaner protocol-level solution.

    I'll start preparing the implementation alongside your schema PR. Feel free to @ me when the draft is up, and I'll align the Python API with whatever shape the spec settles on.

  9. fy2ne commented on Jul 2, 2026

    @fy2ne
    Author

    hey @lizzyly7 ,I reforked and redid the schema work from scratch. The previous PR got closed bc i accidentally used Copilot's fix suggestion, which violates the AI policy, my bad, lesson learned.
    Changes on branch streaming-tool of my fork:

    • schema/draft/schema.ts — added seq?: number + contentChunk?: ContentBlock to ProgressNotificationParams
    • schema/draft/examples/ProgressNotificationParams/progress-with-content-chunk.json example
    • docs/specification/draft/server/tools.mdx — streaming flow documented with code examples + mermaid diagram
      I also invited you as a collaborator on fy2ne/modelcontextprotocol (write access). Accept the invite at https://github.com/fy2ne/modelcontextprotocol/invitations and you can push your call_tool_streaming() reference implementation directly to the same branch. Once both pieces are in, I'll open the Draft PR.
  10. ServeurpersoCom commented on Nov 14, 2026

    @ServeurpersoCom

    Streaming tool results has been asked for since #117 (December 2024), and SEP-2998 was closed in September only so that new SEPs go through a Working Group, so here is a working implementation of SEP-2998 as drafted, in daily use: the client declares partialResults in the clientCapabilities of its request and names a partialResultToken in _meta, the server streams notifications/tools/partial_result (token, seq, text content) on the stream of that tools/call, and the final CallToolResult stays whole and the only thing the model reads.

    It runs on both sides: mcp.js, a Node.js server on the official TypeScript SDK v2, streams its sandbox shell line by line, and KiSS, a web agent harness with a C++ backend (MCP server and client) and a Svelte frontend (MCP client on the SDK), consumes it and streams its own shells the same way. No SDK change was needed: ctx.mcpReq.notify on the server and fallbackNotificationHandler on the client are enough.

    It is backward compatible both ways. A server that does not know the extension ignores the unknown capability and _meta key and just returns its result, and a client that does not declare it gets no notification at all, so neither side can tell the difference.

    It also composes with cancellation as the 2026-07-28 revision defines it: closing the stream of the call ends the tool, and the client keeps the output it already received.

    Now that the Tasks and Events Working Group exists (SEP-3440), is it the right place to bring SEP-2998 back with this implementation?

  11. fy2ne commented on Nov 14, 2026

    @fy2ne
    Author

    Yes, the Tasks and Events WG is the right place to push this forward now that SEPs go through WGs.

    I'm not actively pushing my draft PR anymore, so feel free to take the lead on driving a unified proposal there. Just make sure whatever shape goes into the WG accounts for structured payloads (like MCP Apps / UI chunks, not just plain text) and monotonic seq ordering those were the main requirements @kuwatly and @lizzyly7 flagged in this thread. Good luck getting it merged!

  12. ServeurpersoCom commented on Nov 14, 2026

    @ServeurpersoCom

    Thanks @fy2ne, happy to take it from here!

    I'll first test the whole thing in my own project, including structured payloads (MCP Apps / UI chunks, not just plain text) and monotonic seq ordering, so the requirements raised by @kuwatly and @lizzyly7 are covered.

    Once it's validated end to end, I'll send the work to the Tasks and Events WG as a unified proposal, with the goal of bringing it into llama.cpp: llama-ui, its web UI, has an MCP client that would directly benefit, and the server backend could likely follow too, since I already have the full implementation in C++.

  13. kuwatly commented on Nov 17, 2026

    @kuwatly

    Thanks @ServeurpersoCom, great to see this moving, and thanks @fy2ne for the handoff. Since I opened SEP-2998, I'd like to co-author the unified proposal for the WG.

    Two things I can bring:

    1. The MCP Apps side. Partial results in core only help apps if the host forwards them into the iframe. In the current MCP Apps spec (2026-01-26), a View gets ui/notifications/tool-input-partial and then nothing until ui/notifications/tool-result. I'll open an issue on ext-apps this week proposing a companion host-to-View notification (something like ui/notifications/tool-result-partial, mirroring tool-input-partial), and follow with the spec change once the core shape settles, so the two stay aligned.

    2. A structured-payload test case. I can run mcp.js with A2UI v1.0 messages as chunks (updateComponents / updateDataModel, one message per chunk, rendered in an MCP Apps View) and share ordering and latency results. Where does the partial-result code live in the repo?

    Two inputs for the proposal:

    • Resume, not just ordering. 2026-07-28 removed Last-Event-ID resumability, so a dropped stream loses the call. Could seq also let a client resume from the last chunk it applied? agents-wg#26 frames this as snapshot-plus-cursor versus append-only chunks, and the Tasks extension has no intermediate output today, so it would be good to settle it in one place.

    • Any ContentBlock, not only text. That's what SEP-2998 specified and what @lizzyly7 proposed above for contentChunk, and it's what UI chunks need.

  14. ServeurpersoCom commented on Nov 18, 2026

    @ServeurpersoCom

    Thanks @ServeurpersoCom, great to see this moving, and thanks @fy2ne for the handoff. Since I opened SEP-2998, I'd like to co-author the unified proposal for the WG.

    Two things I can bring:

    1. **The MCP Apps side.** Partial results in core only help apps if the host forwards them into the iframe. In the current MCP Apps spec (2026-01-26), a View gets `ui/notifications/tool-input-partial` and then nothing until `ui/notifications/tool-result`. I'll open an issue on ext-apps this week proposing a companion host-to-View notification (something like `ui/notifications/tool-result-partial`, mirroring `tool-input-partial`), and follow with the spec change once the core shape settles, so the two stay aligned.
    
    2. **A structured-payload test case.** I can run mcp.js with A2UI v1.0 messages as chunks (`updateComponents` / `updateDataModel`, one message per chunk, rendered in an MCP Apps View) and share ordering and latency results. Where does the partial-result code live in the repo?
    

    Two inputs for the proposal:

    * **Resume, not just ordering.** 2026-07-28 removed `Last-Event-ID` resumability, so a dropped stream loses the call. Could `seq` also let a client resume from the last chunk it applied? agents-wg#26 frames this as snapshot-plus-cursor versus append-only chunks, and the Tasks extension has no intermediate output today, so it would be good to settle it in one place.
    
    * **Any `ContentBlock`, not only text.** That's what SEP-2998 specified and what [@lizzyly7](https://github.com/lizzyly7) proposed above for `contentChunk`, and it's what UI chunks need.
    

    @kuwatly The main use case driving this on my side is an agentic dev/build/test loop steered closely by a human, with the tool output rendered as a live terminal in a web UI: when the agent runs a long build or test suite, you follow it as it happens and can stop or redirect it right away. In my experience that is the most effective way to work with AI today, and a web page does it far better than a CLI, since a whole long context stays one scroll of the mouse wheel away. It is what I built in my own MCP server and web agent harness to try SEP-2998.

    Streamed text tool output already has a real use (a live terminal inside a live LLM web page), but I don't see a concrete one for streamed structured partials yet. Do you have an idea what they would be used for?

    Text output streams naturally because it only appends, but a structured value cannot be appended to, it gets updated: each partial would either have to resend the whole value, or carry a delta whose merge rules the spec would then have to define, like the delta chunks of OpenAI-compatible LLM streaming APIs.

    Looking into it -> I saw that arrays can be extended and that a UI can be updated incrementally, I guess that is the goal?

    -> Edited a few times: I had trouble putting what I meant into English.

  15. girishkvs commented on Dec 3, 2026

    @girishkvs

    @kuwatly / @ServeurpersoCom On settling it in one place - I have a draft SEP for a running task's output, modelcontextprotocol/ext-tasks#38, built on Events (SEP-3415) so Tasks doesn't get a second output channel. For structured partials, its payload is the whole current view with a revision, and clients replace by revision, so there are no delta merge rules. That covers the task case. A stream on a plain tools/call is what your proposal adds, so I think it would help to say in the WG how the two fit together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions