@@ -31,17 +31,17 @@ async function runClient(url_or_command: string, args: string[]) {
3131 }
3232
3333 if ( url ?. protocol === "http:" || url ?. protocol === "https:" ) {
34- clientTransport = new SSEClientTransport ( ) ;
35- await clientTransport . connect ( new URL ( url_or_command ) ) ;
34+ clientTransport = new SSEClientTransport ( new URL ( url_or_command ) ) ;
35+ await clientTransport . start ( ) ;
3636 } else if ( url ?. protocol === "ws:" || url ?. protocol === "wss:" ) {
37- clientTransport = new WebSocketClientTransport ( ) ;
38- await clientTransport . connect ( new URL ( url_or_command ) ) ;
37+ clientTransport = new WebSocketClientTransport ( new URL ( url_or_command ) ) ;
38+ await clientTransport . start ( ) ;
3939 } else {
40- clientTransport = new StdioClientTransport ( ) ;
41- await clientTransport . spawn ( {
40+ clientTransport = new StdioClientTransport ( {
4241 command : url_or_command ,
4342 args,
4443 } ) ;
44+ await clientTransport . start ( ) ;
4545 }
4646
4747 console . log ( "Connected to server." ) ;
@@ -62,7 +62,7 @@ async function runServer(port: number | null) {
6262 app . get ( "/sse" , async ( req , res ) => {
6363 console . log ( "Got new SSE connection" ) ;
6464
65- const transport = new SSEServerTransport ( "/message" ) ;
65+ const transport = new SSEServerTransport ( "/message" , res ) ;
6666 const server = new Server ( {
6767 name : "mcp-typescript test server" ,
6868 version : "0.1.0" ,
@@ -75,7 +75,7 @@ async function runServer(port: number | null) {
7575 servers = servers . filter ( ( s ) => s !== server ) ;
7676 } ;
7777
78- await transport . connectSSE ( req , res ) ;
78+ await transport . start ( ) ;
7979 await server . connect ( transport ) ;
8080 } ) ;
8181
0 commit comments