@@ -20,15 +20,13 @@ import (
20
20
21
21
// sseSession represents an active SSE connection.
22
22
type sseSession struct {
23
- writer http.ResponseWriter
24
- flusher http.Flusher
25
23
done chan struct {}
26
24
eventQueue chan string // Channel for queuing events
27
25
sessionID string
28
26
requestID atomic.Int64
29
27
notificationChannel chan mcp.JSONRPCNotification
30
28
initialized atomic.Bool
31
- loggingLevel atomic.Value
29
+ loggingLevel atomic.Value
32
30
tools sync.Map // stores session-specific tools
33
31
}
34
32
@@ -55,11 +53,11 @@ func (s *sseSession) Initialized() bool {
55
53
return s .initialized .Load ()
56
54
}
57
55
58
- func (s * sseSession ) SetLogLevel (level mcp.LoggingLevel ) {
56
+ func (s * sseSession ) SetLogLevel (level mcp.LoggingLevel ) {
59
57
s .loggingLevel .Store (level )
60
58
}
61
59
62
- func (s * sseSession ) GetLogLevel () mcp.LoggingLevel {
60
+ func (s * sseSession ) GetLogLevel () mcp.LoggingLevel {
63
61
level := s .loggingLevel .Load ()
64
62
if level == nil {
65
63
return mcp .LoggingLevelError
@@ -92,9 +90,9 @@ func (s *sseSession) SetSessionTools(tools map[string]ServerTool) {
92
90
}
93
91
94
92
var (
95
- _ ClientSession = (* sseSession )(nil )
96
- _ SessionWithTools = (* sseSession )(nil )
97
- _ SessionWithLogging = (* sseSession )(nil )
93
+ _ ClientSession = (* sseSession )(nil )
94
+ _ SessionWithTools = (* sseSession )(nil )
95
+ _ SessionWithLogging = (* sseSession )(nil )
98
96
)
99
97
100
98
// SSEServer implements a Server-Sent Events (SSE) based MCP server.
@@ -301,8 +299,6 @@ func (s *SSEServer) handleSSE(w http.ResponseWriter, r *http.Request) {
301
299
302
300
sessionID := uuid .New ().String ()
303
301
session := & sseSession {
304
- writer : w ,
305
- flusher : flusher ,
306
302
done : make (chan struct {}),
307
303
eventQueue : make (chan string , 100 ), // Buffer for events
308
304
sessionID : sessionID ,
0 commit comments