Problem
pkg/cli/mcp_registry.go uses http.NewRequest (line 56) in createRegistryRequest, which does not accept a context.Context. This means all HTTP calls to the MCP registry cannot be cancelled by callers and ignore any deadline/cancellation signal propagated from upstream cobra command handlers.
This is inconsistent with the rest of the cli package, where deps_security.go:140 and compile_update_check.go:237,267 already use http.NewRequestWithContext correctly.
Location
pkg/cli/mcp_registry.go:55-66 — createRegistryRequest method
pkg/cli/mcp_registry.go:69-90 — SearchServers callers: mcp_registry_list.go:24, mcp_add.go:45
Impact
- Severity: Medium
- Affected code paths: MCP registry list (
gh aw mcp list) and MCP add (gh aw mcp add) commands
- Risk: HTTP requests to the MCP registry cannot be cancelled by the user (Ctrl+C) or by caller context deadlines. The only timeout is the blunt 30-second
http.Client.Timeout.
Recommendation
Change the signature of createRegistryRequest to accept context.Context and propagate it via http.NewRequestWithContext:
Before:
func (c *MCPRegistryClient) createRegistryRequest(method, url string) (*http.Request, error) {
req, err := http.NewRequest(method, url, nil)
...
}
After:
func (c *MCPRegistryClient) createRegistryRequest(ctx context.Context, method, url string) (*http.Request, error) {
req, err := http.NewRequestWithContext(ctx, method, url, nil)
...
}
Update SearchServers and GetServerDetails to accept and forward a context.Context. Update callers in mcp_registry_list.go and mcp_add.go to pass cmd.Context().
Validation
Estimated Effort: Small
Generated by Sergo (Run 3, 2026-05-08) — Run ID: §25537174291
Generated by Sergo - Serena Go Expert · ● 506.4K · ◷
Problem
pkg/cli/mcp_registry.gouseshttp.NewRequest(line 56) increateRegistryRequest, which does not accept acontext.Context. This means all HTTP calls to the MCP registry cannot be cancelled by callers and ignore any deadline/cancellation signal propagated from upstream cobra command handlers.This is inconsistent with the rest of the
clipackage, wheredeps_security.go:140andcompile_update_check.go:237,267already usehttp.NewRequestWithContextcorrectly.Location
pkg/cli/mcp_registry.go:55-66—createRegistryRequestmethodpkg/cli/mcp_registry.go:69-90—SearchServerscallers:mcp_registry_list.go:24,mcp_add.go:45Impact
gh aw mcp list) and MCP add (gh aw mcp add) commandshttp.Client.Timeout.Recommendation
Change the signature of
createRegistryRequestto acceptcontext.Contextand propagate it viahttp.NewRequestWithContext:Before:
After:
Update
SearchServersandGetServerDetailsto accept and forward acontext.Context. Update callers inmcp_registry_list.goandmcp_add.goto passcmd.Context().Validation
deps_security.gopattern is followed consistentlyhttp.NewRequestcalls remain inpkg/Estimated Effort: Small
Generated by Sergo (Run 3, 2026-05-08) — Run ID: §25537174291