Skip to content

feat: add MCP HTTP server experiment and improve experiment middleware #18712

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

Conversation

ThomasK33
Copy link
Member

Add MCP HTTP Server Experiment

This PR adds a new experiment flag mcp-server-http to enable the MCP HTTP server functionality. The changes include:

  1. Added a new experiment constant ExperimentMCPServerHTTP with the value "mcp-server-http"
  2. Added display name and documentation for the new experiment
  3. Improved the experiment middleware to:
    • Support requiring multiple experiments
    • Provide better error messages with experiment display names
    • Add a development mode bypass option
  4. Applied the new experiment requirement to the MCP HTTP endpoint
  5. Replaced the custom OAuth2 middleware with the standard experiment middleware

The PR also improves the Enabled() method on the Experiments type by using slices.Contains() for better readability.

@ThomasK33 ThomasK33 marked this pull request as ready for review July 2, 2025 12:09
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 610c661 to eff63b0 Compare July 2, 2025 12:25
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch 2 times, most recently from 3b81925 to 7c1857a Compare July 2, 2025 12:44
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch 2 times, most recently from f181adb to be45ca1 Compare July 2, 2025 13:58
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch 2 times, most recently from 2406fe7 to 10bed55 Compare July 2, 2025 14:05
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch 2 times, most recently from 27e77d8 to 4eab4be Compare July 2, 2025 14:13
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 10bed55 to 91acaec Compare July 2, 2025 14:13
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 4eab4be to d64fbf9 Compare July 2, 2025 14:39
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 91acaec to 46dec9a Compare July 2, 2025 14:41
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from d64fbf9 to 6af7251 Compare July 2, 2025 14:41
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from db01ace to 84da6b4 Compare July 2, 2025 16:35
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 76e5caf to 9d10302 Compare July 2, 2025 16:47
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 84da6b4 to bce9b62 Compare July 2, 2025 16:48
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 9d10302 to ffbe385 Compare July 2, 2025 17:02
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from bce9b62 to 317120d Compare July 2, 2025 17:02
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from ffbe385 to b4ecd2d Compare July 2, 2025 17:17
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch 2 times, most recently from 420f6df to 665993d Compare July 3, 2025 15:00
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from b4ecd2d to 377a7e8 Compare July 3, 2025 15:00
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 377a7e8 to b20b977 Compare July 3, 2025 16:35
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 665993d to 5d752e3 Compare July 3, 2025 16:36
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from b20b977 to 15df5c5 Compare July 3, 2025 16:52
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 5d752e3 to e8b598e Compare July 3, 2025 16:53
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 15df5c5 to 5a4fab9 Compare July 3, 2025 17:14
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from e8b598e to d7cac75 Compare July 3, 2025 17:14
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch 2 times, most recently from cd0cf55 to 9045b65 Compare July 3, 2025 17:28
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from d7cac75 to cb75f3a Compare July 3, 2025 17:28
@ThomasK33 ThomasK33 changed the base branch from thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout to graphite-base/18712 July 3, 2025 17:44
@ThomasK33 ThomasK33 force-pushed the graphite-base/18712 branch from 9045b65 to 1555154 Compare July 3, 2025 17:44
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from cb75f3a to f62413e Compare July 3, 2025 17:44
@graphite-app graphite-app bot changed the base branch from graphite-base/18712 to main July 3, 2025 17:45
- Add ExperimentMCPServerHTTP constant for controlled rollout
- Refactor OAuth2 middleware into generic experiment middleware
- Make experiment middleware variadic to support multiple experiments
- Apply experiment gating to /api/experimental/mcp/http routes
- Maintain development mode bypass for testing flexibility
- Remove OAuth2-specific middleware in favor of reusable pattern

Change-Id: Ia5b3d0615f4a5a45e5a233b1ea92e8bdc0a5f17e
Signed-off-by: Thomas Kosiewski <[email protected]>
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from f62413e to 9965337 Compare July 3, 2025 17:45
@ThomasK33 ThomasK33 merged commit 7fbb3ce into main Jul 3, 2025
61 of 65 checks passed
Copy link
Member Author

Merge activity

@ThomasK33 ThomasK33 deleted the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch July 3, 2025 18:09
@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants