Is your feature request related to a problem? Please describe.
When one creates a new mcp.Server, there are no Prompts, Resources, or Tools defined on it. At this point if a client connects to this server, the capabilities property on the initialize response should not return any capabilities where the featureSet is empty, because this makes the client think that there might be these features available.
Describe the solution you'd like
InitializeResult.Capabilities should only include capabilities that have a non-empty featureset.
Additional context
I can send a PR to address this. I just wanted to check if this makes sense to you folks.
Changing these lines to the following code "fixed" this issue for me.
capabilities := &serverCapabilities{
Logging: &loggingCapabilities{},
}
if len(ss.server.prompts.features) > 0 {
capabilities.Prompts = &promptCapabilities{ListChanged: true}
}
if len(ss.server.resources.features) > 0 {
capabilities.Resources = &resourceCapabilities{ListChanged: true}
}
if len(ss.server.tools.features) > 0 {
capabilities.Tools = &toolCapabilities{ListChanged: true}
}
return &InitializeResult{
// TODO(rfindley): alter behavior when falling back to an older version:
// reject unsupported features.
ProtocolVersion: version,
Capabilities: capabilities,
Instructions: ss.server.opts.Instructions,
ServerInfo: &implementation{
Name: ss.server.name,
Version: ss.server.version,
},
}, nil