| 40 | } |
| 41 | |
| 42 | func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 43 | r.URL.Path = strings.TrimSuffix(r.URL.Path, "/") |
| 44 | if strings.HasSuffix(r.URL.Path, "/mcp") { |
| 45 | h.handlers["openapi-stream"].ServeHTTP(w, r) |
| 46 | return |
| 47 | } |
| 48 | if strings.HasPrefix(r.URL.Path, "/api") { |
| 49 | h.handlers["api-sse"].ServeHTTP(w, r) |
| 50 | return |
| 51 | } else if strings.HasPrefix(r.URL.Path, "/openapi") { |
| 52 | h.handlers["openapi-sse"].ServeHTTP(w, r) |
| 53 | return |
| 54 | } |
| 55 | http.NotFound(w, r) |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | func (s *Server) Set(id string, ser *server.MCPServer) { |
| 60 | s.locker.Lock() |