Skip to content

Commit 11c3033

Browse files
committed
remove old flags
1 parent 5c0ec57 commit 11c3033

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

pkg/github/actions.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff 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.
3531
const FeatureFlagHoldbackConsolidatedActions = "mcp_holdback_consolidated_actions"

pkg/github/projects.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff 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.
3632
const FeatureFlagHoldbackConsolidatedProjects = "mcp_holdback_consolidated_projects"

pkg/http/features.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

0 commit comments

Comments
 (0)