File tree 3 files changed +25
-33
lines changed
packages/multimodal/agent/src/mcp-agent 3 files changed +25
-33
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export class MCPAgent extends Agent {
19
19
super ( options ) ;
20
20
21
21
this . mcpServerConfig = options . mcpServers ;
22
- this . clientVersion = options . mcpClientVersion || 'v1 ';
22
+ this . clientVersion = options . mcpClientVersion ?? 'v2 ';
23
23
}
24
24
25
25
/**
Original file line number Diff line number Diff line change @@ -26,40 +26,14 @@ export class MCPClientV2 implements IMCPClient {
26
26
[
27
27
{
28
28
name : serverName ,
29
- ...this . convertConfigToV2Format ( config ) ,
29
+ ...config ,
30
30
status : 'activate' ,
31
31
} ,
32
32
] ,
33
33
{ isDebug : false } ,
34
34
) ;
35
35
}
36
36
37
- /**
38
- * Convert v1 server config format to v2 format
39
- */
40
- private convertConfigToV2Format ( config : MCPServerConfig ) {
41
- const v2Config : MCPServerConfig = { } ;
42
-
43
- if ( config . command ) {
44
- v2Config . command = config . command ;
45
- }
46
-
47
- if ( config . args ) {
48
- v2Config . args = config . args ;
49
- }
50
-
51
- if ( config . env ) {
52
- v2Config . env = config . env ;
53
- }
54
-
55
- if ( config . url ) {
56
- v2Config . url = config . url ;
57
- v2Config . type = 'sse' ; // Default to SSE for URL-based servers
58
- }
59
-
60
- return v2Config ;
61
- }
62
-
63
37
async initialize ( ) : Promise < Tool [ ] > {
64
38
if ( this . isInitialized ) {
65
39
return this . tools ;
Original file line number Diff line number Diff line change @@ -13,11 +13,13 @@ export interface MCPAgentOptions extends AgentOptions {
13
13
*/
14
14
mcpServers : MCPServerRegistry ;
15
15
/**
16
- * Version of MCP client to use
16
+ * Version of MCP client to use.
17
+ * This is a config for test ONLY, DO NOT depends on it.
18
+ *
17
19
* - 'v1': Use the built-in MCP client (default)
18
20
* - 'v2': Use @agent-infra/mcp-client package
19
21
*
20
- * @default 'v1 '
22
+ * @default 'v2 '
21
23
*/
22
24
mcpClientVersion ?: 'v1' | 'v2' ;
23
25
}
@@ -27,13 +29,29 @@ export interface MCPClientResult {
27
29
}
28
30
29
31
export interface MCPServerConfig {
30
- // Command based server config
32
+ /**
33
+ * Transport: "stdio"
34
+ * @see https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#stdio
35
+ */
31
36
command ?: string ;
32
37
args ?: string [ ] ;
33
38
env ?: Record < string , string > ;
34
- // SSE based server config
39
+
40
+ /**
41
+ * Transport: "sse" or "streaming-http"
42
+ * @see https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http
43
+ * @see https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse
44
+ */
35
45
url ?: string ;
36
- type ?: 'sse' ;
46
+ /**
47
+ * @see https://github.com/modelcontextprotocol/typescript-sdk/blob/bac916e804599ee9e2ecd20f56ac2677c94989f4/src/client/sse.ts#L225-L226
48
+ */
49
+ headers ?: RequestInit [ 'headers' ] ;
50
+
51
+ /**
52
+ * Rest custom configurations.
53
+ */
54
+ [ key : string ] : unknown ;
37
55
}
38
56
39
57
export interface MCPServerRegistry {
You can’t perform that action at this time.
0 commit comments