Skip to content

feat(mcp): stream progress notifications for long-running tools #1616

Description

@ryzizub

Summary

Explore streaming MCP notifications/progress from long-running tools (test, packages_get, packages_check_licenses) so clients can show live progress while a command runs, instead of only seeing output once the tool returns.

Background

#1612 captures a command's in-process mason Logger output and returns it in CallToolResult.content. That is the reliable way to get diagnostics to the agent, because the tool result is what every client feeds back to the model.

Progress notifications are a complementary, optional UX layer on top of that — not a replacement.

Proposal

When a client includes a progressToken in a request's _meta, the server emits notifications/progress as the command runs (e.g. test counts, "Optimizing tests…", per-package steps). The MCP spec (2025-03-26+) allows an optional human-readable message field alongside progress/total.

Over the stdio transport these are valid JSON-RPC messages on the same stdout stream, so they do not conflict with the "no non-MCP content on stdout" constraint that motivated #1612 (raw logger text broke it; structured notifications are the correct channel).

Caveats / open questions

  • Only allowed when the client supplies a progressToken; otherwise the server must stay silent.
  • Progress is primarily a UX signal. Many clients render it as a spinner/bar for the human and do not inject it into the model's context, so the agent may never read it. Keep the final result (fix(mcp): surface command output and run tools in the requested directory #1612) as the source of truth.
  • Streaming is fire-and-forget with no ordering guarantee relative to the final result.
  • Need to confirm whether the dart_mcp server package exposes a helper for sending progress notifications, or whether we'd send raw notifications ourselves.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions