History

Harden requestState binding, add inbound rollback switch, fix CLI bridge era handling

Rhys Sullivan committed 2 months ago

Commit ce870831 parent c25ace226 files · +556 −83Browse files

Showing the changes to apps/cloud/src (2 of 26 files). Show all

Unified · Split

2 files
  1. apps/cloud/src/env-augment.d.ts +2 −0
  2. apps/cloud/src/mcp/agent-handler.ts +4 −0
apps/cloud/src/env-augment.d.ts+2−0
@@ -69,6 +69,8 @@ declare global { · 68 unmodified lines
6969 MCP_PAUSED_SESSION_IDLE_TIMEOUT_MS?: string;
7070 /** HMAC key for MCP 2026-07-28 continuation state (32+ byte secret). */
7171 MCP_REQUEST_STATE_KEY?: string;
72+ /** Emergency rollback for inbound MCP 2026-07-28 traffic only. */
73+ MCP_2026_07_28_ENABLED?: string;
7274 NODE_ENV?: string;
7375
7476 // Shared with frontend
apps/cloud/src/mcp/agent-handler.ts+4−0
@@ -4,6 +4,7 @@ import { Effect, Predicate } from "effect"; · 3 unmodified lines
44 import {
55 McpAuthProvider,
66 jsonRpcErrorBody,
7+ mcpModernDisabledResponse,
78 defaultMcpResource,
89 UNAVAILABLE_RETRY_AFTER_SECONDS,
910 type AuthOutcome,
@@ -174,6 +175,9 @@ export const makeCloudMcpAgentHandler = () => { · 164 unmodified lines
174175 const parsedBody = await Effect.runPromise(requestBodyFromRequest(request));
175176 const era = await classifyMcpProtocolEra(request, parsedBody);
176177 if (era === "modern") {
178+ if (env.MCP_2026_07_28_ENABLED === "false") {
179+ return mcpModernDisabledResponse();
180+ }
177181 const resource = resourceFromPath(request);
178182 const props = await runTraced(
179183 request,