Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

MCP background task progress stalls after the original request closes

AI summary

A local test using Streamable HTTP and MCP SDK 1.30 found that notifications/progress reached the client for only one of five background task steps because the originating request connection had closed. The author showed that updating statusMessage and polling tasks/get retrieved all five steps, while callToolStream surfaced four of five updates. These results apply to the tested local configuration, and the author notes that behavior may differ under other transports and timing conditions.

In-depth insight

Developers building MCP task interfaces can use the reported results to avoid relying on background notifications tied to a closed request and choose polling for more reliable step-level progress.

上一篇结尾我写了句话:写架构建议的时候最危险的一句话就是"代价不大",因为说这话的人通常没量过。

那篇量完,长任务这条线我以为是收尾了:任务原语解决超时和取消,持久化解决重启,拆解的账也算清楚了。三个问题,三个答案。

直到有个读者问我:任务跑了半分钟,界面上什么都没有,用户怎么知道它没死?

我愣了一下。前面三篇全在讲服务端怎么把任务跑完,没有一篇讲用户怎么看它跑到哪了。这是个更基础的问题——一个跑 30 秒的任务,哪怕最后结果完全正确,只要中间 30 秒没有任何反馈,用户的第一反应就是"卡了",然后刷新、重复提交、关掉页面。

这篇就把进度这件事实测一遍。结论先放这:进度通知在普通工具上是好的,换到任务原语上会只显示五分之一——而这恰恰是最需要进度条的场景。

进度通知不长在工具返回里

先说机制。MCP 的进度不是工具返回值的一部分,是一条独立的 JSON-RPC 通知:notifications/progress。

#Model Context Protocol#MCP SDK 1.30#Streamable HTTP#tasks/get#callToolStream#statusMessage#notifications/progress

Original · 11 min readRead the original
Group chat

No comments yet. Start the conversation.