@@ -1480,6 +1480,15 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
14801480 session . SetCapabilities ( response . Capabilities ) ;
14811481 session . SetOpenCanvases ( response . OpenCanvases ) ;
14821482
1483+ if ( config . McpServers is not null )
1484+ {
1485+ await InvokeRpcAsync < JsonElement > (
1486+ connection . Rpc ,
1487+ "session.mcp.reloadWithConfig" ,
1488+ [ new ReloadMcpServersRequest ( sessionId , new ReloadMcpServersConfig ( config . McpServers ) ) ] ,
1489+ cancellationToken ) ;
1490+ }
1491+
14831492 if ( config . OnMcpAuthRequest is not null )
14841493 {
14851494 await session . Rpc . EventLog . RegisterInterestAsync ( "mcp.oauth_required" , cancellationToken ) ;
@@ -2952,6 +2961,13 @@ internal record ResumeSessionResponse(
29522961 IList < OpenCanvasInstance > ? OpenCanvases = null ) ;
29532962#pragma warning restore GHCP001
29542963
2964+ internal record ReloadMcpServersRequest (
2965+ string SessionId ,
2966+ ReloadMcpServersConfig Config ) ;
2967+
2968+ internal record ReloadMcpServersConfig (
2969+ IDictionary < string , McpServerConfig > McpServers ) ;
2970+
29552971 internal record CommandWireDefinition (
29562972 string Name ,
29572973 string Description ) ;
@@ -3028,6 +3044,8 @@ internal record HooksInvokeResponse(
30283044 [ JsonSerializable ( typeof ( CapiSessionOptions ) ) ]
30293045 [ JsonSerializable ( typeof ( NamedProviderConfig ) ) ]
30303046 [ JsonSerializable ( typeof ( ProviderModelConfig ) ) ]
3047+ [ JsonSerializable ( typeof ( ReloadMcpServersConfig ) ) ]
3048+ [ JsonSerializable ( typeof ( ReloadMcpServersRequest ) ) ]
30313049 [ JsonSerializable ( typeof ( SessionLimitsConfig ) ) ]
30323050 [ JsonSerializable ( typeof ( ResumeSessionRequest ) ) ]
30333051 [ JsonSerializable ( typeof ( ResumeSessionResponse ) ) ]
0 commit comments