Repository navigation
Description
Inspector Version
0.21.2
Describe the bug
A Safari/WebKit-specific MCP Apps rendering failure occurs because the Inspector sandbox relay in server/static/sandbox_proxy.html assumes inner iframe messages will always arrive with:
event.source === inner.contentWindowIn Safari/WebKit, we observed the inner iframe's postMessage(...) arriving at the outer sandbox with:
event.origin === OWN_ORIGINevent.source === window
instead of event.source === inner.contentWindow.
Because of that, the sandbox drops the app's ui/initialize request instead of forwarding it to the host. The MCP App then never receives a JSON-RPC init response and remains blank or partially initialized.
The failing implementation appears to be in server/static/sandbox_proxy.html, not in app-side render logic.
To Reproduce
Steps to reproduce the behavior:
- Start
@modelcontextprotocol/inspector. - Connect it to an MCP server that returns an MCP App / generated UI.
- Open the same generated UI in a Chromium browser such as Brave or Chrome and confirm it renders.
- Open the same generated UI in Safari desktop or another WebKit-based host/surface.
- Observe that the app sends
ui/initialize, but Safari/WebKit never completes the handshake and the UI remains blank.
Expected behavior
The same MCP App should initialize and render in Safari/WebKit just as it does in Chromium. The sandbox relay should forward valid same-origin inner iframe messages even when Safari reports them with event.source === window.
Screenshots
I do not have screenshots included in this report.
Environment (please complete the following information):
- OS: macOS and iOS
- Browser: Safari desktop, iOS WebKit surfaces, and Brave/Chrome for working comparison
Additional context
We debugged this with runtime instrumentation in Safari and Chromium side-by-side.
What we observed before the patch:
- Chromium / Brave works:
- app sends
ui/initialize - sandbox relays it
- host returns JSON-RPC response
- app renders normally
- app sends
- Safari / WebKit fails:
- app sends
ui/initialize - outer sandbox receives the message
- message is classified as unexpected because
event.source !== inner.contentWindow - host never receives
ui/initialize - app times out initialization and remains blank
- app sends
What we observed after a local patch:
- allowing the same-origin Safari case where
event.source === windowmade the sandbox relayui/initialize - the host returned the JSON-RPC response
- the app initialized and rendered correctly
Current relay logic:
} else if (event.source === inner.contentWindow) {
if (event.origin !== OWN_ORIGIN) {
console.error(
"[Sandbox] Rejecting message from inner iframe with unexpected origin:",
event.origin,
"expected:",
OWN_ORIGIN,
);
return;
}
window.parent.postMessage(event.data, EXPECTED_HOST_ORIGIN);
}Suggested fix:
} else if (
event.source === inner.contentWindow ||
(event.origin === OWN_ORIGIN && event.source === window)
) {
if (event.origin !== OWN_ORIGIN) {
console.error(
"[Sandbox] Rejecting message from inner iframe with unexpected origin:",
event.origin,
"expected:",
OWN_ORIGIN,
);
return;
}
window.parent.postMessage(event.data, EXPECTED_HOST_ORIGIN);
}The important part is preserving the origin check while relaxing the brittle source identity assumption for Safari/WebKit.
There is a separate ext-apps transport race issue in modelcontextprotocol/ext-apps#542, but this bug appears distinct. In this case, the blocking failure was the sandbox relay dropping a valid inner-frame message on Safari/WebKit due to a strict event.source check.
Activity
fix(sandbox): unblock postMessage from inner iframe on Safari/WebKit
cliffhall commentedon Aug 1, 2026
Closing: v1 is deprecated.
Thank you for reporting this, and apologies for the long wait for a response.
v1 will receive security fixes only — this issue describes a functionality, compatibility, or usability problem rather than a vulnerability, so it is being closed against v1. This is not a judgment on whether the problem is real — it's a consequence of the v1 line being frozen. This is happening as part of #1872.
If this still happens in v2, we'd genuinely like to know. v2 is a complete rewrite — three clients over a shared core — so many v1 behaviours no longer exist in the same form. Please open a fresh issue against v2 with steps to reproduce, and we'll look at it. Note that we accept external contributions as issues rather than pull requests; maintainers handle design and implementation through a prompt-driven workflow. See
CONTRIBUTING.md.Thanks for taking the time to report it.