docs(cloudflare): Recommend span streaming for MCP - #19057
Conversation
Cloudflare MCP work can outlive the HTTP response. Document stream mode as the supported way to retain those spans, while keeping forceTransaction as the static-lifecycle fallback. Co-Authored-By: OpenAI Codex <codex@openai.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c549a0a to
6c74833
Compare
6c74833 to
83fb57c
Compare
83fb57c to
f7e2413
Compare
f7e2413 to
ea01e43
Compare
ea01e43 to
736ed33
Compare
Place MCP Monitoring alongside Agent Tracing across supported JavaScript guides and document the explicit server wrapper required for instrumentation. Keep Cloudflare span streaming as a separate delivery setting. Co-Authored-By: OpenAI Codex <codex@openai.com>
736ed33 to
0b580dd
Compare
|
|
||
| ## Custom Instrumentation | ||
|
|
||
| If you're not using a supported MCP SDK, create spans with the names and data attributes described below. |
There was a problem hiding this comment.
Is it common for us to have this type of recommendation listed in all JS frameworks? I would assume we'd have it in the browser one perhaps? Or maybe I'm misunderstanding what we're trying to say here.
If I'm on a selected SDK, and we support it, this is a confusing thing to be reading. I'm also assuming I can use these attributes even in supported SDKs?
@betegon , can you help clarify and I can make a suggestion for rewording?
There was a problem hiding this comment.
hmm great question. i'm not sure if this is common, i'll look it up. there's a bunch of official (from anthropic) MCP SDKs. we support JS and Python for now, there's GO, PHP and some more.
>if I'm on a selected SDK, and we support it, this is a confusing thing to be reading. I'm also assuming I can use these attributes even in supported SDKs?
fair, you shouldn't use it if you're in a supported SDK, although maybe you want? say you just want to record a couple of span attributes yourself.
thanks for looking a this btw!
|
yes! looking at your comment to make those things as clear as possible |
DESCRIBE YOUR PR
Cloudflare MCP work can finish after the Worker returns its HTTP response. In the static trace lifecycle, those late spans depend on a transaction snapshot that may already have been sent.
We verified this with two deployed Cloudflare Workers running byte-identical MCP
2026-07-28bundles against the published JavaScript SDK.traceLifecycle: "static"lost the late child, whiletraceLifecycle: "stream"recorded it exactly once with the MCP operation as its parent.This promotes MCP Monitoring to a top-level platform feature alongside Agent Tracing across supported JavaScript guides. Each framework page now shows the required
wrapMcpServerWithSentrysetup directly, including the runtime-specific imports for Hono. The Cloudflare page makes clear that wrapping the MCP server enables MCP instrumentation, whiletraceLifecycle: "stream"controls how the resulting spans are delivered. The Agent Tracing overview keeps its contextual MCP link, and the previous Tracing → Instrumentation → Instrument MCP Servers URL redirects to the new feature route.The general Cloudflare
waitUntil()limitation now recommends stream mode first.forceTransactionremains documented as the fallback for applications that need to keep the static lifecycle.Related to getsentry/sentry-javascript#23427.
IS YOUR CHANGE URGENT?
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST