Skip to content

Commit fe88214

Browse files
authored
[log] Add debug logging to server HTTP server scaffold (#5388)
## Summary Adds `logHTTPServer` debug logger to `internal/server/http_server.go` to improve visibility into HTTP server creation and configuration during startup. ## Changes Added 4 meaningful debug log calls: - `newHTTPServer`: logs the address when creating the HTTP server - `buildMCPHTTPServer`: logs build parameters (address, auth/HMAC enabled state), resolved session timeout, and completion status ## Why This Helps The `buildMCPHTTPServer` function is the central scaffold used by both routed and unified modes. With `DEBUG=server:*`, operators can now trace: - Which address the server binds to - Whether auth and HMAC signing are active - What session timeout was resolved from the environment ## Validation - `go test ./internal/...` passes (exit 0) - Logger follows `pkg:filename` naming convention: `"server:http_server"` - No side effects in log arguments (only reads existing variables) - Single file modified > Generated by [Go Logger Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/25614578224/agentic_workflow) · ● 3.2M · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, version: 1.0.40, model: claude-sonnet-4.6, id: 25614578224, workflow_id: go-logger, run: https://github.com/github/gh-aw-mcpg/actions/runs/25614578224 --> <!-- gh-aw-workflow-id: go-logger -->
2 parents eb7a787 + 36f32ae commit fe88214

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal/server/http_server.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import (
55
"time"
66

77
"github.com/github/gh-aw-mcpg/internal/config"
8+
"github.com/github/gh-aw-mcpg/internal/logger"
89
)
910

11+
var logHTTPServer = logger.New("server:http_server")
12+
1013
func newHTTPServer(addr string, handler http.Handler) *http.Server {
14+
logHTTPServer.Printf("Creating HTTP server: addr=%s", addr)
1115
return &http.Server{
1216
Addr: addr,
1317
Handler: handler,
@@ -24,9 +28,12 @@ func buildMCPHTTPServer(
2428
apiKey, hmacSecret string,
2529
routeBuilder func(mux *http.ServeMux, sessionTimeout time.Duration),
2630
) *http.Server {
31+
logHTTPServer.Printf("Building MCP HTTP server: addr=%s, auth_enabled=%v, hmac_enabled=%v", addr, apiKey != "", hmacSecret != "")
2732
mux := http.NewServeMux()
2833
registerCommonEndpoints(mux, unifiedServer, apiKey)
2934
sessionTimeout := config.GetGatewaySessionTimeoutFromEnv()
35+
logHTTPServer.Printf("Session timeout configured: %s", sessionTimeout)
3036
routeBuilder(mux, sessionTimeout)
37+
logHTTPServer.Printf("MCP HTTP server scaffold ready: addr=%s", addr)
3138
return newHTTPServer(addr, mux)
3239
}

0 commit comments

Comments
 (0)