Stop advertising the deprecated logging capability

go-sdk defaults ServerCapabilities to {"logging":{}} when ServerOptions is
nil — "for historical reasons", as its own doc comment puts it. This server
does no logging, and logging is deprecated as of 2026-07-28 (SEP-2577), so an
example for that revision should not be advertising it.

Passing an empty Capabilities suppresses the default. The tools capability is
still inferred from the registered tools, so server/discover now reports
{"tools":{"listChanged":true}} rather than logging alongside it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
olaservo 2026-08-01 16:08:34 -07:00
commit 8ec30b939c

View file

@ -260,11 +260,18 @@ func alertsOutputSchema() *jsonschema.Schema {
}
func main() {
// Create MCP server
// Create MCP server.
//
// Passing an empty Capabilities suppresses the SDK's historical default of
// advertising {"logging":{}} — this server does no logging, and the logging
// feature is deprecated as of 2026-07-28 (SEP-2577). The tools capability is
// still inferred from the tools registered below.
server := mcp.NewServer(&mcp.Implementation{
Name: "weather",
Version: "1.0.0",
}, nil)
}, &mcp.ServerOptions{
Capabilities: &mcp.ServerCapabilities{},
})
// Add get_forecast tool
mcp.AddTool(server, &mcp.Tool{