Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/provider-cursor/src/server/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ describe("CursorAdapterV2", () => {
});
const instanceId = ProviderInstanceId.make("cursor");
const threadId = ThreadId.make("cursor-lifecycle-thread");
const mcpSessions = yield* McpProviderSessions.McpProviderSessions;
yield* mcpSessions.set({
environmentId: EnvironmentId.make("cursor-lifecycle-environment"),
threadId,
providerSessionId: "cursor-lifecycle-session",
providerInstanceId: instanceId,
endpoint: "http://127.0.0.1:43123/mcp",
authorizationHeader: "Bearer synthetic-cursor-token",
browserToolsAvailable: true,
});
let sentWithMcpOverride = true;
const modelSelection = { instanceId, model: "composer-2.5" };
const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
runtimeMode: "full-access",
Expand All @@ -75,6 +86,7 @@ describe("CursorAdapterV2", () => {
close: Effect.void,
send: (input) =>
Effect.gen(function* () {
sentWithMcpOverride = Object.hasOwn(input.options ?? {}, "mcpServers");
// Recorded Cursor task calls (see fixtures/subagent) stream a
// partial-tool-call before tool-call-started with the same args.
// The run then ends without tool-call-completed, which a live
Expand Down Expand Up @@ -184,6 +196,8 @@ describe("CursorAdapterV2", () => {
Stream.takeUntil((event) => event.type === "turn.terminal"),
Stream.runCollect,
);
// Keep injected MCP at agent creation so sends preserve Cursor's ambient servers.
assert.isFalse(sentWithMcpOverride);
const rows = events.filter((event) => event.type === "subagent.updated");
assert.equal(rows[0]?.subagent.status, "running");
assert.equal(rows[0]?.subagent.model, model ?? null);
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-cursor/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2206,12 +2206,12 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
const message = yield* resolveUserMessage(turnInput, mcpServers);
const pendingUpdates: Array<InteractionUpdate> = [];
let context: ActiveCursorTurn | null = null;
// MCP send overrides replace the ambient servers loaded when the agent opens.
const sdkRun = yield* agent.session.send({
message,
options: {
model: cursorSdkModelSelection(turnInput.modelSelection),
mode: turnInput.runtimePolicy.interactionMode === "plan" ? "plan" : "agent",
...(mcpServers === undefined ? {} : { mcpServers }),
},
onDelta: (update) => {
if (context === null) {
Expand Down
Loading