@@ -2,6 +2,7 @@ package commands
22
33import (
44 "context"
5+ "fmt"
56
67 "github.com/buildkite/buildkite-mcp-server/pkg/server"
78 mcpserver "github.com/mark3labs/mcp-go/server"
@@ -10,15 +11,24 @@ import (
1011
1112type HTTPCmd struct {
1213 Listen string `help:"The address to listen on." default:"localhost:3000"`
14+ UseSSE bool `help:"Use deprecated SSS transport instead of Streamable HTTP." default:"false"`
1315}
1416
1517func (c * HTTPCmd ) Run (ctx context.Context , globals * Globals ) error {
16-
1718 mcpServer := server .NewMCPServer (globals .Version , globals .Client , globals .BuildkiteLogsClient )
19+ logEvent := log .Ctx (ctx ).Info ().Str ("address" , c .Listen )
1820
19- httpServer := mcpserver .NewSSEServer (mcpServer )
21+ if c .UseSSE {
22+ httpServer := mcpserver .NewSSEServer (mcpServer )
23+ endpoint := fmt .Sprintf ("http://%s%s" , c .Listen , httpServer .CompleteSsePath ())
24+ logEvent .Str ("transport" , "sse" ).Str ("endpoint" , endpoint ).Msg ("Starting SSE HTTP server" )
2025
21- log .Ctx (ctx ).Info ().Str ("address" , c .Listen ).Msg ("Starting HTTP server" )
26+ return httpServer .Start (c .Listen )
27+ } else {
28+ httpServer := mcpserver .NewStreamableHTTPServer (mcpServer )
29+ endpoint := fmt .Sprintf ("http://%s/mcp" , c .Listen )
30+ logEvent .Str ("transport" , "streamable-http" ).Str ("endpoint" , endpoint ).Msg ("Starting streamable HTTP server" )
2231
23- return httpServer .Start (c .Listen )
32+ return httpServer .Start (c .Listen )
33+ }
2434}
0 commit comments