Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (s *MCPServer) RemoveResource(uri string) {

// Send notification to all initialized sessions if listChanged capability is enabled
if s.capabilities.resources != nil && s.capabilities.resources.listChanged {
s.sendNotificationToAllClients("resources/list_changed", nil)
s.SendNotificationToAllClients("resources/list_changed", nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fixed method capitalization bug

This corrects a critical bug where the lowercase method name sendNotificationToAllClients was being called, but only the capitalized SendNotificationToAllClients method exists (defined on line 217). In Go, method names are case-sensitive, so this change ensures the correct method is called.

}
}

Expand Down Expand Up @@ -492,7 +492,7 @@ func (s *MCPServer) AddTools(tools ...ServerTool) {
// SetTools replaces all existing tools with the provided list
func (s *MCPServer) SetTools(tools ...ServerTool) {
s.toolsMu.Lock()
s.tools = make(map[string]ServerTool)
s.tools = make(map[string]ServerTool, len(tools))
s.toolsMu.Unlock()
s.AddTools(tools...)
}
Expand Down Expand Up @@ -714,7 +714,7 @@ func (s *MCPServer) handleReadResource(
matched = true
matchedVars := template.URITemplate.Match(request.Params.URI)
// Convert matched variables to a map
request.Params.Arguments = make(map[string]interface{})
request.Params.Arguments = make(map[string]interface{}, len(matchedVars))
for name, value := range matchedVars {
request.Params.Arguments[name] = value.V
}
Expand Down
5 changes: 1 addition & 4 deletions server/sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ func NewSSEServer(server *MCPServer, opts ...SSEOption) *SSEServer {

// NewTestServer creates a test server for testing purposes
func NewTestServer(server *MCPServer, opts ...SSEOption) *httptest.Server {
sseServer := NewSSEServer(server)
for _, opt := range opts {
opt(sseServer)
}
sseServer := NewSSEServer(server, opts...)

testServer := httptest.NewServer(sseServer)
sseServer.baseURL = testServer.URL
Expand Down