Skip to content

Commit 99e1262

Browse files
committed
add insiders routes
1 parent e366cf8 commit 99e1262

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

docs/remote-server.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,15 @@ The Remote GitHub MCP server supports the following URL path patterns:
121121
- `/` - Default toolset (see ["default" toolset](../README.md#default-toolset))
122122
- `/readonly` - Default toolset in read-only mode
123123
- `/insiders` - Default toolset with insiders mode enabled
124-
- `/insiders/readonly` - Default toolset with insiders mode in read-only mode
124+
- `/readonly/insiders` - Default toolset in read-only mode with insiders mode enabled
125125
- `/x/all` - All available toolsets
126126
- `/x/all/readonly` - All available toolsets in read-only mode
127127
- `/x/all/insiders` - All available toolsets with insiders mode enabled
128+
- `/x/all/readonly/insiders` - All available toolsets in read-only mode with insiders mode enabled
128129
- `/x/{toolset}` - Single specific toolset
129130
- `/x/{toolset}/readonly` - Single specific toolset in read-only mode
130131
- `/x/{toolset}/insiders` - Single specific toolset with insiders mode enabled
132+
- `/x/{toolset}/readonly/insiders` - Single specific toolset in read-only mode with insiders mode enabled
131133

132134
Note: `{toolset}` can only be a single toolset, not a comma-separated list. To combine multiple toolsets, use the `X-MCP-Toolsets` header instead. Path modifiers like `/readonly` and `/insiders` can be combined with the `X-MCP-Insiders` or `X-MCP-Readonly` headers.
133135

pkg/http/handler.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,17 @@ func NewHTTPMcpHandler(
9191
func (h *Handler) RegisterRoutes(r chi.Router) {
9292
r.Use(middleware.WithRequestConfig)
9393

94+
// Base routes
9495
r.Mount("/", h)
95-
// Mount readonly and toolset routes
96-
r.With(withToolset).Mount("/x/{toolset}", h)
97-
r.With(withReadonly, withToolset).Mount("/x/{toolset}/readonly", h)
9896
r.With(withReadonly).Mount("/readonly", h)
97+
r.With(withInsiders).Mount("/insiders", h)
98+
r.With(withReadonly, withInsiders).Mount("/readonly/insiders", h)
99+
100+
// Toolset routes
101+
r.With(withToolset).Mount("/x/{toolset}", h)
102+
r.With(withToolset, withReadonly).Mount("/x/{toolset}/readonly", h)
103+
r.With(withToolset, withInsiders).Mount("/x/{toolset}/insiders", h)
104+
r.With(withToolset, withReadonly, withInsiders).Mount("/x/{toolset}/readonly/insiders", h)
99105
}
100106

101107
// withReadonly is middleware that sets readonly mode in the request context
@@ -115,6 +121,14 @@ func withToolset(next http.Handler) http.Handler {
115121
})
116122
}
117123

124+
// withInsiders is middleware that sets insiders mode in the request context
125+
func withInsiders(next http.Handler) http.Handler {
126+
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
127+
ctx := ghcontext.WithInsidersMode(r.Context(), true)
128+
next.ServeHTTP(w, r.WithContext(ctx))
129+
})
130+
}
131+
118132
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
119133
inventory, err := h.inventoryFactoryFunc(r)
120134
if err != nil {

0 commit comments

Comments
 (0)