@@ -21,6 +21,7 @@ import type {
21
21
Tool ,
22
22
Resource ,
23
23
Prompt ,
24
+ ServerCapabilities ,
24
25
} from "@modelcontextprotocol/sdk/types.js" ;
25
26
26
27
import type { Client } from "@modelcontextprotocol/sdk/client/index.js" ;
@@ -195,6 +196,8 @@ export type MCPServer = {
195
196
server_url : string ;
196
197
auth_url : string | null ;
197
198
state : "authenticating" | "connecting" | "ready" | "discovering" | "failed" ;
199
+ instructions : string | null ;
200
+ capabilities : ServerCapabilities | null ;
198
201
} ;
199
202
200
203
/**
@@ -396,7 +399,7 @@ export class Agent<Env, State = unknown> extends Server<Env> {
396
399
this . broadcast (
397
400
JSON . stringify ( {
398
401
type : "cf_agent_mcp_servers" ,
399
- mcp : this . _getMcpServerStateInternal ( ) ,
402
+ mcp : this . getMcpServerState ( ) ,
400
403
} )
401
404
) ;
402
405
@@ -508,7 +511,7 @@ export class Agent<Env, State = unknown> extends Server<Env> {
508
511
connection . send (
509
512
JSON . stringify ( {
510
513
type : "cf_agent_mcp_servers" ,
511
- mcp : this . _getMcpServerStateInternal ( ) ,
514
+ mcp : this . getMcpServerState ( ) ,
512
515
} )
513
516
) ;
514
517
@@ -548,7 +551,7 @@ export class Agent<Env, State = unknown> extends Server<Env> {
548
551
this . broadcast (
549
552
JSON . stringify ( {
550
553
type : "cf_agent_mcp_servers" ,
551
- mcp : this . _getMcpServerStateInternal ( ) ,
554
+ mcp : this . getMcpServerState ( ) ,
552
555
} )
553
556
) ;
554
557
@@ -952,7 +955,7 @@ export class Agent<Env, State = unknown> extends Server<Env> {
952
955
this . broadcast (
953
956
JSON . stringify ( {
954
957
type : "cf_agent_mcp_servers" ,
955
- mcp : this . _getMcpServerStateInternal ( ) ,
958
+ mcp : this . getMcpServerState ( ) ,
956
959
} )
957
960
) ;
958
961
@@ -1049,12 +1052,12 @@ export class Agent<Env, State = unknown> extends Server<Env> {
1049
1052
this . broadcast (
1050
1053
JSON . stringify ( {
1051
1054
type : "cf_agent_mcp_servers" ,
1052
- mcp : this . _getMcpServerStateInternal ( ) ,
1055
+ mcp : this . getMcpServerState ( ) ,
1053
1056
} )
1054
1057
) ;
1055
1058
}
1056
1059
1057
- private _getMcpServerStateInternal ( ) : MCPServersState {
1060
+ getMcpServerState ( ) : MCPServersState {
1058
1061
const mcpState : MCPServersState = {
1059
1062
servers : { } ,
1060
1063
tools : this . mcp . listTools ( ) ,
@@ -1072,6 +1075,9 @@ export class Agent<Env, State = unknown> extends Server<Env> {
1072
1075
server_url : server . server_url ,
1073
1076
auth_url : server . auth_url ,
1074
1077
state : this . mcp . mcpConnections [ server . id ] . connectionState ,
1078
+ instructions : this . mcp . mcpConnections [ server . id ] . instructions ?? null ,
1079
+ capabilities :
1080
+ this . mcp . mcpConnections [ server . id ] . serverCapabilities ?? null ,
1075
1081
} ;
1076
1082
}
1077
1083
0 commit comments