RegisterRoutes registers the routes for the MCP server URL-based values take precedence over header-based values
(r chi.Router)
| 141 | // RegisterRoutes registers the routes for the MCP server |
| 142 | // URL-based values take precedence over header-based values |
| 143 | func (h *Handler) RegisterRoutes(r chi.Router) { |
| 144 | // Base routes |
| 145 | r.Mount("/", h) |
| 146 | r.With(withReadonly).Mount("/readonly", h) |
| 147 | r.With(withInsiders).Mount("/insiders", h) |
| 148 | r.With(withReadonly, withInsiders).Mount("/readonly/insiders", h) |
| 149 | |
| 150 | // Toolset routes |
| 151 | r.With(withToolset).Mount("/x/{toolset}", h) |
| 152 | r.With(withToolset, withReadonly).Mount("/x/{toolset}/readonly", h) |
| 153 | r.With(withToolset, withInsiders).Mount("/x/{toolset}/insiders", h) |
| 154 | r.With(withToolset, withReadonly, withInsiders).Mount("/x/{toolset}/readonly/insiders", h) |
| 155 | } |
| 156 | |
| 157 | // withReadonly is middleware that sets readonly mode in the request context |
| 158 | func withReadonly(next http.Handler) http.Handler { |
no outgoing calls