@@ -17,12 +17,12 @@ import (
1717func main () {
1818 // Define command line flags
1919 stdioCmd := flag .String ("stdio" , "" , "Command to execute for stdio transport (e.g. 'python server.py')" )
20- sseURL := flag .String ("sse " , "" , "URL for SSE transport (e.g. 'http://localhost:8080/sse ')" )
20+ httpURL := flag .String ("http " , "" , "URL for HTTP transport (e.g. 'http://localhost:8080/mcp ')" )
2121 flag .Parse ()
2222
2323 // Validate flags
24- if (* stdioCmd == "" && * sseURL == "" ) || (* stdioCmd != "" && * sseURL != "" ) {
25- fmt .Println ("Error: You must specify exactly one of --stdio or --sse " )
24+ if (* stdioCmd == "" && * httpURL == "" ) || (* stdioCmd != "" && * httpURL != "" ) {
25+ fmt .Println ("Error: You must specify exactly one of --stdio or --http " )
2626 flag .Usage ()
2727 os .Exit (1 )
2828 }
@@ -51,11 +51,6 @@ func main() {
5151 // Create stdio transport with verbose logging
5252 stdioTransport := transport .NewStdio (command , nil , cmdArgs ... )
5353
54- // Start the transport
55- if err := stdioTransport .Start (ctx ); err != nil {
56- log .Fatalf ("Failed to start stdio transport: %v" , err )
57- }
58-
5954 // Create client with the transport
6055 c = client .NewClient (stdioTransport )
6156
@@ -78,20 +73,20 @@ func main() {
7873 }()
7974 }
8075 } else {
81- fmt .Println ("Initializing SSE client..." )
82- // Create SSE transport
83- sseTransport , err := transport .NewSSE ( * sseURL )
76+ fmt .Println ("Initializing HTTP client..." )
77+ // Create HTTP transport
78+ httpTransport , err := transport .NewStreamableHTTP ( * httpURL )
8479 if err != nil {
85- log .Fatalf ("Failed to create SSE transport: %v" , err )
86- }
87-
88- // Start the transport
89- if err := sseTransport .Start (ctx ); err != nil {
90- log .Fatalf ("Failed to start SSE transport: %v" , err )
80+ log .Fatalf ("Failed to create HTTP transport: %v" , err )
9181 }
9282
9383 // Create client with the transport
94- c = client .NewClient (sseTransport )
84+ c = client .NewClient (httpTransport )
85+ }
86+
87+ // Start the client
88+ if err := c .Start (ctx ); err != nil {
89+ log .Fatalf ("Failed to start client: %v" , err )
9590 }
9691
9792 // Set up notification handler
0 commit comments