* Revert the outbound MCP SDK v2 migration * Drop the v2 MCP packages from the lockfile
Showing the changes to apps/cloud/src/server.ts (1 of 91 files). Show all
Unified · Split
| @@ -17,10 +17,7 @@ import { passthroughResponse } from "./edge/passthrough"; · 16 unmodified lines | |||
| 17 | import { makeCloudMcpAgentHandler } from "./mcp/agent-handler"; | 17 | import { makeCloudMcpAgentHandler } from "./mcp/agent-handler"; |
| 18 | import { classifyMcpPath, prepareMcpOrgScope } from "./mcp/mount"; | 18 | import { classifyMcpPath, prepareMcpOrgScope } from "./mcp/mount"; |
| 19 | import { parseTraceparent } from "./mcp/traceparent"; | 19 | import { parseTraceparent } from "./mcp/traceparent"; |
| 20 | import { | 20 | import { McpSessionDOSqlite as McpSessionDOBase } from "./mcp/session-durable-object"; |
| 21 | makeCloudModernMcpServerBuilder, | ||
| 22 | McpSessionDOSqlite as McpSessionDOBase, | ||
| 23 | } from "./mcp/session-durable-object"; | ||
| 24 | import { | 21 | import { |
| 25 | beforeSendWithOtelCorrelation, | 22 | beforeSendWithOtelCorrelation, |
| 26 | captureCause, | 23 | captureCause, |
| @@ -187,10 +184,7 @@ const traceCloudMcpRequest = async ( · 160 unmodified lines | |||
| 187 | ); | 184 | ); |
| 188 | }; | 185 | }; |
| 189 | 186 | ||
| 190 | const mcpAgentHandler = makeCloudMcpAgentHandler({ | 187 | const mcpAgentHandler = makeCloudMcpAgentHandler(); |
| 191 | makeModernServerBuilder: makeCloudModernMcpServerBuilder, | ||
| 192 | traceRequest: traceCloudMcpRequest, | ||
| 193 | }); | ||
| 194 | 188 | ||
| 195 | // --------------------------------------------------------------------------- | 189 | // --------------------------------------------------------------------------- |
| 196 | // Isolate lifecycle signals | 190 | // Isolate lifecycle signals |
| @@ -264,7 +258,14 @@ const cloudflareHandler: ExportedHandler<Env> = { · 67 unmodified lines | |||
| 264 | // to pass authenticated session props into the hibernatable DO. | 258 | // to pass authenticated session props into the hibernatable DO. |
| 265 | // Discovery docs still flow through the app-level MCP envelope. | 259 | // Discovery docs still flow through the app-level MCP envelope. |
| 266 | const forwarded = prepareMcpOrgScope(request); | 260 | const forwarded = prepareMcpOrgScope(request); |
| 267 | return mcpAgentHandler(forwarded, env, ctx); | 261 | // /mcp leaves the Effect app for the Agents bridge, so no downstream |
| 262 | // HttpMiddleware.tracer opens the request envelope — this worker span is | ||
| 263 | // THE `http.server` span for MCP traffic, and its context is stamped onto | ||
| 264 | // the forwarded traceparent so the agent handler and session DO parent | ||
| 265 | // under it instead of exporting orphaned roots. | ||
| 266 | return traceCloudMcpRequest(forwarded, env, ctx, (tracedRequest) => | ||
| 267 | Promise.resolve(mcpAgentHandler(tracedRequest, env, ctx)), | ||
| 268 | ); | ||
| 268 | } | 269 | } |
| 269 | const tracingInstalled = installTracerProvider(); | 270 | const tracingInstalled = installTracerProvider(); |
| 270 | // Join the caller's W3C trace when the request carries one — the web UI | 271 | // Join the caller's W3C trace when the request carries one — the web UI |