@@ -169,22 +169,38 @@ func withInsiders(next http.Handler) http.Handler {
169169}
170170
171171func (h * Handler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
172- inventory , err := h .inventoryFactoryFunc (r )
172+ inv , err := h .inventoryFactoryFunc (r )
173173 if err != nil {
174174 w .WriteHeader (http .StatusInternalServerError )
175175 return
176176 }
177177
178- ghServer , err := h .githubMcpServerFactory (r , h .deps , inventory , & github.MCPServerConfig {
178+ invToUse := inv
179+ if methodInfo , ok := ghcontext .MCPMethod (r .Context ()); ok && methodInfo != nil {
180+ invToUse = inv .ForMCPRequest (methodInfo .Method , methodInfo .ItemName )
181+ }
182+
183+ ghServer , err := h .githubMcpServerFactory (r , h .deps , invToUse , & github.MCPServerConfig {
179184 Version : h .config .Version ,
180185 Translator : h .t ,
181186 ContentWindowSize : h .config .ContentWindowSize ,
182187 Logger : h .logger ,
183188 RepoAccessTTL : h .config .RepoAccessCacheTTL ,
189+ // Explicitly set empty capabilities. inv.ForMCPRequest currently returns nothing for Initialize.
190+ ServerOptions : []github.MCPServerOption {
191+ func (so * mcp.ServerOptions ) {
192+ so .Capabilities = & mcp.ServerCapabilities {
193+ Tools : & mcp.ToolCapabilities {},
194+ Resources : & mcp.ResourceCapabilities {},
195+ Prompts : & mcp.PromptCapabilities {},
196+ }
197+ },
198+ },
184199 })
185200
186201 if err != nil {
187202 w .WriteHeader (http .StatusInternalServerError )
203+ return
188204 }
189205
190206 mcpHandler := mcp .NewStreamableHTTPHandler (func (_ * http.Request ) * mcp.Server {
0 commit comments