Merge fix branch 'mai/knuth/phase-3-a-mcp' (servemux pattern fix)

This commit is contained in:
mAi
2026-05-15 18:11:54 +02:00

View File

@@ -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")