MCPcopy Create free account
hub / github.com/docker/docker-agent / NewWithManager

Function NewWithManager

pkg/server/server.go:43–56  ·  view source on GitHub ↗

NewWithManager builds a Server around an already-constructed SessionManager. Useful when the runtime is owned by another component (e.g. the TUI) and only needs to be exposed over HTTP.

(sm *SessionManager, authToken string)

Source from the content-addressed store, hash-verified

41// Useful when the runtime is owned by another component (e.g. the TUI) and
42// only needs to be exposed over HTTP.
43func NewWithManager(sm *SessionManager, authToken string) *Server {
44 e := echo.New()
45 e.Use(echolog.RedactedRequestLogger())
46 e.Use(echo.WrapMiddleware(upstream.Handler))
47
48 // Add bearer token middleware if token is configured
49 if authToken != "" {
50 e.Use(BearerTokenMiddleware(authToken))
51 }
52
53 s := &Server{e: e, sm: sm, authToken: authToken}
54 s.registerRoutes()
55 return s
56}
57
58func (s *Server) registerRoutes() {
59 // Health and readiness endpoints (not under /api)

Calls 4

registerRoutesMethod · 0.95
RedactedRequestLoggerFunction · 0.92
BearerTokenMiddlewareFunction · 0.85
NewMethod · 0.45