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

Open
wants to merge 1 commit into
base: thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout
Choose a base branch
from

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.

Copy link
Member Author

ThomasK33 commented Jul 2, 2025

@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-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 46dec9a to eb2ed15 Compare July 2, 2025 15:08
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from 6af7251 to a9f1767 Compare July 2, 2025 15:08
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from eb2ed15 to 13103fd Compare July 2, 2025 15:53
@ThomasK33 ThomasK33 force-pushed the thomask33/07-02-feat_mcp_add_experiment_control_for_mcp_server_http_endpoints branch from a9f1767 to db01ace Compare July 2, 2025 15:54
@ThomasK33 ThomasK33 force-pushed the thomask33/07-01-feat_oauth2_replace_dev_flag_with_oauth2_experiment_for_controlled_rollout branch from 13103fd to 76e5caf Compare July 2, 2025 16:35
@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
- 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 <tk@coder.com>
@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
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.

2 participants