Skip to content

Commit 3b0cc2a

Browse files
Advertise all capabilities in dynamic toolsets mode
In dynamic mode, explicitly set HasTools/HasResources/HasPrompts=true since toolsets with those capabilities can be enabled at runtime. This ensures clients know the server supports these features even when no tools/resources/prompts are initially registered.
1 parent 5f2f192 commit 3b0cc2a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

internal/ghmcp/server.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,23 @@ func NewMCPServer(cfg MCPServerConfig) (*mcp.Server, error) {
168168
}
169169

170170
// Create the MCP server
171-
ghServer := github.NewServer(cfg.Version, &mcp.ServerOptions{
171+
serverOpts := &mcp.ServerOptions{
172172
Instructions: github.GenerateInstructions(instructionToolsets),
173173
Logger: cfg.Logger,
174174
CompletionHandler: github.CompletionsHandler(func(_ context.Context) (*gogithub.Client, error) {
175175
return clients.rest, nil
176176
}),
177-
})
177+
}
178+
179+
// In dynamic mode, explicitly advertise capabilities since tools/resources/prompts
180+
// may be enabled at runtime even if none are registered initially.
181+
if cfg.DynamicToolsets {
182+
serverOpts.HasTools = true
183+
serverOpts.HasResources = true
184+
serverOpts.HasPrompts = true
185+
}
186+
187+
ghServer := github.NewServer(cfg.Version, serverOpts)
178188

179189
// Add middlewares
180190
ghServer.AddReceivingMiddleware(addGitHubAPIErrorToContext)

0 commit comments

Comments
 (0)