File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed
Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ func (d *RequestDeps) GetT() translations.TranslationHelperFunc { return d.T }
379379// GetFlags implements ToolDependencies.
380380func (d * RequestDeps ) GetFlags (ctx context.Context ) FeatureFlags {
381381 return FeatureFlags {
382- LockdownMode : ghcontext .IsLockdownMode (ctx ),
382+ LockdownMode : d . lockdownMode && ghcontext .IsLockdownMode (ctx ),
383383 }
384384}
385385
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ func HelloWorldTool(t translations.TranslationHelperFunc) inventory.ServerTool {
4545 if deps .IsFeatureEnabled (ctx , RemoteMCPEnthusiasticGreeting ) {
4646 greeting += " Welcome to the future of MCP! 🎉"
4747 }
48- if deps .GetFlags ().InsiderMode {
48+ if deps .GetFlags (ctx ).InsiderMode {
4949 greeting += " Experimental features are enabled! 🚀"
5050 }
5151
Original file line number Diff line number Diff line change @@ -106,10 +106,6 @@ func withToolset(next http.Handler) http.Handler {
106106}
107107
108108func (h * HTTPMcpHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
109- if relaxedParseBool (r .Header .Get (headers .MCPLockdownHeader )) {
110- r = r .WithContext (ghcontext .WithLockdownMode (r .Context (), true ))
111- }
112-
113109 inventory , err := h .inventoryFactoryFunc (r )
114110 if err != nil {
115111 w .WriteHeader (http .StatusInternalServerError )
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ func WithRequestConfig(next http.Handler) http.Handler {
2626 ctx = ghcontext .WithTools (ctx , tools )
2727 }
2828
29+ if relaxedParseBool (r .Header .Get (headers .MCPLockdownHeader )) {
30+ ctx = ghcontext .WithLockdownMode (ctx , true )
31+ }
32+
2933 next .ServeHTTP (w , r .WithContext (ctx ))
3034 })
3135}
You can’t perform that action at this time.
0 commit comments