File Preview UI causes repeated origin=ui reads and severe long-chat performance issues; no opt-out in v0.2.51

Author: lizhixiaCreated Sep 26, 2026Updated Sep 28, 2026

Summary

In Desktop Commander MCP v0.2.51, the File Preview UI is effectively enabled by default, but there is no stable user-editable setting to disable it.

The preview is not passive: it performs real MCP tool executions with origin="ui". In a minimal Markdown reproduction, one model-side read_file was followed by two additional UI-origin reads after the preview was opened.

In long, tool-heavy ChatGPT web conversations this became a much larger usability problem: the conversation accumulated many large Desktop Commander preview cards, browser memory usage became very high, scrolling became difficult, and refreshing/reopening the long conversation triggered bursts of UI-origin reads while previews were being restored. That made long chats slow and difficult to reload.

We also encountered ChatGPT conversation-length-limit warnings in the same class of long, tool-heavy sessions. I cannot prove that the UI-origin reads or widget payloads are counted toward model context, so this should be treated as a possible correlation/open question rather than a confirmed root cause. The server-side extra origin="ui" calls themselves are directly observable.

Environment

  • Desktop Commander MCP: 0.2.51
  • OS: Windows
  • Host used for reproduction: ChatGPT web
  • Transport: tunnel-client -> stdio Desktop Commander process
  • abTest_McpUiPreviews: null
  • No showMcpUI or per-tool File Preview switch exists in the editable config fields

Minimal reproduction

  1. Start an unmodified Desktop Commander MCP 0.2.51 instance.

  2. Have the model read a Markdown file with a bounded range:

    read_file(path=".../AGENTS.md", offset=0, length=5, origin="llm")

  3. Open/expand the File Preview UI for that result.

  4. Inspect get_recent_tool_calls.

Observed:

21:24:07  read_file  origin=llm  offset=0  length=5
21:24:12  read_file  origin=ui   offset=0  length=5
21:24:14  read_file  origin=ui   offset=0  length=5

So one model read became three real file reads.

In other traces, UI refreshes also appeared without an explicit length, allowing the preview path to fall back to the configured server read limit rather than the original bounded model read.

Long-chat behavior

The main user-facing problem appears after a chat accumulates many Desktop Commander tool calls:

  • many large File Preview / MCP App cards remain in the page
  • page/browser memory usage grows substantially
  • scrolling through the conversation becomes difficult and laggy
  • reopening or refreshing the long chat can be slow
  • after refresh/reopen, bursts of origin="ui" file reads occur while historical previews are restored
  • these UI reads happen without corresponding new model reads
  • this creates additional local disk I/O, parsing, MCP RPC traffic, and UI work exactly when the page is already expensive to restore

In one 1,000-call Desktop Commander history window from a workload with multiple concurrent chats:

  • 712 calls were text read_file calls
  • 616 had origin="ui"
  • 96 were non-UI/model-facing reads

This history is global across concurrent chats, so it should NOT be interpreted as a per-chat percentage. It does show that UI-origin reads can dominate the workload.

There were also bursts of sequential origin="ui" reads with no matching model reads at the same time, consistent with preview remount/refresh behavior.

Possible relationship to conversation length limits

The same long, tool-heavy conversations also hit ChatGPT conversation-length-limit warnings.

I do not have enough visibility into the host's context-retention/compaction internals to claim that File Preview UI payloads or UI-origin reads consume model context. The visual card size also should not be treated as a direct proxy for token usage.

However, because:

  • the previews create additional real tool calls,
  • some UI reads can be broader than the original bounded model read,
  • long chats retain many preview instances/cards,
  • and the length-limit warnings appeared in the same workloads,

it may be worth checking whether host-retained widget/tool payloads contribute to context pressure. I am reporting this as an open question, not as a confirmed Desktop Commander bug.

Why this matters

UI-origin calls are real local file operations even though they are not agent actions. They add:

  • disk I/O and MCP RPC traffic
  • repeated file/Markdown parsing
  • work during historical preview remounts
  • noisy tool-history/audit data
  • risk of a bounded model read being followed by a broader UI read
  • extra work during long-chat reload, when UI performance is already degraded

On ChatGPT web, the MCP App cards also create substantial page/DOM/rendering overhead. That host-specific rendering is not fully controlled by Desktop Commander, but Desktop Commander opting tools into the MCP UI path is what causes those previews to exist.

Configuration gap in v0.2.51

Current mcp-ui-ab-test.js falls back to enabling MCP UI in multiple cases, including non-first-run, no explicit experiment decision, and error fallback paths.

The current editable config fields are:

blockedCommands
allowedDirectories
defaultShell
telemetryEnabled
fileReadLineLimit
fileWriteLineLimit

There is no stable user-facing showMcpUI, showFilePreviewUI, or equivalent opt-out in v0.2.51.

Diagnostic workaround that confirmed the UI path is involved

I locally converted Desktop Commander to a plain-tools MCP shape:

  • removed the resources capability
  • removed resources/list and resources/read
  • removed ui:// resources
  • removed tool UI _meta such as ui/resourceUri and openai/outputTemplate
  • removed structuredContent from get_config
  • rejected stale origin="ui" calls from cached widgets
  • re-registered the MCP connection as a fresh plugin

After that:

  • normal model read_file calls continued to work
  • extra UI-origin file reads stopped
  • the large File Preview / MCP App cards disappeared
  • ChatGPT rendered the tool as a compact normal tool-call row instead
  • refresh/reopen no longer had preview widgets to remount for new calls

This is only a diagnostic workaround, not a request to remove MCP UI entirely.

Expected behavior

Users should be able to choose one of two modes:

  1. Full MCP UI/File Preview mode
  2. Plain MCP/tools-only mode with no UI resources, no preview widgets, and no UI-origin file reads

If File Preview remains enabled, opening one preview should not cause redundant sequential reads of the same file/range.

Suggested fixes

  1. Ship a persistent showMcpUI=false setting, or preferably a per-tool File Preview setting, similar to PR #494.
  2. When disabled, do not advertise UI metadata/resources for those tools.
  3. Avoid multiple sequential reads for a single preview open, especially the Markdown widget pull + refreshFromDisk sequence.
  4. Reuse the original tool result when possible instead of re-reading the same path/range from disk.
  5. Avoid background re-reads caused only by historical preview remounts.
  6. Preserve the original bounded offset/length when any UI-side re-read is truly necessary.
  7. Add tests asserting:
    • UI-disabled mode causes zero UI-origin file reads
    • one preview open performs at most one file read
    • refreshing/remounting a historical preview does not re-read unchanged files unnecessarily

PR #606 appears useful for concurrent duplicate requests, but sequential remount/refresh reads would still need separate handling.

Related upstream work

  • PR #536 — widget-pulled reads
  • PR #542 — UI-origin calls are real executions but excluded from telemetry
  • PR #494 — showMcpUI opt-out setting (open)
  • PR #606 — coalesce duplicate widget tool requests (open)
  • Issue #432 — long-session UI/IPC flooding and memory pressure in the Desktop Commander app
  • Issue #696 — origin="ui" behavior and model/UI split

This issue is not intended as a duplicate of #432: that report is about the Desktop Commander Windows app and includes app logging/IPC behavior. This report is specifically about the MCP File Preview path in Desktop Commander MCP, real origin="ui" file reads, lack of a user opt-out, and the impact on long host conversations.

I can provide additional get_recent_tool_calls traces if useful.

Source: wonderwhy-er/DesktopCommanderMCP