fix(mcp): mount /mcp/rpc with explicit method patterns
Go 1.22 ServeMux treats prefix patterns as conflicting with the root catch-all when one matches more methods than the other. Switch from prefix mounting (`/mcp/`) to two explicit `POST/GET /mcp/rpc` handlers so the projax server boots cleanly. /healthz crash loop on first deploy of phase 3a was caused by this.
This commit is contained in:
@@ -136,7 +136,12 @@ func (s *Server) Routes() http.Handler {
|
||||
})
|
||||
|
||||
if s.MCP != nil {
|
||||
mux.Handle("/mcp/", http.StripPrefix("/mcp", s.MCP))
|
||||
// Mount MCP routes with explicit method+path patterns. A prefix pattern
|
||||
// like `/mcp/` would conflict with `GET /` under Go 1.22's strict
|
||||
// ServeMux (the prefix matches more methods than the subtree root).
|
||||
mcpHandler := http.StripPrefix("/mcp", s.MCP)
|
||||
mux.Handle("POST /mcp/rpc", mcpHandler)
|
||||
mux.Handle("GET /mcp/rpc", mcpHandler)
|
||||
}
|
||||
|
||||
static, _ := fs.Sub(staticFS, "static")
|
||||
|
||||
Reference in New Issue
Block a user