Skip to content

feat(http): implement HeaderAllowedFeatureFlags for X-MCP-Features header validation#2332

Merged
SamMorrowDrums merged 3 commits intomainfrom
export-header-allowed-feature-flags
Apr 15, 2026
Merged

feat(http): implement HeaderAllowedFeatureFlags for X-MCP-Features header validation#2332
SamMorrowDrums merged 3 commits intomainfrom
export-header-allowed-feature-flags

Conversation

@mattdholloway
Copy link
Copy Markdown
Contributor

Summary

Why

Fixes #

What changed

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed
  • New tool added

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR

Note: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

@mattdholloway mattdholloway requested a review from a team as a code owner April 15, 2026 11:44
Copilot AI review requested due to automatic review settings April 15, 2026 11:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements a shared allowlist of feature flags that may be enabled via the X-MCP-Features HTTP header, and wires the HTTP server’s header validation to that allowlist.

Changes:

  • Added github.HeaderAllowedFeatureFlags as the centralized allowlist for header-enabled feature flags.
  • Updated the HTTP server feature-flag whitelist to use github.HeaderAllowedFeatureFlags (instead of an empty list).
Show a summary per file
File Description
pkg/http/server.go Uses the centralized allowlist for X-MCP-Features header validation in the HTTP feature checker.
pkg/github/tools.go Introduces HeaderAllowedFeatureFlags listing which feature flags are permitted from X-MCP-Features.

Copilot's findings

Comments suppressed due to low confidence (1)

pkg/http/server.go:30

  • knownFeatureFlags aliases the underlying slice backing github.HeaderAllowedFeatureFlags. Even if you keep the exported slice, it’s safer for the HTTP layer to work off a defensive copy so later mutations (or accidental sharing) can’t affect the allowlist used to build knownSet. Consider cloning the slice when assigning (or calling an accessor that returns a clone).
var knownFeatureFlags = github.HeaderAllowedFeatureFlags
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread pkg/http/server.go Outdated
Comment thread pkg/github/tools.go Outdated
mattdholloway and others added 2 commits April 15, 2026 12:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…() and add tests for feature flag validation
@SamMorrowDrums SamMorrowDrums merged commit efcaead into main Apr 15, 2026
18 checks passed
@SamMorrowDrums SamMorrowDrums deleted the export-header-allowed-feature-flags branch April 15, 2026 15:36
SamMorrowDrums added a commit that referenced this pull request Apr 15, 2026
Rebase PR #2282 onto main (post-#2332) and unify feature flag
allowlists into a single source of truth.

- Add MCPAppsFeatureFlag, AllowedFeatureFlags, InsidersFeatureFlags,
  and ResolveFeatureFlags in feature_flags.go
- AllowedFeatureFlags includes all user-controllable flags (MCP Apps +
  granular), InsidersFeatureFlags only includes MCPAppsFeatureFlag
- HeaderAllowedFeatureFlags() now delegates to AllowedFeatureFlags
- Builder uses feature checker instead of insidersMode bool
- Remove InsidersOnly field from ServerTool and WithInsidersMode from
  Builder
- HTTP feature checker uses ResolveFeatureFlags for per-request
  resolution with insiders expansion
- Tool handlers check MCPAppsFeatureFlag via IsFeatureEnabled instead
  of InsidersMode

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SamMorrowDrums added a commit that referenced this pull request Apr 16, 2026
Rebase PR #2282 onto main (post-#2332) and unify feature flag
allowlists into a single source of truth.

- Add MCPAppsFeatureFlag, AllowedFeatureFlags, InsidersFeatureFlags,
  and ResolveFeatureFlags in feature_flags.go
- AllowedFeatureFlags includes all user-controllable flags (MCP Apps +
  granular), InsidersFeatureFlags only includes MCPAppsFeatureFlag
- HeaderAllowedFeatureFlags() now delegates to AllowedFeatureFlags
- Builder uses feature checker instead of insidersMode bool
- Remove InsidersOnly field from ServerTool and WithInsidersMode from
  Builder
- HTTP feature checker uses ResolveFeatureFlags for per-request
  resolution with insiders expansion
- Tool handlers check MCPAppsFeatureFlag via IsFeatureEnabled instead
  of InsidersMode

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants