@@ -117,18 +117,6 @@ func NewMCPServer(cfg MCPServerConfig) (*mcp.Server, error) {
117117 // Generate instructions based on enabled toolsets
118118 instructions := github .GenerateInstructions (enabledToolsets )
119119
120- ghServer := github .NewServer (cfg .Version , & mcp.ServerOptions {
121- Instructions : instructions ,
122- HasTools : true ,
123- HasResources : true ,
124- HasPrompts : true ,
125- Logger : cfg .Logger ,
126- })
127-
128- // Add middlewares
129- ghServer .AddReceivingMiddleware (addGitHubAPIErrorToContext )
130- ghServer .AddReceivingMiddleware (addUserAgentsMiddleware (cfg , restClient , gqlHTTPClient ))
131-
132120 getClient := func (_ context.Context ) (* gogithub.Client , error ) {
133121 return restClient , nil // closing over client
134122 }
@@ -145,6 +133,16 @@ func NewMCPServer(cfg MCPServerConfig) (*mcp.Server, error) {
145133 return raw .NewClient (client , apiHost .rawURL ), nil // closing over client
146134 }
147135
136+ ghServer := github .NewServer (cfg .Version , & mcp.ServerOptions {
137+ Instructions : instructions ,
138+ Logger : cfg .Logger ,
139+ CompletionHandler : github .GitHubCompletionsHandler (getClient ),
140+ })
141+
142+ // Add middlewares
143+ ghServer .AddReceivingMiddleware (addGitHubAPIErrorToContext )
144+ ghServer .AddReceivingMiddleware (addUserAgentsMiddleware (cfg , restClient , gqlHTTPClient ))
145+
148146 // Create default toolsets
149147 tsg := github .DefaultToolsetGroup (
150148 cfg .ReadOnly ,
0 commit comments