File tree Expand file tree Collapse file tree 3 files changed +42
-8
lines changed
Expand file tree Collapse file tree 3 files changed +42
-8
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,6 @@ const (
2626 DescriptionRepositoryName = "Repository name"
2727)
2828
29- // FeatureFlagConsolidatedActions is the legacy feature flag (deprecated, no longer used).
30- // Kept for documentation purposes only.
31- const FeatureFlagConsolidatedActions = "remote_mcp_consolidated_actions"
32-
3329// FeatureFlagHoldbackConsolidatedActions is the feature flag that, when enabled, reverts to
3430// individual actions tools instead of the consolidated actions tools.
3531const FeatureFlagHoldbackConsolidatedActions = "mcp_holdback_consolidated_actions"
Original file line number Diff line number Diff line change @@ -27,10 +27,6 @@ const (
2727 MaxProjectsPerPage = 50
2828)
2929
30- // FeatureFlagConsolidatedProjects is the legacy feature flag (deprecated, no longer used).
31- // Kept for documentation purposes only.
32- const FeatureFlagConsolidatedProjects = "remote_mcp_consolidated_projects"
33-
3430// FeatureFlagHoldbackConsolidatedProjects is the feature flag that, when enabled, reverts to
3531// individual project tools instead of the consolidated project tools.
3632const FeatureFlagHoldbackConsolidatedProjects = "mcp_holdback_consolidated_projects"
Original file line number Diff line number Diff line change 1+ package http
2+
3+ import (
4+ "context"
5+ "slices"
6+
7+ "github.com/github/github-mcp-server/pkg/github"
8+ "github.com/github/github-mcp-server/pkg/inventory"
9+ )
10+
11+ // KnownFeatureFlags are the feature flags that can be enabled via X-MCP-Features header.
12+ var KnownFeatureFlags = []string {
13+ github .FeatureFlagHoldbackConsolidatedProjects ,
14+ github .FeatureFlagHoldbackConsolidatedActions ,
15+ }
16+
17+ // ComposeFeatureChecker combines header-based feature flags with a static checker.
18+ func ComposeFeatureChecker (headerFeatures []string , staticChecker inventory.FeatureFlagChecker ) inventory.FeatureFlagChecker {
19+ if len (headerFeatures ) == 0 && staticChecker == nil {
20+ return nil
21+ }
22+
23+ // Only accept header features that are in the known list
24+ headerSet := make (map [string ]bool , len (headerFeatures ))
25+ for _ , f := range headerFeatures {
26+ if slices .Contains (KnownFeatureFlags , f ) {
27+ headerSet [f ] = true
28+ }
29+ }
30+
31+ return func (ctx context.Context , flag string ) (bool , error ) {
32+ // Header-based: static string matching
33+ if headerSet [flag ] {
34+ return true , nil
35+ }
36+ // Static checker
37+ if staticChecker != nil {
38+ return staticChecker (ctx , flag )
39+ }
40+ return false , nil
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments