History

Revert the outbound MCP SDK v2 migration (#1697)

* Revert the outbound MCP SDK v2 migration * Drop the v2 MCP packages from the lockfile

Rhys Sullivan committed 2 months ago

Commit a5800a11 parent 54cde5e91 files · +5838 −10032Browse files

Showing the changes to apps/cloud/src/server.ts (1 of 91 files). Show all

Unified · Split

apps/cloud/src/server.ts+10−9
@@ -17,10 +17,7 @@ import { passthroughResponse } from "./edge/passthrough"; · 16 unmodified lines
17import { makeCloudMcpAgentHandler } from "./mcp/agent-handler";17import { makeCloudMcpAgentHandler } from "./mcp/agent-handler";
18import { classifyMcpPath, prepareMcpOrgScope } from "./mcp/mount";18import { classifyMcpPath, prepareMcpOrgScope } from "./mcp/mount";
19import { parseTraceparent } from "./mcp/traceparent";19import { parseTraceparent } from "./mcp/traceparent";
20import {20import { McpSessionDOSqlite as McpSessionDOBase } from "./mcp/session-durable-object";
21 makeCloudModernMcpServerBuilder,
22 McpSessionDOSqlite as McpSessionDOBase,
23} from "./mcp/session-durable-object";
24import {21import {
25 beforeSendWithOtelCorrelation,22 beforeSendWithOtelCorrelation,
26 captureCause,23 captureCause,
@@ -187,10 +184,7 @@ const traceCloudMcpRequest = async ( · 160 unmodified lines
187 );184 );
188};185};
189 186
190const mcpAgentHandler = makeCloudMcpAgentHandler({187const mcpAgentHandler = makeCloudMcpAgentHandler();
191 makeModernServerBuilder: makeCloudModernMcpServerBuilder,
192 traceRequest: traceCloudMcpRequest,
193});
194 188
195// ---------------------------------------------------------------------------189// ---------------------------------------------------------------------------
196// Isolate lifecycle signals190// 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 UI271 // Join the caller's W3C trace when the request carries one — the web UI