Skip to content

feat: Re-enable MCP Apps auto-detection from client capabilities #771

@jirispilka

Description

@jirispilka

Summary

resolveServerMode('auto', clientSupportsUi) is currently hardcoded to return ServerMode.DEFAULT regardless of the client's UI capability. Re-enable capability-driven auto-detection so MCP Apps clients automatically receive apps-mode tools without needing ?ui=apps or UI_MODE=apps.

Current state

src/types.ts:442-449:
```ts
export function resolveServerMode(option: ServerModeOption, clientSupportsUi: boolean): ServerMode {
if (option !== 'auto') return option;
// TODO: re-enable auto-detect from client capabilities. Disabled for the
// initial release so APPS mode is opt-in via `?ui=apps` or `UI_MODE=apps`.
// return clientSupportsUi ? ServerMode.APPS : ServerMode.DEFAULT;
void clientSupportsUi;
return ServerMode.DEFAULT;
}
```

The intended behavior is in the commented line — resolve to APPS when the client advertises MCP Apps UI support, DEFAULT otherwise.

What needs to happen

  1. Restore the capability-driven branch in resolveServerMode (uncomment the return, drop the void discard).
  2. Re-enable the two skipped integration tests in tests/integration/suite.ts:2533, 2547:
    • auto mode: client advertising UI capability receives apps-mode tools with widget metadata
    • auto mode: client without UI capability receives default-mode tools without widget metadata
  3. Drop the it.skip and the explanatory TODO above them.
  4. Verify on apify-mcp-server-internal (hosted server) that no callers depend on the current auto → default fallback before flipping the switch.

Why

Apps-mode opt-in is currently manual. Once we're confident apps mode is stable for the broad client population, auto-detection is the right default — clients that advertise UI capability get widgets, clients that don't get plain tools, no configuration required.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.high priorityDo this ASAP! This is for mission-critical work or work that blocks other teams in their work.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions