File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ func (s *sseSession) Initialized() bool {
51
51
52
52
var _ ClientSession = (* sseSession )(nil )
53
53
54
+ // ListenAndServer is a type that implements ListenAndServe and Shutdown
55
+ type ListenAndServer interface {
56
+ ListenAndServe () error
57
+ Shutdown (ctx context.Context ) error
58
+ }
59
+
54
60
// SSEServer implements a Server-Sent Events (SSE) based MCP server.
55
61
// It provides real-time communication capabilities over HTTP using the SSE protocol.
56
62
type SSEServer struct {
@@ -61,7 +67,7 @@ type SSEServer struct {
61
67
messageEndpoint string
62
68
sseEndpoint string
63
69
sessions sync.Map
64
- srv * http. Server
70
+ srv ListenAndServer
65
71
contextFunc SSEContextFunc
66
72
67
73
keepAlive bool
@@ -131,7 +137,7 @@ func WithSSEEndpoint(endpoint string) SSEOption {
131
137
}
132
138
133
139
// WithHTTPServer sets the HTTP server instance
134
- func WithHTTPServer (srv * http. Server ) SSEOption {
140
+ func WithHTTPServer (srv ListenAndServer ) SSEOption {
135
141
return func (s * SSEServer ) {
136
142
s .srv = srv
137
143
}
You can’t perform that action at this time.
0 commit comments