@devries-cameron20 / t3code-1 / commits / c09c235129
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): preserve ambient Cursor MCP servers (#15875)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Arav Jain committed Oct 11, 2026 at 12:05 UTC c09c235129c1581f92a4f6e30470461cf7777f05
2 files changed +15 -1
packages/provider-cursor/src/server/adapter.test.ts
+14
@@ -55,6 +55,17 @@ describe("CursorAdapterV2", () => {
55 });
56 const instanceId = ProviderInstanceId.make("cursor");
57 const threadId = ThreadId.make("cursor-lifecycle-thread");
58 + const mcpSessions = yield* McpProviderSessions.McpProviderSessions;
59 + yield* mcpSessions.set({
60 + environmentId: EnvironmentId.make("cursor-lifecycle-environment"),
61 + threadId,
62 + providerSessionId: "cursor-lifecycle-session",
63 + providerInstanceId: instanceId,
64 + endpoint: "http://127.0.0.1:43123/mcp",
65 + authorizationHeader: "Bearer synthetic-cursor-token",
66 + browserToolsAvailable: true,
67 + });
68 + let sentWithMcpOverride = true;
69 const modelSelection = { instanceId, model: "composer-2.5" };
70 const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
71 runtimeMode: "full-access",
@@ -75,6 +86,7 @@ describe("CursorAdapterV2", () => {
86 close: Effect.void,
87 send: (input) =>
88 Effect.gen(function* () {
89 + sentWithMcpOverride = Object.hasOwn(input.options ?? {}, "mcpServers");
90 // Recorded Cursor task calls (see fixtures/subagent) stream a
91 // partial-tool-call before tool-call-started with the same args.
92 // The run then ends without tool-call-completed, which a live
@@ -184,6 +196,8 @@ describe("CursorAdapterV2", () => {
196 Stream.takeUntil((event) => event.type === "turn.terminal"),
197 Stream.runCollect,
198 );
199 + // Keep injected MCP at agent creation so sends preserve Cursor's ambient servers.
200 + assert.isFalse(sentWithMcpOverride);
201 const rows = events.filter((event) => event.type === "subagent.updated");
202 assert.equal(rows[0]?.subagent.status, "running");
203 assert.equal(rows[0]?.subagent.model, model ?? null);
packages/provider-cursor/src/server/adapter.ts
+1 -1
@@ -2206,12 +2206,12 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
2206 const message = yield* resolveUserMessage(turnInput, mcpServers);
2207 const pendingUpdates: Array<InteractionUpdate> = [];
2208 let context: ActiveCursorTurn | null = null;
2209 + // MCP send overrides replace the ambient servers loaded when the agent opens.
2210 const sdkRun = yield* agent.session.send({
2211 message,
2212 options: {
2213 model: cursorSdkModelSelection(turnInput.modelSelection),
2214 mode: turnInput.runtimePolicy.interactionMode === "plan" ? "plan" : "agent",
2214 - ...(mcpServers === undefined ? {} : { mcpServers }),
2215 },
2216 onDelta: (update) => {
2217 if (context === null) {