-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Migrate MCP Apps support from insiders mode to feature flag with insiders opt-in #2282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
32fb743
d3ab0ea
c74f6c5
7830fe6
2a25285
fd3a3c4
3bdaf75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ import ( | |||||||||||||||
| "errors" | ||||||||||||||||
| "log/slog" | ||||||||||||||||
| "net/http" | ||||||||||||||||
| "slices" | ||||||||||||||||
|
|
||||||||||||||||
| ghcontext "github.com/github/github-mcp-server/pkg/context" | ||||||||||||||||
| "github.com/github/github-mcp-server/pkg/github" | ||||||||||||||||
|
|
@@ -261,6 +262,14 @@ func InventoryFiltersForRequest(r *http.Request, builder *inventory.Builder) *in | |||||||||||||||
| builder = builder.WithReadOnly(true) | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| // Enable MCP Apps if the feature flag is present in the request headers | ||||||||||||||||
| // or if insiders mode is active (insiders expands InsidersFeatureFlags). | ||||||||||||||||
| headerFeatures := ghcontext.GetHeaderFeatures(ctx) | ||||||||||||||||
| mcpApps := slices.Contains(headerFeatures, github.MCPAppsFeatureFlag) || ghcontext.IsInsidersMode(ctx) | ||||||||||||||||
|
Comment on lines
+266
to
+268
|
||||||||||||||||
| // or if insiders mode is active (insiders expands InsidersFeatureFlags). | |
| headerFeatures := ghcontext.GetHeaderFeatures(ctx) | |
| mcpApps := slices.Contains(headerFeatures, github.MCPAppsFeatureFlag) || ghcontext.IsInsidersMode(ctx) | |
| // or if insiders mode is active (insiders expands InsidersFeatureFlags), | |
| // but only when UI assets are available to serve the advertised resources. | |
| headerFeatures := ghcontext.GetHeaderFeatures(ctx) | |
| mcpApps := (slices.Contains(headerFeatures, github.MCPAppsFeatureFlag) || ghcontext.IsInsidersMode(ctx)) && github.UIAssetsAvailable() |
Copilot
AI
Apr 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InventoryFiltersForRequest enables MCP Apps UI metadata purely based on the raw header value or Insiders mode, without consulting the same sources of truth used elsewhere (the X-MCP-Features whitelist in pkg/http/server.go and github.InsidersFeatureFlags). This can drift over time (e.g., if MCPAppsFeatureFlag is removed from the whitelist or from InsidersFeatureFlags, the inventory could still include UI metadata even though the feature checker would treat it as disabled). Consider deriving mcpApps from the whitelist + header check and from github.InsidersFeatureFlags membership when Insiders mode is active, so inventory/UI metadata gating stays consistent with feature-flag evaluation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InsidersFeatureFlagsis an exported, mutable slice; downstream packages could modify it at runtime and unintentionally change feature-gating behavior. To prevent accidental mutation, consider making this unexported and exposing an accessor that returns a cloned slice (or returning a set/map), so insiders expansion remains a stable single source of truth.