Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(mcp): add explicit browser sign-in for reviewed embedded apps

Rahman79ecc751c733
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index ace228e5..1d5a6cf0 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,5 +1,7 @@
## 2026-09-05 — MCP Page preview lifecycle
+- **Reviewed-app Google sign-in leaves the iframe (2026-09-05):** Page v6 adds an explicit host-side Google-login action using a code-owned same-origin path. A nested app may only highlight this action, never trigger navigation, supply a URL or transfer session data. The host opens through `ui/open-link`/`openExternal` after a real button click; sandbox popup restrictions remain unchanged. Play Together finishes sign-in in the browser tab; this does not promise shared login with storage-partitioned embeds. v5 resource requests remain compatible.
+
## 2026-09-05 — Repair native Integrations delivery and full credential catalog
diff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.md
index 9f612821..85f7fad5 100644
--- a/docs/generated/MCP-CATALOG.md
+++ b/docs/generated/MCP-CATALOG.md
@@ -4,13 +4,13 @@
## Full MSO catalog
-<!-- mcp-toolset: server=1.12.0 version=2026.09.05.5 tools=89 read=44 write=26 exec=19 -->
+<!-- mcp-toolset: server=1.12.0 version=2026.09.05.6 tools=89 read=44 write=26 exec=19 -->
| Fact | Current source value |
|---|---:|
| MCP server | `1.12.0` |
-| Toolset | `2026.09.05.5` |
-| Toolset changed at | `2026-09-05T12:32:00Z` |
+| Toolset | `2026.09.05.6` |
+| Toolset changed at | `2026-09-05T12:48:00Z` |
| Transport tools | **91** |
| Model/operator tools | **89** |
| Read | **44** |
@@ -123,7 +123,7 @@
## ChatGPT static profile
-<!-- mcp-chatgpt-profile: server=1.12.0 version=2026.09.05.5 tools=65 read=35 write=18 exec=12 app-only=2 total=67 -->
+<!-- mcp-chatgpt-profile: server=1.12.0 version=2026.09.05.6 tools=65 read=35 write=18 exec=12 app-only=2 total=67 -->
The ChatGPT profile is a fail-closed static projection defined by `CHATGPT_TOOL_NAMES`. OAuth scope is still enforced independently; project-owned MCP tool names remain dynamic data behind the generic project bridge.
diff --git a/docs/integrations/CHATGPT-UI.md b/docs/integrations/CHATGPT-UI.md
index 485bd0ad..0b8ae15b 100644
--- a/docs/integrations/CHATGPT-UI.md
+++ b/docs/integrations/CHATGPT-UI.md
@@ -161,3 +161,14 @@ For Play Together, the independent game server must allow every reviewed ancesto
and keep the inner cartridge at `/embed/game-frame.html`; root app framing stays restricted.
Page reports measured dimensions through `ui/notifications/size-changed`; its layout avoids viewport-relative height feedback when the host resizes the component.
+
+### Reviewed app authentication
+
+Page v6 adds a code-owned optional external-auth path for reviewed apps. The nested application
+can highlight the **Google login in browser** control using a public versioned message, but cannot
+navigate the host or supply the target URL. Only an explicit click on the host control invokes
+`ui/open-link` or the supported `openExternal` fallback. The path must remain on the reviewed app
+origin. Existing iframe sandbox restrictions are unchanged. OAuth finishes in the browser tab;
+no automatic session sharing, cookie copying, callback code forwarding or chat token transfer is
+implied. Cached Page v5 resources remain readable aliases. Play Together's entry is
+`/?auth=google`; Google itself is never framed by MSO.
diff --git a/lib/mcp/surface-catalog.ts b/lib/mcp/surface-catalog.ts
index 906734ce..cc37e327 100644
--- a/lib/mcp/surface-catalog.ts
+++ b/lib/mcp/surface-catalog.ts
@@ -12,6 +12,7 @@ export type SurfaceApp = {
presentation: SurfacePresentation;
environment: SurfaceEnvironment;
sandbox?: string;
+ externalAuthPath?: string;
reason?: string;
};
@@ -26,6 +27,7 @@ export const SURFACE_APPS: readonly SurfaceApp[] = [
description: "Live Play Together demo through its dedicated /embed security boundary.",
origin: "https://game.rahmanef.com",
startPath: "/embed",
+ externalAuthPath: "/?auth=google",
renderer: "iframe",
presentation: "fullscreen",
environment: "production",
@@ -46,8 +48,8 @@ export type ResolvedSurface = {
app?: SurfaceApp & { url: string };
};
-export function publicSurfaceApps(): Array<Omit<SurfaceApp, "sandbox">> {
- return SURFACE_APPS.map(({ sandbox: _sandbox, ...app }) => ({ ...app }));
+export function publicSurfaceApps(): Array<Omit<SurfaceApp, "sandbox" | "externalAuthPath">> {
+ return SURFACE_APPS.map(({ sandbox: _sandbox, externalAuthPath: _externalAuthPath, ...app }) => ({ ...app }));
}
export function surfaceFrameDomains(): string[] {
diff --git a/lib/mcp/tools-surface.ts b/lib/mcp/tools-surface.ts
index 303ba19d..eafec815 100644
--- a/lib/mcp/tools-surface.ts
+++ b/lib/mcp/tools-surface.ts
@@ -38,7 +38,7 @@ const PAGE_INPUT = S({
function publicResolved(resolved: ResolvedSurface): Record<string, unknown> {
const { app, ...rest } = resolved;
if (!app) return rest;
- const { sandbox: _sandbox, ...safeApp } = app;
+ const { sandbox: _sandbox, externalAuthPath: _externalAuthPath, ...safeApp } = app;
return { ...rest, app: safeApp };
}
diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.ts
index 8b88d798..16aaa079 100644
--- a/lib/mcp/toolset.ts
+++ b/lib/mcp/toolset.ts
@@ -4,8 +4,8 @@ import type { McpTool } from "./tool-kit";
import { toolDescriptor, type McpToolProfile } from "./tool-contract";
export const MCP_SERVER_VERSION = "1.12.0";
-export const MCP_TOOLSET_VERSION = "2026.09.05.5";
-export const MCP_TOOLSET_CHANGED_AT = "2026-09-05T12:32:00Z";
+export const MCP_TOOLSET_VERSION = "2026.09.05.6";
+export const MCP_TOOLSET_CHANGED_AT = "2026-09-05T12:48:00Z";
export type McpToolsetInfo = {
serverVersion: string;
diff --git a/lib/mcp/ui-page-auth.test.ts b/lib/mcp/ui-page-auth.test.ts
new file mode 100644
index 00000000..966deb1d
--- /dev/null
+++ b/lib/mcp/ui-page-auth.test.ts
@@ -0,0 +1,49 @@
+import { runInNewContext } from "node:vm";
+import { describe, expect, it, vi } from "vitest";
+import { MSO_PAGE_AUTH_SCRIPT } from "./ui-page-auth";
+
+function fixture(path = "/?auth=google") {
+ const events = new Map<string, (event: unknown) => void>();
+ const buttons: Array<{ click: () => Promise<void>; focus: ReturnType<typeof vi.fn>; disabled: boolean }> = [];
+ const rpcRequest = vi.fn(async () => ({}));
+ const frame = { contentWindow: {} };
+ const message = { textContent: "" };
+ const context = {
+ URL, hostConnected: true, rpcRequest,
+ window: { addEventListener: (name: string, fn: (event: unknown) => void) => events.set(name, fn), removeEventListener: (name: string) => events.delete(name) },
+ button: (_label: string, click: () => Promise<void>) => { const b = { click, focus: vi.fn(), disabled: false }; buttons.push(b); return b; },
+ };
+ const cleanup = runInNewContext(`${MSO_PAGE_AUTH_SCRIPT}; mountReviewedAuth`, context)(
+ { origin: "https://game.rahmanef.com", externalAuthPath: path }, frame, { append: vi.fn() }, message,
+ );
+ return { events, buttons, rpcRequest, frame, message, cleanup };
+}
+
+describe("reviewed external auth action", () => {
+ it("opens only the code-owned same-origin path after a host button click", async () => {
+ const f = fixture();
+ f.events.get("message")?.({ source: f.frame.contentWindow, origin: "https://game.rahmanef.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google", url: "https://attacker.test" } });
+ expect(f.buttons[0].focus).toHaveBeenCalledOnce();
+ expect(f.rpcRequest).not.toHaveBeenCalled();
+ await f.buttons[0].click();
+ expect(f.rpcRequest).toHaveBeenCalledExactlyOnceWith("ui/open-link", { url: "https://game.rahmanef.com/?auth=google" });
+ expect(f.message.textContent).toContain("Preview sessions are separate");
+ });
+ it("ignores spoofed message sources, origins, providers and schema versions", () => {
+ const f = fixture();
+ const base = { source: f.frame.contentWindow, origin: "https://game.rahmanef.com", data: { type: "mso:app-auth-request", schemaVersion: 1, provider: "google" } };
+ for (const event of [{ ...base, source: {} }, { ...base, origin: "https://attacker.test" }, { ...base, data: { ...base.data, schemaVersion: 99 } }, { ...base, data: { ...base.data, provider: "unknown" } }]) f.events.get("message")?.(event);
+ expect(f.buttons[0].focus).not.toHaveBeenCalled();
+ expect(f.rpcRequest).not.toHaveBeenCalled();
+ f.cleanup(); expect(f.events.has("message")).toBe(false);
+ });
+ it.each(["https://attacker.test", "//attacker.test", "/\\attacker.test"])("rejects an off-origin registry path %s", (path) => {
+ expect(fixture(path).buttons).toHaveLength(0);
+ });
+ it("offers a recovery action when the chat host rejects navigation", async () => {
+ const f = fixture(); f.rpcRequest.mockRejectedValueOnce(new Error("blocked"));
+ await f.buttons[0].click();
+ expect(f.message.textContent).toContain("Use Open production");
+ expect(f.buttons[0].disabled).toBe(false);
+ });
+});
diff --git a/lib/mcp/ui-page-auth.ts b/lib/mcp/ui-page-auth.ts
new file mode 100644
index 00000000..164e62b4
--- /dev/null
+++ b/lib/mcp/ui-page-auth.ts
@@ -0,0 +1,29 @@
+// Login leaves the nested app through an explicit host-side button, not an iframe redirect.
+export const MSO_PAGE_AUTH_SCRIPT = String.raw`
+function mountReviewedAuth(safe,frame,status,message){
+ const path=safe.externalAuthPath;
+ if(typeof path!=="string"||!path.startsWith("/")||path.startsWith("//"))return()=>{};
+ const target=new URL(path,safe.origin);
+ if(target.origin!==safe.origin||target.username||target.password)return()=>{};
+ const action=button("Google login in browser",async()=>{
+ action.disabled=true;
+ try{
+ if(hostConnected)await rpcRequest("ui/open-link",{url:target.href});
+ else if(window.openai&&typeof window.openai.openExternal==="function")await window.openai.openExternal({href:target.href});
+ else throw new Error("Host navigation unavailable");
+ message.textContent="Complete Google sign-in in the browser tab and continue playing there. Preview sessions are separate.";
+ }catch(_){message.textContent="Use Open production to continue Google sign-in in your browser."}
+ finally{action.disabled=false}
+ });
+ status.append(action);
+ function requested(event){
+ if(event.source!==frame.contentWindow||event.origin!==safe.origin)return;
+ const data=event.data;
+ if(data?.type!=="mso:app-auth-request"||data.schemaVersion!==1||data.provider!=="google")return;
+ message.textContent="Click Google login in browser above to continue securely outside this preview.";
+ action.focus();
+ }
+ window.addEventListener("message",requested);
+ return()=>window.removeEventListener("message",requested);
+}
+`;
diff --git a/lib/mcp/ui-page-frame.ts b/lib/mcp/ui-page-frame.ts
index f38c2866..e11ada93 100644
--- a/lib/mcp/ui-page-frame.ts
+++ b/lib/mcp/ui-page-frame.ts
@@ -10,6 +10,7 @@ function mountReviewedFrame(safe,stage){
frame.title=safe.title+" live demo";frame.setAttribute("sandbox",safe.sandbox);
frame.referrerPolicy="no-referrer";frame.allow="fullscreen; autoplay; gamepad; accelerometer; gyroscope";
wrap.append(frame);let timer=0,disposed=false;
+ const clearAuth=mountReviewedAuth(safe,frame,status,message);
function unavailable(){if(disposed)return;wrap.dataset.state="unavailable";message.textContent="Preview did not confirm readiness. Retry or open production directly.";retry.hidden=false}
function loadFrame(){clearTimeout(timer);wrap.dataset.state="loading";message.textContent="Connecting to live production…";retry.hidden=true;frame.src=safe.url;timer=setTimeout(unavailable,12000)}
function ready(event){
@@ -25,7 +26,7 @@ function mountReviewedFrame(safe,stage){
}catch(_){message.textContent="Open production in your browser: "+safe.origin}
}
window.addEventListener("message",ready);frame.addEventListener("error",unavailable);
- viewCleanup=()=>{disposed=true;clearTimeout(timer);window.removeEventListener("message",ready);frame.removeEventListener("error",unavailable)};
+ viewCleanup=()=>{clearAuth();disposed=true;clearTimeout(timer);window.removeEventListener("message",ready);frame.removeEventListener("error",unavailable)};
loadFrame();
}
`;
diff --git a/lib/mcp/ui-resources.test.ts b/lib/mcp/ui-resources.test.ts
index 8bfafa8e..ead05f68 100644
--- a/lib/mcp/ui-resources.test.ts
+++ b/lib/mcp/ui-resources.test.ts
@@ -149,7 +149,7 @@ describe("MCP Apps Block and Page contract", () => {
frameDomains: ["https://game.rahmanef.com"],
});
expect(content._meta["openai/widgetCSP"]).toEqual({ connect_domains: [MSO_ORIGIN], frame_domains: ["https://game.rahmanef.com"], redirect_domains: [MSO_ORIGIN, "https://game.rahmanef.com"] });
- expect(MSO_PAGE_URI).toContain("page-v5.html");
+ expect(MSO_PAGE_URI).toContain("page-v6.html");
});
it("returns only redacted structured workflow state and keeps status polling out of workflow memory", async () => {
diff --git a/lib/mcp/ui-resources.ts b/lib/mcp/ui-resources.ts
index 181d913c..6cc5d8f4 100644
--- a/lib/mcp/ui-resources.ts
+++ b/lib/mcp/ui-resources.ts
@@ -8,6 +8,7 @@ export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
// across the UI-contract migration. They are intentionally not advertised by
// resources/list: the public product contract has exactly Block and Page.
export const LEGACY_BLOCK_V1_URI = "ui://mso/block-v1.html";
+export const LEGACY_PAGE_V5_URI = "ui://mso/page-v5.html";
export const LEGACY_PAGE_V4_URI = "ui://mso/page-v4.html";
export const LEGACY_PAGE_V3_URI = "ui://mso/page-v3.html";
export const LEGACY_PAGE_V2_URI = "ui://mso/page-v2.html";
@@ -26,6 +27,7 @@ export type McpUiResource = {
const RESOURCES: readonly McpUiResource[] = [MSO_BLOCK_RESOURCE, MSO_PAGE_RESOURCE];
const LEGACY_ALIASES = new Map<string, McpUiResource>([
+ [LEGACY_PAGE_V5_URI, MSO_PAGE_RESOURCE],
[LEGACY_PAGE_V4_URI, MSO_PAGE_RESOURCE],
[LEGACY_PAGE_V3_URI, MSO_PAGE_RESOURCE],
[LEGACY_BLOCK_V1_URI, MSO_BLOCK_RESOURCE],
diff --git a/lib/mcp/ui-surface-script.ts b/lib/mcp/ui-surface-script.ts
index 4fda07b4..25ed40f7 100644
--- a/lib/mcp/ui-surface-script.ts
+++ b/lib/mcp/ui-surface-script.ts
@@ -1,6 +1,7 @@
import { MSO_PAGE_INTEGRATIONS_SCRIPT } from "./ui-page-integrations";
import { MSO_PAGE_BRIDGE_SCRIPT } from "./ui-page-bridge";
import { MSO_PAGE_FRAME_SCRIPT } from "./ui-page-frame";
+import { MSO_PAGE_AUTH_SCRIPT } from "./ui-page-auth";
import { SURFACE_APPS } from "./surface-catalog";
import { MSO_WIDGET_THEME_SCRIPT } from "./ui-widget-tokens";
@@ -18,6 +19,7 @@ const BROWSER_CATALOG = SURFACE_APPS.map((app) => ({
presentation: app.presentation,
environment: app.environment,
sandbox: app.sandbox ?? "",
+ externalAuthPath: app.externalAuthPath ?? "",
reason: app.reason ?? "",
}));
@@ -32,6 +34,7 @@ let current={route:"/",kind:"home",title:"MSO",openPath:"/assistant/mcp",catalog
const pending=new Map();let nextRpcId=5000;
${MSO_PAGE_BRIDGE_SCRIPT}
${MSO_PAGE_FRAME_SCRIPT}
+${MSO_PAGE_AUTH_SCRIPT}
${MSO_PAGE_INTEGRATIONS_SCRIPT}
function text(value,fallback="—"){return typeof value==="string"&&value.trim()?value.trim():fallback}
diff --git a/lib/mcp/ui-surface.ts b/lib/mcp/ui-surface.ts
index 4149bf92..4f0f751c 100644
--- a/lib/mcp/ui-surface.ts
+++ b/lib/mcp/ui-surface.ts
@@ -6,7 +6,7 @@ import { surfaceFrameDomains } from "./surface-catalog";
import { MSO_SURFACE_SCRIPT } from "./ui-surface-script";
import { MSO_SURFACE_STYLE } from "./ui-surface-style";
-export const MSO_PAGE_URI = "ui://mso/page-v5.html";
+export const MSO_PAGE_URI = "ui://mso/page-v6.html";
const MIME = "text/html;profile=mcp-app";
const html = String.raw`<main class="surface" aria-label="MSO Page">
diff --git a/scripts/e2e/mcp-page.mjs b/scripts/e2e/mcp-page.mjs
index b4e7647f..09420290 100644
--- a/scripts/e2e/mcp-page.mjs
+++ b/scripts/e2e/mcp-page.mjs
@@ -72,6 +72,16 @@ try {
await component.getByRole("button", { name: "Open production" }).click();
assert((await page.evaluate(() => window.calls)).some((call) => call.method === "ui/open-link" && call.params.url === "https://game.rahmanef.com")); assertions++;
}
+ const authAction = component.getByRole("button", { name: "Google login in browser", exact: true });
+ await authAction.waitFor();
+ const opensBeforeAuth = (await page.evaluate(() => window.calls)).filter(call => call.method === "ui/open-link").length;
+ await reloaded.evaluate(() => parent.postMessage({ type: "mso:app-auth-request", schemaVersion: 1, provider: "google" }, "*"));
+ await page.waitForTimeout(50);
+ assert.equal((await page.evaluate(() => window.calls)).filter(call => call.method === "ui/open-link").length, opensBeforeAuth, "Nested messages must not trigger external navigation"); assertions++;
+ if (!legacy) {
+ await authAction.click();
+ assert((await page.evaluate(() => window.calls)).some(call => call.method === "ui/open-link" && call.params.url === "https://game.rahmanef.com/?auth=google")); assertions++;
+ }
console.log(`PASS ${legacy ? "legacy wrapped toolOutput / mobile" : "pure MCP Apps host / desktop"}: init, source validation, timeout, retry, ready, no repeated reload`);
await page.close();
}