@@ -55,6 +55,17 @@ describe("CursorAdapterV2", () => {
5555 } ) ;
5656 const instanceId = ProviderInstanceId . make ( "cursor" ) ;
5757 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 ;
5869 const modelSelection = { instanceId, model : "composer-2.5" } ;
5970 const runtimePolicy = ProviderAdapter . ProviderAdapterV2RuntimePolicy . make ( {
6071 runtimeMode : "full-access" ,
@@ -75,6 +86,7 @@ describe("CursorAdapterV2", () => {
7586 close : Effect . void ,
7687 send : ( input ) =>
7788 Effect . gen ( function * ( ) {
89+ sentWithMcpOverride = Object . hasOwn ( input . options ?? { } , "mcpServers" ) ;
7890 // Recorded Cursor task calls (see fixtures/subagent) stream a
7991 // partial-tool-call before tool-call-started with the same args.
8092 // The run then ends without tool-call-completed, which a live
@@ -184,6 +196,8 @@ describe("CursorAdapterV2", () => {
184196 Stream . takeUntil ( ( event ) => event . type === "turn.terminal" ) ,
185197 Stream . runCollect ,
186198 ) ;
199+ // Keep injected MCP at agent creation so sends preserve Cursor's ambient servers.
200+ assert . isFalse ( sentWithMcpOverride ) ;
187201 const rows = events . filter ( ( event ) => event . type === "subagent.updated" ) ;
188202 assert . equal ( rows [ 0 ] ?. subagent . status , "running" ) ;
189203 assert . equal ( rows [ 0 ] ?. subagent . model , model ?? null ) ;
0 commit comments