Screenshot returns undecodable image on VM/RDP desktops after the first capture

Author: SIMON-WORLDCreated Aug 9, 2026Updated Aug 28, 2026

Summary

Screenshot becomes unreliable on VM/RDP-hosted interactive desktops after the first successful capture: subsequent calls return an image the MCP client reports as "undecodable image" (empty/invalid bytes), while Snapshot and window listing keep working.

Environment

  • Windows 11 VM guest (VMware/VirtualBox) driven through an RDP-hosted interactive session
  • Codex Desktop 26.803.5235.0 with windows-mcp 0.8.5 via uvx windows-mcp serve
  • Python 3.14, screenshot backend auto (dxcam -> mss -> pillow)

Reproduction

  1. Start a session with the MCP server and call Screenshot once: returns a valid desktop image.
  2. Perform UI actions (open an app, type), then call Screenshot again: returns "undecodable image".
  3. Retrying 10+ times, including forcing pillow and dxcam backends, produces the same result.
  4. Note: the same environment cannot use Windows.Graphics.Capture at all (SetIsBorderRequired failed 0x80004002), which is typical for VMs/RDP without full WDDM capture support.

Workaround found

Setting server env WINDOWS_MCP_SCREENSHOT_BACKEND=mss and WINDOWS_MCP_DISABLE_FLASH=1, then restarting the server, makes captures stable afterwards.

Suspected causes

  • The always-on-top orange-red flash overlay window (rendered after capture) may break subsequent captures on capture-unfriendly environments.
  • The auto backend fallback may not handle a dxcam partial-initialization failure that produces empty frames instead of raising an exception, so it never falls through to mss/pillow.

Expected behavior

  • Screenshot should either fail loudly with a useful error and automatically fall back to a working backend, or remain stable across repeated calls.