• Will Chen's avatar
    Add MCP experiment toggle for build mode (#2659) · fb5fe1cb
    Will Chen 提交于
    ## Summary
    - Updated ChatInputControls component with new functionality
    - Enhanced settings page with improved search indexing
    - Updated schema definitions with new type support
    - Updated chat stream handlers for better data processing
    - Added comprehensive e2e tests for Settings component
    
    ## Test plan
    - Run `npm run test` to verify all unit tests pass
    - Run `npm run e2e` to verify end-to-end tests pass
    - Manually test Settings page UI and functionality
    - Verify schema changes don't break existing data handling
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2659"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > **Medium Risk**
    > Changes the conditions under which MCP tools can be surfaced and
    executed in chat streaming, so mis-gating could unintentionally disable
    or enable tool execution paths; scope is limited to a new opt-in
    experiment flag.
    > 
    > **Overview**
    > Introduces a new experimental setting, `enableMcpServersForBuildMode`,
    to gate MCP server usage outside Local Agent mode.
    > 
    > When disabled, the MCP tools UI (`ChatInputControls`) and the MCP
    agent execution path in `chat_stream_handlers` no longer activate in
    Build mode; enabling the toggle re-enables MCP tools for Build/Agent
    behavior.
    > 
    > Adds the toggle to the Settings "Experiments" section, indexes it for
    settings search, extends the settings schema to persist it, and updates
    MCP e2e tests/page objects to explicitly enable the experiment before
    exercising MCP tool calls.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    0b08d3da18e90fda6fc959a94e143df64249ad27. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Adds an experiment toggle to allow MCP servers in Build mode and gates
    MCP tool usage behind it across the chat UI and stream handlers. Updates
    Settings and search to surface the toggle, and updates e2e tests to
    cover the new flow.
    
    - **New Features**
    - Settings: new “Enable MCP servers for Build mode” toggle under
    Experiments; added to search.
    - Chat: ChatInputControls and chat_stream_handlers now require this
    flag; Agent mode remains supported; Build mode also needs at least one
    enabled MCP server.
      - Schema: adds enableMcpServersForBuildMode to UserSettingsSchema.
    - Tests: Playwright specs enable the toggle before MCP tests; new
    Settings page-object helper.
    
    - **Migration**
    - To use MCP in Build mode, enable Settings → Experiments → “Enable MCP
    servers for Build mode”.
    
    <sup>Written for commit 0b08d3da18e90fda6fc959a94e143df64249ad27.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    fb5fe1cb
schemas.ts 15.4 KB