Skip to content

Commit aef94e5

Browse files
authored
Fix MCP protocol compliance: use notifications/initialized method
Fixes protocol compliance issue where clients sending notifications/initialized would get No handler for notification errors
1 parent b306edc commit aef94e5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/mcp/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ func (s *Server) registerDefaultHandlers() {
193193
if s.GetHandler("initialize") == nil {
194194
s.RegisterHandler("initialize", s.handleInitialize)
195195
}
196-
if s.GetNotificationHandler("initialized") == nil {
197-
s.RegisterNotificationHandler("initialized", s.handleInitialized)
196+
if s.GetNotificationHandler("notifications/initialized") == nil {
197+
s.RegisterNotificationHandler("notifications/initialized", s.handleInitialized)
198198
}
199199
if s.GetHandler("tools/list") == nil {
200200
s.RegisterHandler("tools/list", s.handleToolsList)

pkg/mcp/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func TestServerStart(t *testing.T) {
142142
t.Error("Initialize handler not registered")
143143
}
144144

145-
if _, exists := server.notifications["initialized"]; !exists {
145+
if _, exists := server.notifications["notifications/initialized"]; !exists {
146146
t.Error("Initialized notification handler not registered")
147147
}
148148
}

0 commit comments

Comments
 (0)