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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(integrations): expose native shell and managed SC project bindings
Rahman9269cb33a6b3
diff --git a/.env.example b/.env.exampleindex 30914cea..d6b9b0a9 100644--- a/.env.example+++ b/.env.example@@ -348,3 +348,7 @@ OS_MCP_MAX_SCOPE=exec# 8 entries; POST only; target MUST be loopback; auth currently hmac-v2-json.# MSO only prefilters HMAC-shaped headers — the loopback app verifies the secret.# OS_PROJECT_INGRESS_ROUTES=[{"app":"hermes","method":"POST","path":"/webhooks/project-example","target":"http://127.0.0.1:8644/webhooks/project-example","auth":"hmac-v2-json","maxBodyBytes":262144}]++# Optional SI-Coder launcher override. Its package/bin identity is verified before use.+# Leave unset to use the owner's ~/.local/bin/sc. No credentials belong here.+# MSO_SC_BIN=/absolute/path/to/scdiff --git a/app/integrations/manager/route.ts b/app/integrations/manager/route.tsnew file mode 100644index 00000000..6d70ca5b--- /dev/null+++ b/app/integrations/manager/route.ts@@ -0,0 +1,4 @@+import { integrationManagerResponse } from "@/lib/infra/setup-page";+export const runtime = "nodejs";+export const dynamic = "force-dynamic";+export const GET = () => integrationManagerResponse();diff --git a/app/integrations/route.test.ts b/app/integrations/route.test.tsindex 6d6927df..7ba60846 100644--- a/app/integrations/route.test.ts+++ b/app/integrations/route.test.ts@@ -1,7 +1,7 @@import { describe, expect, it, vi } from "vitest";import { NextRequest } from "next/server";vi.mock("server-only", () => ({}));-import { GET } from "./route";+import { GET } from "./manager/route";import { proxy } from "@/proxy";describe("friendly native Integrations page", () => {it("renders an uncached full catalog with public instructions but no credential grant", async () => {@@ -12,8 +12,13 @@ describe("friendly native Integrations page", () => {expect(html).toContain("How to get this credential / authorization"); expect(html).not.toContain("si-coder");expect(() => new Function(html.match(/<script nonce="[^"]+">([\s\S]*)<\/script>/)![1])).not.toThrow();});+ it("limits the embedded manager to the same origin", () => {+ const response = GET();+ expect(response.headers.get("x-frame-options")).toBe("SAMEORIGIN");+ expect(response.headers.get("content-security-policy")).toContain("frame-ancestors 'self'");+ });it("lets the trusted HTML endpoint own its nonce while retaining owner mutation CSRF checks", async () => {- const read = await proxy(new NextRequest("https://mso.example.com/integrations", { headers: { host: "mso.example.com" } }));+ const read = await proxy(new NextRequest("https://mso.example.com/integrations/manager", { headers: { host: "mso.example.com" } }));expect(read.headers.get("content-security-policy")).toBeNull();const write = await proxy(new NextRequest("https://mso.example.com/api/v1/infra/setup", { method: "POST", headers: { host: "mso.example.com", origin: "https://evil.invalid", "sec-fetch-site": "cross-site" }, body: "{}" }));expect(write.status).toBe(403);diff --git a/app/integrations/route.ts b/app/integrations/route.tsindex 4c3218f0..82927449 100644--- a/app/integrations/route.ts+++ b/app/integrations/route.ts@@ -1,4 +1,4 @@import { integrationPageResponse } from "@/lib/infra/setup-page";export const runtime = "nodejs";export const dynamic = "force-dynamic";-export const GET = integrationPageResponse;+export const GET = () => integrationPageResponse();diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex baddcd63..6fc88a95 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -62,7 +62,7 @@ frontend/slices/ vertical application slicesappshell/ generic shell frameworkfeatures/ shell featuresos-shell/ MSO manifest + capability adapters- infrastructure/ Dokploy and Cloudflare default feature apps+ infrastructure/ Integrations, Dokploy and Cloudflare default feature appslib/auth/ login/session/device approval + live roleslib/host/ bounded host capability implementationlib/mcp/ OAuth/MCP tool catalog and dispatcherdiff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 0c8f8c8f..81afef0e 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -4,6 +4,13 @@Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;this is the *what*, and it is what Settings → About shows as “What's new”.+## 2026-09-14++**Fixed**++- `integrations` expose native shell and managed SC project bindings+- `mcp` fall back when project MCP discover returns -32601+## 2026-09-12**Added**diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.mdindex 50bf8010..25793253 100644--- a/docs/INTEGRATIONS.md+++ b/docs/INTEGRATIONS.md@@ -51,6 +51,45 @@ and holds a short operation lease against concurrent deletion/relink/rotation.Provider-MCP OAuth is completed in the provider's client. Returning that route doesnot prove the external session is authorized, and MSO never falls back to a local key.+## Ownership and managed SI-Coder++MSO Integrations owns provider/account authority. Batonly owns project plans, task state,+project-to-connection bindings, QA and delivery evidence; it must not mirror provider secrets.+SI-Coder remains optional portable developer tooling. Its standalone store is unchanged.++The shell now exposes **Integrations** in Dock, Launchpad and the App Store, with a pinned+mobile shortcut. `/connections` opens the addressable shell window; `/integrations` remains+the standalone compatibility entrypoint for secure setup links and terminal workflows. Its same-origin+`/integrations/manager` document reuses the existing native service/form and nonce policy;+only that internal document permits same-origin framing. Other origins remain blocked.+Transfer and private setup fragment handoffs remain supported without copying field values.++Settings → MCP → Plugins / Registry separates a declaration from a project binding.+Enter an exact project, inspect the revision, then explicitly activate/deactivate a built-in.+Custom manifests remain declarations only. The browser's registry is not runtime authority;+`.mcp.json` is the project binding. A configured row is deliberately **not** labelled verified.+Use `project_mcp_tools` and then `project_mcp_call` to verify real discovery/execution.++For an MSO-managed SC binding, use `project_mcp_manage` with `plugin: "si-coder"` instead+of `url`, retaining the revision returned by `action: "inspect"`. The portable binding is:++```json+{"mcpServers":{"si-coder":{"plugin":"si-coder","credentialAuthority":"mso"}}}+```++The installed package is resolved by its declared package/bin identity, not the name of a+worktree directory. An unrelated system command named `sc` is never executed as SI-Coder.+This mode exposes reviewed workspace utilities and redirects supported SC account/catalog/+connection-status/verification functions to native MSO. Verification requires explicit+`user`, `provider`, and `connection`; there is no fallback to standalone SC accounts.+SC store mutations, import/export and unaudited flow execution are not exposed in managed+mode. Provider deployment operations continue through `integration_execute`; credentials+are neither copied nor silently synchronized. Standalone SC retains its complete own surface.++This is not an operating-system sandbox for installed code. Activating and calling a local+MCP still requires trust in the installed package and the existing MSO exec-scope approval.+The managed dispatch boundary prevents accidental use of SC's parallel credential workflow.+## Browser and ChatGPTOpen `/integrations`. Public instructions are readable before sign-in; an Owner@@ -102,7 +141,7 @@ Credential values still enter only through the private setup flow; the Agent con### Local SI-Coder migration-When `~/.local/bin/sc` is present, `mso integrations` automatically detects its **metadata-only** Integration Bundle and shows **Import from SI-Coder** in Transfer. Detection is read-only; applying the preview is an explicit create-only action. Existing MSO identities are preserved. Direct credential values are never copied silently; move them with the encrypted bundle/private transfer flow. MSO remains fully standalone when SC is absent. The equivalent explicit command is `mso integrations import-sc`.+When a verified `si-coder-agent` package is present at `~/.local/bin/sc`, `mso integrations` automatically detects its **metadata-only** Integration Bundle and shows **Import from SI-Coder** in Transfer. Detection is read-only; applying the preview is an explicit create-only action. Existing MSO identities are preserved. Direct credential values are never copied silently; move them with the encrypted bundle/private transfer flow. MSO remains fully standalone when SC is absent. The equivalent explicit command is `mso integrations import-sc`.## CLIdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex cb0b36fe..950a433e 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,5 +1,21 @@## 2026-09-14 — Project MCP HTTP discover falls back on JSON-RPC -32601+## 2026-09-14 — Native Integrations shell and project-scoped SC activation++Before: Integrations had a standalone page but no app descriptor/catalog entry; plugin+registry declarations looked disconnected from runtime; SC detection assumed its checkout+folder was named `si-coder-agent`. After: a pinned native Integrations shell window reuses+the existing manager, reviewed built-ins can be explicitly bound to exact projects from+Settings, and package/bin identity accepts legitimate renamed worktrees without invoking+an unrelated system `sc`. Managed SC account/status/verification calls resolve through MSO+Integrations; standalone SC remains unchanged and no credential synchronization is applied.++The registry distinguishes configured from verified. Existing project MCP discovery/call+tools remain the verification path; no new privileged browser execution endpoint is added.+Batonly remains project/task/evidence authority. See `docs/INTEGRATIONS.md` for the managed+binding contract and the explicit limits on SC's exposed managed tool surface.++`project_mcp_tools` probed modern `server/discover` and treated only HTTP 400/404/405as unsupported. A legacy-only HTTP MCP that answers JSON-RPC method-not-found on HTTP 200— the usual JSON-RPC wire — entered the fallback branch and then threw `-32601` becausediff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.mdindex 9d8f3a00..0e024269 100644--- a/docs/generated/MCP-CATALOG.md+++ b/docs/generated/MCP-CATALOG.md@@ -4,13 +4,13 @@## Full MSO catalog-<!-- mcp-toolset: server=1.14.0 version=2026.09.12.3 tools=104 read=49 write=34 exec=21 -->+<!-- mcp-toolset: server=1.14.1 version=2026.09.14.1 tools=104 read=49 write=34 exec=21 -->| Fact | Current source value ||---|---:|-| MCP server | `1.14.0` |-| Toolset | `2026.09.12.3` |-| Toolset changed at | `2026-09-12T15:00:00Z` |+| MCP server | `1.14.1` |+| Toolset | `2026.09.14.1` |+| Toolset changed at | `2026-09-14T15:44:00Z` || Transport tools | **106** || Model/operator tools | **104** || Read | **49** |@@ -138,7 +138,7 @@## ChatGPT model profile-<!-- mcp-chatgpt-profile: server=1.14.0 version=2026.09.12.3 tools=104 read=49 write=34 exec=21 app-only=2 total=106 -->+<!-- mcp-chatgpt-profile: server=1.14.1 version=2026.09.14.1 tools=104 read=49 write=34 exec=21 app-only=2 total=106 -->The ChatGPT profile automatically projects the complete MSO-owned generic model/operator catalog. OAuth scope is still enforced independently; app-only compatibility bridges stay app-only, and project-owned MCP tool names remain dynamic data behind the generic project bridge.diff --git a/frontend/slices/app-store/lib/system-catalog.ts b/frontend/slices/app-store/lib/system-catalog.tsindex 2e0a4c95..5acfe306 100644--- a/frontend/slices/app-store/lib/system-catalog.ts+++ b/frontend/slices/app-store/lib/system-catalog.ts@@ -18,6 +18,7 @@ import {LayoutGrid,Cloud,ServerCog,+ Plug,type LucideIcon,} from "lucide-react";@@ -42,6 +43,7 @@ export type SystemEntry = {export const SYSTEM_CATALOG: SystemEntry[] = [// ── Built-in apps ─────────────────────────────────────────────────────────+ { id: "integrations", title: "Integrations", kind: "app", icon: Plug, gradient: "var(--primary)", desc: "Manage native service accounts, connections, and private setup." },{ id: "files-manager", title: "Files", kind: "app", icon: Folder, gradient: "linear-gradient(160deg,#3aa0ff,#1f6dff)", desc: "Browse, upload, and manage host files." },{ id: "browser", title: "Browser", kind: "app", icon: Globe, gradient: "linear-gradient(160deg,#22b1ff,#1666e0)", desc: "Tabbed web viewer — pages render in a sandboxed embedded frame." },{ id: "code-editor", title: "Code", kind: "app", icon: Code, gradient: "linear-gradient(160deg,#7a5cff,#4f2fd6)", desc: "Edit host files in a tabbed code editor." },diff --git a/frontend/slices/infrastructure/index.tsx b/frontend/slices/infrastructure/index.tsxindex 218484ef..753f1827 100644--- a/frontend/slices/infrastructure/index.tsx+++ b/frontend/slices/infrastructure/index.tsx@@ -1,4 +1,4 @@-import { Cloud, ServerCog } from "lucide-react";+import { Cloud, Plug, ServerCog } from "lucide-react";import type { AppDescriptor } from "@/features/appshell";export type InfrastructureFeatureId = "dokploy" | "cloudflare";@@ -20,3 +20,10 @@ function descriptor(id: InfrastructureFeatureId): AppDescriptor {export const dokployApp = descriptor("dokploy");export const cloudflareApp = descriptor("cloudflare");++/** A shell app over the existing native manager, not another connection store. */+export const integrationsApp: AppDescriptor = {+ id: "integrations", title: "Integrations", icon: Plug, gradient: "var(--primary)",+ load: () => import("./integrations-app"),+ defaultSize: { w: 1040, h: 720 },+};diff --git a/frontend/slices/infrastructure/integrations-app.test.ts b/frontend/slices/infrastructure/integrations-app.test.tsnew file mode 100644index 00000000..d382a3e9--- /dev/null+++ b/frontend/slices/infrastructure/integrations-app.test.ts@@ -0,0 +1,18 @@+import { readFileSync } from "node:fs";+import { describe, expect, it } from "vitest";+import { managerLocation } from "./integrations-app";+import { integrationsApp } from "./index";++describe("native Integrations shell app", () => {+ it("has a dockable descriptor and a matching app catalog entry", () => {+ expect(integrationsApp.id).toBe("integrations");+ expect(integrationsApp.noDock).not.toBe(true);+ expect(readFileSync("frontend/slices/app-store/lib/system-catalog.ts", "utf8")).toContain('id: "integrations", title: "Integrations", kind: "app"');+ const manifest = readFileSync("frontend/slices/os-shell/shell.manifest.ts", "utf8");+ expect(manifest).toContain('pin(withSlug(integrationsApp, "connections"))');+ });+ it("keeps transfer and private fragment handoffs inside the existing manager", () => {+ expect(managerLocation("?transfer=1&untrusted=ignore", "#example-capability")).toBe("/integrations/manager?transfer=1#example-capability");+ expect(managerLocation("?target=https://untrusted.invalid")).toBe("/integrations/manager");+ });+});diff --git a/frontend/slices/infrastructure/integrations-app.tsx b/frontend/slices/infrastructure/integrations-app.tsxnew file mode 100644index 00000000..5c0a7512--- /dev/null+++ b/frontend/slices/infrastructure/integrations-app.tsx@@ -0,0 +1,37 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { Button } from "@/components/ui/button";++/** Preserve transfer/setup deep links without putting private capabilities in React state. */+export function managerLocation(search: string, hash = "") {+ const transfer = new URLSearchParams(search).get("transfer") === "1";+ return "/integrations/manager" + (transfer ? "?transfer=1" : "") + hash;+}++export default function IntegrationsApp() {+ const frame = useRef<HTMLIFrameElement>(null);+ const [status, setStatus] = useState<"loading" | "ready" | "error">("loading");+ const [retry, setRetry] = useState(0);+ useEffect(() => {+ const target = frame.current;+ if (!target) return;+ target.src = managerLocation(window.location.search, window.location.hash);+ if (window.location.hash) window.history.replaceState(window.history.state, "", window.location.pathname + window.location.search);+ const timer = window.setTimeout(() => setStatus(current => current === "loading" ? "error" : current), 15000);+ return () => window.clearTimeout(timer);+ }, [retry]);+ return (+ <section className="flex h-full min-h-0 flex-col bg-background" aria-label="Integrations">+ {status !== "ready" && <div className="flex items-center justify-between gap-3 border-b p-3">+ <p role={status === "error" ? "alert" : "status"} className="text-sm text-muted-foreground">+ {status === "error" ? "The connection manager did not finish loading." : "Opening the native connection manager…"}+ </p>+ {status === "error" && <Button variant="secondary" onClick={() => { setStatus("loading"); setRetry(n => n + 1); }}>Retry</Button>}+ </div>}+ <iframe ref={frame} title="MSO native Integrations manager" className="min-h-0 w-full flex-1 border-0"+ referrerPolicy="no-referrer" onLoad={() => { if (frame.current?.getAttribute("src")) setStatus("ready"); }}+ onError={() => setStatus("error")} />+ </section>+ );+}diff --git a/frontend/slices/os-settings/components/mcp-plugin-registry.tsx b/frontend/slices/os-settings/components/mcp-plugin-registry.tsxindex 5a03deb0..fb571d9f 100644--- a/frontend/slices/os-settings/components/mcp-plugin-registry.tsx+++ b/frontend/slices/os-settings/components/mcp-plugin-registry.tsx@@ -1,6 +1,8 @@"use client";import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { McpPluginRuntime } from "./mcp-plugin-runtime";import { Textarea } from "@/components/ui/textarea";import { SettingsBlock } from "@/features/shell-settings";import {@@ -35,6 +37,7 @@ function restoreCustomPlugins(raw: string | null) {export function McpPluginRegistry() {const [custom, setCustom] = useState<PluginManifest[]>([]);+ const [project, setProject] = useState("");const [source, setSource] = useState("");const [message, setMessage] = useState("Custom manifests are validated only. Registration never installs or runs plugin code.",@@ -84,12 +87,16 @@ export function McpPluginRegistry() {<SettingsBlock className="space-y-3 py-4"><div className="flex flex-wrap items-center gap-2"><p className="text-sm font-medium">Plugins / Registry</p>- <span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground">declarations only</span>+ <span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground">project-scoped activation</span></div><p className="text-sm text-muted-foreground">SI-Coder, Batonly, and custom plugins use the same portable manifest. A declaration may describe Agent Skills andMCP surfaces, but never credentials, environment values, headers, or shell commands.</p>+ <label className="grid gap-2 text-sm">Exact target project+ <Input value={project} onChange={event => setProject(event.target.value)} placeholder="Project name, ID, or absolute path" aria-label="Plugin target project" />+ </label>+ <p className="text-xs text-muted-foreground">Inspect before activation. A configured binding is not proof that discovery or a tool call works. Custom declarations remain inactive.</p><ul className="grid gap-2 sm:grid-cols-2" aria-label="Registered plugins">{plugins.map((plugin) => {const isCustom = custom.some((item) => item.id === plugin.id);@@ -99,7 +106,7 @@ export function McpPluginRegistry() {<div className="min-w-0"><div className="flex flex-wrap items-center gap-2"><p className="text-sm font-medium">{plugin.metadata.name}</p>- <span className="text-xs text-muted-foreground">v{plugin.version}</span>+ <span className="text-xs text-muted-foreground">Manifest v{plugin.version}</span><span className="rounded-full bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground">{isCustom ? "Custom" : "Built-in"}</span>@@ -116,6 +123,7 @@ export function McpPluginRegistry() {</Button>) : null}</div>+ {!isCustom && <McpPluginRuntime key={`${plugin.id}:${project}`} plugin={plugin.id} project={project} endpoint={plugin.mcp?.find(row => row.transport === "https")?.endpoint} />}</li>);})}diff --git a/frontend/slices/os-settings/components/mcp-plugin-runtime.tsx b/frontend/slices/os-settings/components/mcp-plugin-runtime.tsxnew file mode 100644index 00000000..2019373f--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-plugin-runtime.tsx@@ -0,0 +1,54 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { openWindow } from "@/features/appshell";++type Receipt = { revision?: string; configured: boolean };++/** Uses the existing owner-only project binding API; registration is not a health check. */+export function McpPluginRuntime({ plugin, project, endpoint }: { plugin: string; project: string; endpoint?: string }) {+ const [receipt, setReceipt] = useState<Receipt>({ configured: false });+ const [busy, setBusy] = useState(false);+ const [message, setMessage] = useState("Not inspected for this project.");+ const [user, setUser] = useState("");+ const [connection, setConnection] = useState("");+ const operation = useRef<AbortController | null>(null);+ useEffect(() => () => operation.current?.abort(), []);+ async function run(action: "inspect" | "upsert" | "delete") {+ operation.current?.abort(); const controller = new AbortController(); operation.current = controller;+ setBusy(true);+ try {+ const args = { project, server: plugin, action, ...(action !== "inspect" ? { revision: receipt.revision } : {}),+ ...(action === "upsert" ? plugin === "si-coder" ? { plugin: "si-coder" } : { url: endpoint, user, connection } : {}) };+ const response = await fetch("/api/v1/project-mcp", { method: "POST", credentials: "same-origin", cache: "no-store", signal: controller.signal,+ headers: { "Content-Type": "application/json" }, body: JSON.stringify(args) });+ const data = await response.json();+ if (!response.ok) throw new Error(data.error || "Plugin operation failed");+ const configured = action === "inspect" ? data.servers?.some((server: { name: string }) => server.name === plugin) === true : action === "upsert";+ setReceipt({ revision: data.revision, configured });+ setMessage(configured ? "Project binding configured. Tool discovery and execution have not been verified by this panel." : "Declared only; no binding in this project.");+ } catch (error) {+ if (!controller.signal.aborted) setMessage(error instanceof Error ? error.message : "Plugin operation failed");+ } finally { if (!controller.signal.aborted) setBusy(false); }+ }+ return <div className="mt-3 space-y-3 border-t pt-3">+ <p role="status" className="break-words text-xs font-medium">{busy ? "Checking project binding…" : message}</p>+ <p className="text-xs text-muted-foreground">{plugin === "si-coder"+ ? "Managed mode uses MSO accounts and connection verification. Standalone SC is unchanged. Provider writes use native Integrations."+ : "Batonly owns project plans, tasks, and evidence. Bind an exact private MCP connection from MSO Integrations."}</p>+ {plugin === "batonly" && <div className="grid gap-2">+ <Input aria-label="Batonly connection owner" placeholder="MSO connection owner" value={user} disabled={busy} onChange={event => setUser(event.target.value)} />+ <Input aria-label="Batonly named MCP connection" placeholder="Named MCP connection, not a token" value={connection} disabled={busy} onChange={event => setConnection(event.target.value)} />+ </div>}+ <div className="flex flex-wrap gap-2">+ <Button variant="secondary" size="sm" disabled={busy || !project.trim()} onClick={() => void run("inspect")}>Inspect binding</Button>+ <Button size="sm" disabled={busy || !receipt.revision || (plugin === "batonly" && (!user || !connection))}+ onClick={() => { if (!receipt.configured || window.confirm("Replace this project's existing plugin binding?")) void run("upsert"); }}>{receipt.configured ? "Replace binding" : "Activate in project"}</Button>+ {receipt.configured && <Button variant="ghost" size="sm" disabled={busy} onClick={() => { if (window.confirm("Remove only this project's binding? Other projects and remote accounts are unchanged.")) void run("delete"); }}>Deactivate</Button>}+ <Button variant="ghost" size="sm" onClick={() => openWindow("integrations", "Integrations")}>Open Integrations</Button>+ </div>+ {receipt.configured && <p className="text-xs text-muted-foreground">Verify through MSO with <code>project_mcp_tools</code> for this project and server <code>{plugin}</code>{plugin === "si-coder" ? ", then project_mcp_call → sc.version." : ". Discovery is not proof of every remote operation."}</p>}+ </div>;+}diff --git a/frontend/slices/os-shell/shell.manifest.ts b/frontend/slices/os-shell/shell.manifest.tsindex e7fee2f6..a1d06d4b 100644--- a/frontend/slices/os-shell/shell.manifest.ts+++ b/frontend/slices/os-shell/shell.manifest.ts@@ -20,7 +20,7 @@ import { hermesApp, nineRouterApp, openclawApp } from "@/features/managed-apps";import { osSettingsApp } from "@/features/os-settings";import { quicklinksApp } from "@/features/quicklinks";import { docsApp } from "@/features/docs";-import { cloudflareApp, dokployApp } from "@/features/infrastructure";+import { cloudflareApp, dokployApp, integrationsApp } from "@/features/infrastructure";import { themeQuickPickerFeature } from "./theme-quick-picker";import { APP_MARKS } from "./brand-marks";@@ -64,6 +64,7 @@ export const BUILTIN_APPS: AppDescriptor[] = [withSlug(withArtwork(hermesApp), "hermes"),withSlug(withArtwork(openclawApp), "openclaw"),withSlug(withArtwork(nineRouterApp), "9router"),+ pin(withSlug(integrationsApp, "connections")),withSlug(withArtwork(dokployApp), "dokploy"),withSlug(withArtwork(cloudflareApp), "cloudflare"),withSlug(withArtwork(quicklinksApp), "links"),diff --git a/lib/contracts/project-mcp.ts b/lib/contracts/project-mcp.tsindex 695c0274..ea658851 100644--- a/lib/contracts/project-mcp.ts+++ b/lib/contracts/project-mcp.ts@@ -1,6 +1,8 @@/** Metadata returned by project discovery; credential values are never DTOs. */export type PublicProjectMcpServer = {name: string;+ plugin?: "si-coder";+ credentialAuthority?: "mso";transport: "stdio" | "http";auth: "none" | "configured" | "oauth" | "integration";};diff --git a/lib/host/project-mcp-config.ts b/lib/host/project-mcp-config.tsindex f050aed7..0b203e10 100644--- a/lib/host/project-mcp-config.ts+++ b/lib/host/project-mcp-config.ts@@ -9,10 +9,11 @@ const MAX_SERVERS = 16;const MAX_ARGV = 32;const MAX_VALUE = 4096;-type BaseServer = { protocolVersion?: "2026-07-28"; integration?: { user: string; connection: string }; name: string; headers: Record<string, string>; oauthConfigured: boolean };+type BaseServer = { consumer?: "mso"; protocolVersion?: "2026-07-28"; integration?: { user: string; connection: string }; name: string; headers: Record<string, string>; oauthConfigured: boolean };export type ProjectMcpServer = BaseServer & (| { transport: "stdio"; command: string; args: string[]; cwd: string; env: Record<string, string> }| { transport: "http"; url: string }+ | { transport: "plugin"; plugin: "si-coder"; cwd: string });export type { PublicProjectMcpServer } from "@/lib/contracts/project-mcp";@@ -62,6 +63,11 @@ export async function readProjectMcpServers(projectPath: string): Promise<Projecif (value.command || oauthConfigured || Object.keys(headers).some((key) => key.toLowerCase() === "authorization")) throw new Error(`${name}: conflicting MCP authentication configuration`);integration = { user: ref.user, connection: ref.connection };}+ if (value.plugin !== undefined) {+ if (value.plugin !== "si-coder" || value.credentialAuthority !== "mso" || Object.keys(value).some(key => !["plugin", "credentialAuthority"].includes(key))) throw new Error("invalid managed plugin declaration");+ out.push({ name, transport: "plugin", plugin: "si-coder", cwd: projectPath, headers: {}, oauthConfigured: false });+ continue;+ }if (typeof value.command === "string" && value.command.trim() && value.command.length <= MAX_VALUE) {const args = value.args === undefined ? [] : strings(value.args, MAX_ARGV);if (value.args !== undefined && !args.length && Array.isArray(value.args) && value.args.length) throw new Error(`${name}: invalid args`);@@ -76,5 +82,5 @@ export async function readProjectMcpServers(projectPath: string): Promise<Projec}export function publicProjectMcpServers(servers: ProjectMcpServer[]): PublicProjectMcpServer[] {- return servers.map((server) => ({ name: server.name, transport: server.transport, auth: server.integration ? "integration" : server.oauthConfigured ? "oauth" : Object.keys(server.headers).length ? "configured" : "none" }));+ return servers.map((server) => ({ name: server.name, transport: server.transport === "plugin" ? "stdio" : server.transport, ...(server.transport === "plugin" ? { plugin: server.plugin, credentialAuthority: "mso" as const } : {}), auth: server.transport === "plugin" || server.integration ? "integration" : server.oauthConfigured ? "oauth" : Object.keys(server.headers).length ? "configured" : "none" }));}diff --git a/lib/host/project-mcp-manage.test.ts b/lib/host/project-mcp-manage.test.tsindex 88830384..fbbc17ac 100644--- a/lib/host/project-mcp-manage.test.ts+++ b/lib/host/project-mcp-manage.test.ts@@ -21,3 +21,15 @@ it("preserves existing servers, refuses stale revisions and stores only privateawait manageProjectMcp(root, { action: "delete", server: "one", revision: current.revision });expect((await inspectProjectMcp(root)).servers.map(s => s.name)).toEqual(["two"]);});++it("stores managed SC without a command or copied account and permits removal when SC is absent", async () => {+ root = await fs.mkdtemp(path.join(os.tmpdir(), "mso-managed-sc-"));+ vi.stubEnv("OS_FS_WRITE_ROOTS", root); vi.stubEnv("OS_FS_READ_ROOTS", root); vi.resetModules();+ const { inspectProjectMcp, manageProjectMcp } = await import("./project-mcp-manage");+ const saved = await manageProjectMcp(root, { action: "upsert", server: "si-coder", revision: "new", plugin: "si-coder" });+ expect(JSON.parse(await fs.readFile(path.join(root, ".mcp.json"), "utf8"))).toEqual({ mcpServers: { "si-coder": { plugin: "si-coder", credentialAuthority: "mso" } } });+ expect((await inspectProjectMcp(root)).servers[0]).toMatchObject({ name: "si-coder", transport: "stdio", plugin: "si-coder", credentialAuthority: "mso" });+ await expect(manageProjectMcp(root, { action: "upsert", server: "si-coder", revision: saved.revision, plugin: "si-coder", user: "other" })).rejects.toThrow("no copied account");+ await manageProjectMcp(root, { action: "delete", server: "si-coder", revision: saved.revision });+ expect((await inspectProjectMcp(root)).servers).toHaveLength(0);+});diff --git a/lib/host/project-mcp-manage.ts b/lib/host/project-mcp-manage.tsindex daea22f3..e889edff 100644--- a/lib/host/project-mcp-manage.ts+++ b/lib/host/project-mcp-manage.ts@@ -27,7 +27,7 @@ export async function inspectProjectMcp(projectPath: string) {const stored = await manifest(projectPath);return { revision: stored.revision, servers: publicProjectMcpServers(await readProjectMcpServers(projectPath)) };}-export async function manageProjectMcp(projectPath: string, input: { action: "upsert" | "delete"; server: string; revision: string; url?: string; user?: string; connection?: string }) {+export async function manageProjectMcp(projectPath: string, input: { action: "upsert" | "delete"; server: string; revision: string; plugin?: "si-coder"; url?: string; user?: string; connection?: string }) {if (!/^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/.test(input.server) || ["__proto__", "constructor", "prototype"].includes(input.server)) throw new Error("invalid MCP server alias");return withSecurityStoreLock(path.join(projectPath, ".mcp.json"), async () => {const stored = await manifest(projectPath);@@ -36,6 +36,10 @@ export async function manageProjectMcp(projectPath: string, input: { action: "upconst servers = { ...((stored.data[key] ?? {}) as Record<string, unknown>) };if (input.action === "delete") delete servers[input.server];else {+ if (input.plugin) {+ if (input.plugin !== "si-coder" || input.url || input.user || input.connection) throw new Error("managed SC has no copied account configuration");+ servers[input.server] = { plugin: "si-coder", credentialAuthority: "mso" };+ } else {const url = normalizeMcpEndpoint(input.url ?? "");let integration: { user: string; connection: string } | undefined;if (input.user || input.connection) {@@ -45,6 +49,7 @@ export async function manageProjectMcp(projectPath: string, input: { action: "upif (values.endpoint && normalizeMcpEndpoint(values.endpoint) !== url) throw new Error("MCP endpoint does not match the private connection");}servers[input.server] = { url, ...(integration ? { integration } : {}) };+ }}if (Object.keys(servers).length > 16) throw new Error("project MCP limit is 16 servers");const content = JSON.stringify({ ...stored.data, [key]: servers }, null, 2) + "\n";diff --git a/lib/host/project-mcp-transport.ts b/lib/host/project-mcp-transport.tsindex 84d84277..94cc8cc6 100644--- a/lib/host/project-mcp-transport.ts+++ b/lib/host/project-mcp-transport.ts@@ -4,6 +4,8 @@ import { withHttp } from "./project-mcp-http";import { projectMcpAuthorization } from "./project-mcp-auth";import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";import { childEnv } from "./child-env";+import { resolveManagedSc } from "./sc-managed";+import { managedScCall, managedScTools } from "./sc-consumer";import type { ProjectMcpServer } from "./project-mcp-config";const PROTOCOL = "2025-11-25";@@ -86,19 +88,30 @@ async function withStdio<T>(server: Extract<ProjectMcpServer, { transport: "stdi}export async function withProjectMcpServer<T>(server: ProjectMcpServer, work: (rpc: (method: string, params?: unknown) => Promise<Rpc>) => Promise<T>): Promise<T> {+ if (server.transport === "plugin") return withProjectMcpServer(await resolveManagedSc(server), work);const auth = await projectMcpAuthorization(server);const guarded = async (rpc: (method: string, params?: unknown) => Promise<Rpc>) => work(async (method, params) => {if (method === "tools/call" && auth.allowed && !auth.allowed.includes(String((params as { name?: string })?.name))) throw new Error("project MCP tool is not allowed by this connection");// Re-resolve at each RPC: removing or changing the named connection takes effect now.const current = await projectMcpAuthorization(server);if (JSON.stringify(current.server.headers) !== JSON.stringify(auth.server.headers) || JSON.stringify(current.allowed) !== JSON.stringify(auth.allowed)) throw new Error("project MCP connection changed; rediscover before continuing");+ if (server.consumer === "mso" && method === "tools/call") {+ const call = params as { name?: unknown; arguments?: unknown };+ const managed = await managedScCall(String(call?.name), call?.arguments ?? {});+ if (managed.handled) return { jsonrpc: "2.0", result: managed.result } as Rpc;+ }const row = auth.redact(await rpc(method, params)) as Rpc;+ if (server.consumer === "mso" && method === "tools/list" && row.result && typeof row.result === "object") {+ const result = row.result as { tools?: ProjectMcpTool[] };+ if (Array.isArray(result.tools)) result.tools = managedScTools(result.tools);+ }if (method === "tools/list" && auth.allowed && row.result && typeof row.result === "object") {const result = row.result as { tools?: ProjectMcpTool[] };if (Array.isArray(result.tools)) result.tools = result.tools.filter((tool) => auth.allowed!.includes(tool.name));}return row;});+ if (auth.server.transport === "plugin") throw new Error("unresolved managed plugin");try { return await (auth.server.transport === "stdio" ? withStdio(auth.server, (rpc) => guarded(rpc)) : withHttp(auth.server, guarded)); }catch (error) { throw new Error(String(auth.redact(error instanceof Error ? error.message : "project MCP request failed"))); }}diff --git a/lib/host/sc-consumer.test.ts b/lib/host/sc-consumer.test.tsnew file mode 100644index 00000000..b68ec05d--- /dev/null+++ b/lib/host/sc-consumer.test.ts@@ -0,0 +1,25 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+const native = vi.hoisted(() => ({ query: vi.fn(), execute: vi.fn() }));+const executeNative = (mode: "query" | "execute", args: Record<string, unknown>) => mode === "query" ? native.query(args) : native.execute(args);+import { managedScCall, managedScTools } from "./sc-consumer";+beforeEach(() => { vi.clearAllMocks(); native.query.mockResolvedValue({ users: [] }); native.execute.mockResolvedValue({ verified: true }); });+describe("SC consumes MSO authority", () => {+ it("routes account discovery into native MSO rather than SC's store", async () => {+ const result = await managedScCall("sc.user.list", {}, executeNative);+ expect(native.query).toHaveBeenCalledWith({ view: "users" }); expect(result.handled).toBe(true);+ });+ it("requires the exact connection for verification with no account fallback", async () => {+ await expect(managedScCall("sc.user.provider.verify", { user: "owner", provider: "github" }, executeNative)).rejects.toThrow("explicit_mso_connection_context_required");+ expect(native.execute).not.toHaveBeenCalled();+ await managedScCall("sc.user.provider.verify", { user: "owner", provider: "cf", connection: "work" }, executeNative);+ expect(native.execute).toHaveBeenCalledWith({ user: "owner", provider: "cloudflare", connection: "work", operation: "verify" });+ });+ it("hides and refuses duplicate-store writes, transfers and unaudited execution", async () => {+ const names = ["sc.version", "sc.user.list", "sc.user.create", "sc.data.import", "sc.flow.run"];+ expect(managedScTools(names.map(name => ({ name, inputSchema: {} }))).map(t => t.name)).toEqual(["sc.version", "sc.user.list"]);+ for (const name of names.slice(2)) await expect(managedScCall(name, {})).rejects.toThrow("unavailable in MSO-managed SC");+ });+ it("leaves standalone workspace tools on the local MCP implementation", async () => {+ expect(await managedScCall("sc.version", {})).toEqual({ handled: false }); expect(native.query).not.toHaveBeenCalled();+ });+});diff --git a/lib/host/sc-consumer.ts b/lib/host/sc-consumer.tsnew file mode 100644index 00000000..c0613701--- /dev/null+++ b/lib/host/sc-consumer.ts@@ -0,0 +1,42 @@+import { metadataOnly } from "@/lib/infra/identity";+import type { ProjectMcpTool } from "@/lib/contracts/project-mcp";++/** Managed SC keeps developer utilities, not a second account/provider control plane. */+const WORKSPACE_TOOLS = new Set([+ "sc.product.interview", "sc.deploy.plan", "sc.version", "sc.task.risk", "sc.task.prepare",+ "sc.skill.verify", "sc.verify", "sc.recipe.list", "sc.flow.list", "sc.flow.show", "sc.flow.validate",+]);+type NativeRoute = { view?: string; required: string[]; fields: string[]; description: string };+const ROUTES: Record<string, NativeRoute> = {+ "sc.user.list": { view: "users", required: [], fields: [], description: "List native MSO integration users; not the standalone SC store." },+ "sc.providers.list": { view: "catalog", required: [], fields: [], description: "List the native MSO provider catalog." },+ "sc.user.which": { view: "which", required: ["cwd"], fields: ["cwd"], description: "Resolve an exact directory using MSO folder bindings." },+ "sc.user.connections.list": { view: "connections", required: ["user"], fields: ["user", "provider"], description: "List an explicit user's native MSO connections." },+ "sc.user.connection.request": { view: "request", required: ["user", "provider"], fields: ["user", "provider", "connection", "source", "authMethod"], description: "Get native MSO setup metadata. Enter values only in MSO Integrations." },+ "sc.user.credentials.status": { view: "request", required: ["user", "provider", "connection"], fields: ["user", "provider", "connection"], description: "Inspect the exact native MSO connection without returning values." },+ "sc.user.provider.verify": { required: ["user", "provider", "connection"], fields: ["user", "provider", "connection"], description: "Verify one exact MSO connection; never fall back to standalone SC accounts." },+};+const nativeRoute = (name: string) => Object.hasOwn(ROUTES, name) ? ROUTES[name] : undefined;+export function managedScTools(tools: ProjectMcpTool[]): ProjectMcpTool[] {+ return tools.flatMap(tool => {+ const route = nativeRoute(tool.name);+ if (route) return [{ ...tool, description: "MSO-managed: " + route.description,+ inputSchema: { type: "object", properties: Object.fromEntries(route.fields.map(field => [field, { type: "string", maxLength: field === "cwd" ? 4096 : 64 }])), required: route.required, additionalProperties: false } }];+ return WORKSPACE_TOOLS.has(tool.name) ? [tool] : [];+ });+}+export async function managedScCall(name: string, raw: unknown, executeNative?: (mode: "query" | "execute", args: Record<string, unknown>) => Promise<unknown>): Promise<{ handled: false } | { handled: true; result: unknown }> {+ if (WORKSPACE_TOOLS.has(name)) return { handled: false };+ const route = nativeRoute(name);+ if (!route) throw new Error("Tool unavailable in MSO-managed SC. Use native MSO Integrations for provider actions, or explicitly use standalone SC.");+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error("SC tool arguments must be an object");+ const args = raw as Record<string, unknown>;+ metadataOnly(args);+ if (Object.keys(args).some(key => !route.fields.includes(key)) || Object.values(args).some(value => typeof value !== "string")) throw new Error("invalid_managed_sc_fields");+ if (route.required.some(field => typeof args[field] !== "string" || !String(args[field]).trim())) throw new Error("explicit_mso_connection_context_required");+ const input = { ...args, ...(args.provider === "cf" ? { provider: "cloudflare" } : {}) };+ if (!executeNative) throw new Error("MSO-managed provider functions require the project_mcp_call capability");+ const result = await executeNative(route.view ? "query" : "execute", route.view ? { ...input, view: route.view } : { ...input, operation: "verify" });+ const structuredContent = { authority: "mso", result };+ return { handled: true, result: { content: [{ type: "text", text: JSON.stringify(structuredContent) }], structuredContent } };+}diff --git a/lib/host/sc-installation.d.mts b/lib/host/sc-installation.d.mtsnew file mode 100644index 00000000..a9765f57--- /dev/null+++ b/lib/host/sc-installation.d.mts@@ -0,0 +1,2 @@+export interface ScInstallation { name: string; version: string; root: string; bin: string; mcpEntrypoint: string; }+export function inspectScInstallation(candidate: string): Promise<ScInstallation>;diff --git a/lib/host/sc-installation.mjs b/lib/host/sc-installation.mjsnew file mode 100644index 00000000..04126f25--- /dev/null+++ b/lib/host/sc-installation.mjs@@ -0,0 +1,33 @@+import { promises as fs } from "node:fs";+import path from "node:path";+import { fileURLToPath } from "node:url";++/** Inspect the declared package/bin identity without executing an unrelated `sc` program. */+export async function inspectScInstallation(candidate) {+ const bin = await fs.realpath(candidate);+ const binStat = await fs.stat(bin);+ if (!binStat.isFile() || (binStat.mode & 0o022)) throw new Error("unsafe_sc_binary");+ let directory = path.dirname(bin);+ for (let depth = 0; depth < 6; depth++) {+ const packagePath = path.join(directory, "package.json");+ const stat = await fs.lstat(packagePath).catch(() => null);+ if (stat) {+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 65536 || (stat.mode & 0o022)) throw new Error("unsafe_sc_package");+ const pkg = JSON.parse(await fs.readFile(packagePath, "utf8"));+ if (pkg.name !== "si-coder-agent" || typeof pkg.version !== "string" || typeof pkg.bin?.sc !== "string") throw new Error("not_si_coder");+ const declared = await fs.realpath(path.resolve(directory, pkg.bin.sc));+ if (declared !== bin || !bin.startsWith(directory + path.sep)) throw new Error("sc_bin_identity_mismatch");+ return { name: pkg.name, version: pkg.version, root: directory, bin, mcpEntrypoint: path.join(directory, "scripts", "sc-mcp.js") };+ }+ const parent = path.dirname(directory);+ if (parent === directory) break;+ directory = parent;+ }+ throw new Error("sc_package_not_found");+}++if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ inspectScInstallation(process.argv[2] || "").then(result => {+ process.stdout.write(process.argv.includes("--json") ? JSON.stringify(result) + "\n" : result.bin + "\n");+ }).catch(() => { process.stderr.write("SI-Coder package identity could not be verified.\n"); process.exitCode = 1; });+}diff --git a/lib/host/sc-installation.test.ts b/lib/host/sc-installation.test.tsnew file mode 100644index 00000000..b943752e--- /dev/null+++ b/lib/host/sc-installation.test.ts@@ -0,0 +1,28 @@+import { promises as fs } from "node:fs";+import os from "node:os";+import path from "node:path";+import { afterEach, describe, expect, it } from "vitest";+import { inspectScInstallation } from "./sc-installation.mjs";+const roots: string[] = [];+async function fixture(name = "si-coder-agent") {+ const root = await fs.mkdtemp(path.join(os.tmpdir(), "renamed-sc-worktree-")); roots.push(root);+ await fs.mkdir(path.join(root, "bin"));+ const bin = path.join(root, "bin", "sc-entry.js");+ await fs.writeFile(bin, "// public synthetic entrypoint\n", { mode: 0o700 });+ await fs.writeFile(path.join(root, "package.json"), JSON.stringify({ name, version: "0.9.8", bin: { sc: "bin/sc-entry.js" } }), { mode: 0o600 });+ return { root, bin };+}+afterEach(async () => { await Promise.all(roots.splice(0).map(root => fs.rm(root, { recursive: true, force: true }))); });+describe("SC package identity", () => {+ it("accepts a renamed worktree and a user-local symlink", async () => {+ const f = await fixture(); const link = path.join(f.root, "sc"); await fs.symlink(f.bin, link);+ expect(await inspectScInstallation(link)).toMatchObject({ root: f.root, name: "si-coder-agent", version: "0.9.8" });+ });+ it("rejects another program named sc without executing it", async () => {+ await expect(inspectScInstallation((await fixture("other-package")).bin)).rejects.toThrow("not_si_coder");+ });+ it("rejects a writable executable", async () => {+ const f = await fixture(); await fs.chmod(f.bin, 0o777);+ await expect(inspectScInstallation(f.bin)).rejects.toThrow("unsafe_sc_binary");+ });+});diff --git a/lib/host/sc-managed.ts b/lib/host/sc-managed.tsnew file mode 100644index 00000000..50bdcef9--- /dev/null+++ b/lib/host/sc-managed.ts@@ -0,0 +1,15 @@+import os from "node:os";+import path from "node:path";+import { promises as fs } from "node:fs";+import { inspectScInstallation } from "./sc-installation.mjs";+import type { ProjectMcpServer } from "./project-mcp-config";++/** Only a reviewed, installed package can become this managed local plugin. */+export async function resolveManagedSc(server: Extract<ProjectMcpServer, { transport: "plugin" }>): Promise<Extract<ProjectMcpServer, { transport: "stdio" }>> {+ const installation = await inspectScInstallation(process.env.MSO_SC_BIN || path.join(os.homedir(), ".local", "bin", "sc"));+ const entrypoint = await fs.realpath(installation.mcpEntrypoint);+ const stat = await fs.stat(entrypoint);+ if (!entrypoint.startsWith(installation.root + path.sep) || !stat.isFile() || (stat.mode & 0o022)) throw new Error("unsafe_sc_mcp_entrypoint");+ return { name: server.name, transport: "stdio", command: process.execPath, args: [entrypoint], cwd: server.cwd,+ env: {}, headers: {}, oauthConfigured: false, consumer: "mso" };+}diff --git a/lib/infra/setup-page.ts b/lib/infra/setup-page.tsindex 2a68047e..065d8b65 100644--- a/lib/infra/setup-page.ts+++ b/lib/infra/setup-page.ts@@ -6,13 +6,16 @@ import { INTEGRATION_FORM_SCRIPT, INTEGRATION_FORM_STYLE } from "./setup-ui";import { CONNECTION_MANAGER_SCRIPT, CONNECTION_MANAGER_STYLE } from "./connection-ui";import { INTEGRATION_BROWSER_SCRIPT } from "./setup-browser";import { connectionCatalog } from "./connection-registry";-export function integrationSetupPage() {+export function integrationSetupPage(embedded = false) {const nonce = randomBytes(18).toString("base64");const catalog = JSON.stringify(connectionCatalog()).replace(/</g,"\\u003c");- const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="referrer" content="no-referrer"><title>Integrations · MSO</title><style nonce="${nonce}">${MSO_WIDGET_TOKENS}${INTEGRATION_FORM_STYLE}${CONNECTION_MANAGER_STYLE}${PORTABILITY_STYLE}*{box-sizing:border-box}body{margin:0;background:var(--surface);padding:clamp(var(--space-4),3vw,40px);font-family:var(--font-body);color:var(--text)}.site-bar{max-width:1180px;margin:0 auto 26px;font-size:var(--type-small);display:flex;justify-content:space-between;gap:var(--space-3)}.site-bar strong{display:flex;align-items:center;gap:var(--space-3);font-weight:750}.site-bar svg{width:30px;height:30px}.site-bar span{color:var(--text-dim)}button{border:var(--stroke) solid var(--sep-strong);border-radius:var(--radius-control);background:var(--field);color:var(--text);padding:var(--space-2) var(--space-3);cursor:pointer}a{color:var(--os-accent)}</style></head><body><header class="site-bar"><strong>${MSO_LOGO_SVG} MSO</strong><span>Your service connections</span></header><main id="setup" class="integration"><h1>Integrations</h1><p>Preparing the native provider catalog…</p><noscript>Enable JavaScript to open the secure credential form. Credentials can also be entered through the MSO terminal.</noscript></main><script nonce="${nonce}">const INTEGRATIONS_CATALOG=${catalog};${INTEGRATION_FORM_SCRIPT}${CONNECTION_MANAGER_SCRIPT}${PORTABILITY_SCRIPT}${INTEGRATION_BROWSER_SCRIPT}</script></body></html>`;- return { html, csp: `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; connect-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors 'none'` };+ const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="referrer" content="no-referrer"><title>Integrations · MSO</title><style nonce="${nonce}">${MSO_WIDGET_TOKENS}${INTEGRATION_FORM_STYLE}${CONNECTION_MANAGER_STYLE}${PORTABILITY_STYLE}*{box-sizing:border-box}body{margin:0;background:var(--surface);padding:clamp(var(--space-4),3vw,40px);font-family:var(--font-body);color:var(--text)}.site-bar{max-width:1180px;margin:0 auto 26px;font-size:var(--type-small);display:flex;justify-content:space-between;gap:var(--space-3)}.site-bar strong{display:flex;align-items:center;gap:var(--space-3);font-weight:750}.site-bar svg{width:30px;height:30px}.site-bar span{color:var(--text-dim)}button{border:var(--stroke) solid var(--sep-strong);border-radius:var(--radius-control);background:var(--field);color:var(--text);padding:var(--space-2) var(--space-3);cursor:pointer}a{color:var(--os-accent)}${embedded ? "body{padding:var(--space-4)}.site-bar{display:none}" : ""}</style></head><body><header class="site-bar"><strong>${MSO_LOGO_SVG} MSO</strong><span>Your service connections</span></header><main id="setup" class="integration"><h1>Integrations</h1><p>Preparing the native provider catalog…</p><noscript>Enable JavaScript to open the secure credential form. Credentials can also be entered through the MSO terminal.</noscript></main><script nonce="${nonce}">const INTEGRATIONS_CATALOG=${catalog};${INTEGRATION_FORM_SCRIPT}${CONNECTION_MANAGER_SCRIPT}${PORTABILITY_SCRIPT}${INTEGRATION_BROWSER_SCRIPT}</script></body></html>`;+ return { html, csp: `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; connect-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors ${embedded ? "'self'" : "'none'"}` };}-export function integrationPageResponse() {- const page = integrationSetupPage();- return new Response(page.html,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Security-Policy":page.csp,"Cache-Control":"no-store, private","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY"}});+function integrationResponse(embedded: boolean) {+ const page = integrationSetupPage(embedded);+ return new Response(page.html,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Security-Policy":page.csp,"Cache-Control":"no-store, private","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff","X-Frame-Options":embedded ? "SAMEORIGIN" : "DENY"}});}++export const integrationPageResponse = () => integrationResponse(false);+export const integrationManagerResponse = () => integrationResponse(true);diff --git a/lib/mcp/managed-sc-call.test.ts b/lib/mcp/managed-sc-call.test.tsnew file mode 100644index 00000000..8a47ff95--- /dev/null+++ b/lib/mcp/managed-sc-call.test.ts@@ -0,0 +1,22 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+const f = vi.hoisted(() => ({ servers: vi.fn(), query: vi.fn(), execute: vi.fn() }));+vi.mock("@/lib/host/project-mcp-config", () => ({ readProjectMcpServers: f.servers }));+vi.mock("@/lib/infra/connection-dispatch", () => ({ queryIntegrationAction: f.query, executeIntegrationAction: f.execute }));+import { callManagedScProvider } from "./managed-sc-call";+beforeEach(() => { vi.clearAllMocks(); f.servers.mockResolvedValue([{ name: "si-coder", transport: "plugin", plugin: "si-coder" }]); f.query.mockResolvedValue({ users: [{ id: "native-only" }] }); });+describe("MSO-managed SC orchestration", () => {+ it("returns native users with provenance without launching SC account management", async () => {+ const result = await callManagedScProvider("/fixture", "si-coder", "sc.user.list", {});+ expect(result).toMatchObject({ handled: true, result: { structuredContent: { authority: "mso", result: { users: [{ id: "native-only" }] } } } });+ expect(f.query).toHaveBeenCalledWith({ view: "users" });+ });+ it("does not intercept a separately declared standalone connection", async () => {+ f.servers.mockResolvedValue([{ name: "si-coder", transport: "stdio" }]);+ expect(await callManagedScProvider("/fixture", "si-coder", "sc.user.list", {})).toEqual({ handled: false });+ expect(f.query).not.toHaveBeenCalled();+ });+ it("refuses duplicate store mutations in managed mode", async () => {+ await expect(callManagedScProvider("/fixture", "si-coder", "sc.user.create", { user: "duplicate" })).rejects.toThrow("unavailable in MSO-managed SC");+ expect(f.query).not.toHaveBeenCalled(); expect(f.execute).not.toHaveBeenCalled();+ });+});diff --git a/lib/mcp/managed-sc-call.ts b/lib/mcp/managed-sc-call.tsnew file mode 100644index 00000000..796a1eb9--- /dev/null+++ b/lib/mcp/managed-sc-call.ts@@ -0,0 +1,10 @@+import { readProjectMcpServers } from "@/lib/host/project-mcp-config";+import { managedScCall } from "@/lib/host/sc-consumer";+import { executeIntegrationAction, queryIntegrationAction } from "@/lib/infra/connection-dispatch";++/** Orchestrate two domains above the transport; neither domain imports the other. */+export async function callManagedScProvider(projectPath: string, serverName: string, name: string, args: unknown) {+ const server = (await readProjectMcpServers(projectPath)).find(row => row.name === serverName);+ if (server?.transport !== "plugin") return { handled: false as const };+ return managedScCall(name, args, (mode, input) => mode === "query" ? queryIntegrationAction(input) : executeIntegrationAction(input));+}diff --git a/lib/mcp/tools-project-mcp-manage.ts b/lib/mcp/tools-project-mcp-manage.tsindex b61cbbd6..961a4dbc 100644--- a/lib/mcp/tools-project-mcp-manage.ts+++ b/lib/mcp/tools-project-mcp-manage.ts@@ -3,8 +3,8 @@ import { resolveProjectHint } from "@/lib/host/projects-api";import { type McpTool, S, str } from "./tool-kit";export const PROJECT_MCP_MANAGE_TOOLS: McpTool[] = [{name: "project_mcp_manage", title: "Add or Manage Project MCP", scope: "write",- description: "Inspect/add/update/remove one HTTP MCP binding in an exact project's .mcp.json. Inspect first for revision; pass it for upsert/delete. Other servers are preserved. Optional exact user/connection references private MCP credentials; never put credentials in url or arguments. Discover with project_mcp_tools after setup.",- chatgptDescription: "Add or manage a project's HTTP MCP. Inspect for revision, then upsert/delete. Credentials stay in a private connection.",+ description: "Inspect/add/update/remove one HTTP MCP or reviewed SI-Coder plugin binding in an exact project's .mcp.json. Inspect first for revision; pass it for upsert/delete. Other servers are preserved. Optional exact user/connection references private MCP credentials; never put credentials in url or arguments. Set plugin=si-coder instead of url for MSO-managed SC; native Integrations owns provider actions. Discover with project_mcp_tools after setup.",+ chatgptDescription: "Add or manage a project's HTTP MCP or managed SC plugin. Inspect for revision, then upsert/delete. Credentials stay in a private connection.",meta: { ui: { visibility: ["model", "app"] }, "openai/widgetAccessible": true },annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },limit: { key: "project.mcp.manage", max: 20, windowMs: 60_000 },@@ -14,16 +14,18 @@ export const PROJECT_MCP_MANAGE_TOOLS: McpTool[] = [{action: { type: "string", enum: ["inspect", "upsert", "delete"] },server: { type: "string", maxLength: 64, description: "Project-local server alias. Required for mutations." },revision: { type: "string", description: "Revision from inspect. Required for mutations." },- url: { type: "string", maxLength: 4096, description: "HTTPS endpoint without credentials/query/fragment. Required for upsert." },+ plugin: { type: "string", enum: ["si-coder"], description: "Reviewed installed SI-Coder in MSO-managed mode. Alternative to url; no copied credentials." },+ url: { type: "string", maxLength: 4096, description: "HTTPS endpoint without credentials/query/fragment. Required for HTTP upsert; omit with plugin." },user: { type: "string", description: "Exact credential owner; use together with connection." },connection: { type: "string", description: "Exact private MCP connection; omit both for public MCP." },}, ["project", "action"]),run: async a => {+ if (a.plugin !== undefined && a.plugin !== "si-coder") throw new Error("unsupported managed plugin");const project = await resolveProjectHint(str(a, "project"));if (!project || project.matchedBy === "fuzzy") throw new Error("exact project required");if (a.action === "inspect") return { project: project.id, ...await inspectProjectMcp(project.path) };if (a.action !== "upsert" && a.action !== "delete") throw new Error("invalid MCP action");return { project: project.id, ...await manageProjectMcp(project.path, { action: a.action, server: str(a, "server"), revision: str(a, "revision"),- url: typeof a.url === "string" ? a.url : undefined, user: typeof a.user === "string" ? a.user : undefined, connection: typeof a.connection === "string" ? a.connection : undefined }) };+ plugin: a.plugin === "si-coder" ? "si-coder" : undefined, url: typeof a.url === "string" ? a.url : undefined, user: typeof a.user === "string" ? a.user : undefined, connection: typeof a.connection === "string" ? a.connection : undefined }) };},}];diff --git a/lib/mcp/tools-project-mcp.ts b/lib/mcp/tools-project-mcp.tsindex 37efd8ae..cc284800 100644--- a/lib/mcp/tools-project-mcp.ts+++ b/lib/mcp/tools-project-mcp.ts@@ -1,3 +1,4 @@+import { callManagedScProvider } from "./managed-sc-call";import { projectMcpResult } from "@/lib/host/project-mcp-result";import { callProjectMcpTool, listProjectMcpToolPage, publicProjectMcpServers, readProjectMcpServers, resolveProjectHint } from "@/lib/host/projects-api";import { type McpTool, S, str, mcpDirect } from "./tool-kit";@@ -45,7 +46,8 @@ export const PROJECT_MCP_TOOLS: McpTool[] = [}, ["project", "server", "tool"]),run: async (a) => {const project = await resolveProjectHint(str(a, "project")); if (!project) throw new Error(`project not found: ${String(a.project)}`);- const out = projectMcpResult(await callProjectMcpTool(project.path, str(a, "server"), str(a, "tool"), a.arguments ?? {}));+ const managed = await callManagedScProvider(project.path, str(a, "server"), str(a, "tool"), a.arguments ?? {});+ const out = projectMcpResult(managed.handled ? managed.result : await callProjectMcpTool(project.path, str(a, "server"), str(a, "tool"), a.arguments ?? {}));return mcpDirect(out.content, out.isError, { result: { project: project.id, server: str(a, "server"), tool: str(a, "tool"), ...(out.structuredContent ? { structuredContent: out.structuredContent } : {}) } }, out.meta);},},diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.tsindex dcca2978..f7ca957d 100644--- a/lib/mcp/toolset.ts+++ b/lib/mcp/toolset.ts@@ -3,9 +3,9 @@ import type { Scope } from "./scope";import type { McpTool } from "./tool-kit";import { toolDescriptor, type McpToolProfile } from "./tool-contract";-export const MCP_SERVER_VERSION = "1.14.0";-export const MCP_TOOLSET_VERSION = "2026.09.12.3";-export const MCP_TOOLSET_CHANGED_AT = "2026-09-12T15:00:00Z";+export const MCP_SERVER_VERSION = "1.14.1";+export const MCP_TOOLSET_VERSION = "2026.09.14.1";+export const MCP_TOOLSET_CHANGED_AT = "2026-09-14T15:44:00Z";export type McpToolsetInfo = {serverVersion: string;diff --git a/next.config.mjs b/next.config.mjsindex 59567cde..d24c1964 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -130,6 +130,9 @@ const nextConfig = {// Private API responses must never be cached by any intermediary — they// carry host bytes (fs/read), auth state, and per-session data.{ source: "/api/:path*", headers: [{ key: "Cache-Control", value: "no-store" }] },+ // Only the internal manager is same-origin embeddable; its nonce CSP also+ // restricts frame-ancestors to self. The standalone page/shell retain DENY.+ { source: "/integrations/manager", headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }, { key: "Cache-Control", value: "no-store" }, { key: "Referrer-Policy", value: "no-referrer" }] },{ source: "/integrations", headers: [{ key: "Cache-Control", value: "no-store" }, { key: "Referrer-Policy", value: "no-referrer" }] },{ source: "/api/integrations/:path*", headers: [{ key: "Referrer-Policy", value: "no-referrer" }] },// Named brand/wallpaper assets are effectively immutable but, unlikediff --git a/package.json b/package.jsonindex 9bd839f3..b4b5e5d8 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "mso",- "version": "0.2.9",+ "version": "0.2.10","private": true,"engines": {"node": ">=20.9",diff --git a/proxy.ts b/proxy.tsindex a20fe0af..7b5e7934 100644--- a/proxy.ts+++ b/proxy.ts@@ -305,7 +305,7 @@ export async function proxy(request: NextRequest) {const isA2A =pathname === "/a2a/v1" || pathname === "/.well-known/agent-card.json";const isMachineProtocol = isMcp || isA2A;- const isApi = pathname.startsWith("/api/") || isMachineProtocol || (pathname === "/integrations" && ["GET", "HEAD"].includes(request.method));+ const isApi = pathname.startsWith("/api/") || isMachineProtocol || (["/integrations", "/integrations/manager"].includes(pathname) && ["GET", "HEAD"].includes(request.method));// The historical same-origin bridge is permanently closed. noVNC is executable// third-party code and is served only from its reserved split-origin host above.if (pathname.startsWith("/camoufox-vnc/")) return notFound();diff --git a/scripts/e2e/integrations-shell.mjs b/scripts/e2e/integrations-shell.mjsnew file mode 100644index 00000000..68a5d5f0--- /dev/null+++ b/scripts/e2e/integrations-shell.mjs@@ -0,0 +1,40 @@+#!/usr/bin/env node+// Public synthetic browser proof for the native shell window, without live accounts.+import { chromium, expect } from "@playwright/test";+import { releaseFixture } from "./release-fixture.mjs";+const fixture = await releaseFixture();+const browser = await chromium.launch({ headless: true });+try {+ for (const viewport of [{ width: 1363, height: 936 }, { width: 390, height: 844 }, { width: 844, height: 390 }]) {+ const context = await browser.newContext({ viewport });+ const page = await context.newPage();+ const errors = [];+ page.on("pageerror", error => errors.push(error.message));+ await page.goto(fixture.base);+ const launcher = viewport.width >= 768+ ? page.getByRole("link", { name: /^Integrations(?: \(running\))?$/ }).first()+ : page.getByRole("button", { name: /^Integrations(?: \(running\))?$/ }).first();+ await expect(launcher).toBeVisible();+ await launcher.hover();+ await launcher.click();+ await expect(page).toHaveURL(fixture.base + "/connections");+ const frame = page.frameLocator('iframe[title="MSO native Integrations manager"]');+ await expect(frame.getByRole("heading", { name: "Integrations", level: 1, exact: true })).toBeVisible();+ await expect(frame.getByRole("link", { name: "Sign in to MSO as Owner" })).toBeVisible();+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1)).toBe(true);+ await page.reload();+ await expect(frame.getByRole("heading", { name: "Integrations", level: 1, exact: true })).toBeVisible();+ const response = await context.request.get(fixture.base + "/integrations/manager");+ expect(response.headers()["x-frame-options"]).toBe("SAMEORIGIN");+ expect(response.headers()["content-security-policy"]).toContain("frame-ancestors 'self'");+ const compatibility = await context.request.get(fixture.base + "/integrations");+ expect(compatibility.headers()["x-frame-options"]).toBe("DENY");+ expect(compatibility.headers()["content-security-policy"]).toContain("frame-ancestors 'none'");+ expect(errors).toEqual([]);+ await context.close();+ console.log(`PASS Integrations dock click, native frame, reload, isolation and reflow ${viewport.width}x${viewport.height}`);+ }+} finally {+ await browser.close();+ await fixture.close();+}diff --git a/scripts/mso-cli-integrations-sc.sh b/scripts/mso-cli-integrations-sc.shindex c557a2ab..e94e8216 100755--- a/scripts/mso-cli-integrations-sc.sh+++ b/scripts/mso-cli-integrations-sc.sh@@ -3,15 +3,15 @@# MSO remains standalone: this file is inert when SI-Coder is absent. Only metadata is# auto-detected; direct credential values require the existing encrypted/manual transfer.integration_sc_binary(){- local c meta+ local c detectedfor c in "${MSO_SC_BIN-}" "$HOME/.local/bin/sc"; do[ -n "$c" ] && [ -x "$c" ] || continue- meta=$("$c" version --json 2>/dev/null) || continue- jq -e '.version and (.source|type=="string") and (.source|test("(^|/)si-coder-agent($|/)"))' >/dev/null 2>&1 <<<"$meta" || continue- printf '%s' "$c"; return 0+ detected=$(node "$ROOT/lib/host/sc-installation.mjs" "$c" 2>/dev/null) || continue+ printf '%s' "$detected"; return 0donereturn 1}+integration_sc_bundle(){local bin dir out rc=0bin=$(integration_sc_binary) || return 1diff --git a/scripts/test-support/integrations-sc-harness.sh b/scripts/test-support/integrations-sc-harness.shindex f4f9e3af..68a60161 100755--- a/scripts/test-support/integrations-sc-harness.sh+++ b/scripts/test-support/integrations-sc-harness.sh@@ -2,6 +2,8 @@set -euo pipefailROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"TMP="$(mktemp -d)";trap 'find "$TMP" -type f -delete 2>/dev/null||true;rmdir "$TMP" 2>/dev/null||true' EXIT+printf '%s' '{"name":"si-coder-agent","version":"0.9.3","bin":{"sc":"sc"}}' >"$TMP/package.json"+chmod 600 "$TMP/package.json"FAKE="$TMP/sc";LOG="$TMP/log";:>"$LOG"cat >"$FAKE" <<'SC'#!/usr/bin/env bashdiff --git a/scripts/verify-build.sh b/scripts/verify-build.shindex 5f1474d7..aaa5c959 100755--- a/scripts/verify-build.sh+++ b/scripts/verify-build.sh@@ -59,6 +59,12 @@ if ! node scripts/e2e/release.mjs; thenexit 43fi+echo "== verify native Integrations shell journey"+if ! node scripts/e2e/integrations-shell.mjs; then+ echo "verification failed during native Integrations shell E2E" >&2+ exit 43+fi+# Optional deeper media/native acceptance, using the same isolated built tree.if [ "${1:-}" = "--extended" ]; thenecho "== verify extended: desktop native acceptance"diff --git a/scripts/worktree-gates.test.ts b/scripts/worktree-gates.test.tsindex 446d8255..a81266f3 100644--- a/scripts/worktree-gates.test.ts+++ b/scripts/worktree-gates.test.ts@@ -45,6 +45,10 @@ function fixture(script: string) {path.join(repo, "scripts/e2e/release.mjs"),"import fs from 'node:fs'; if (!fs.existsSync('.build-verified') || fs.existsSync('.env.local')) throw Error('unsafe E2E fixture'); console.log('isolated E2E fixture passed');",);+ writeFileSync(+ path.join(repo, "scripts/e2e/integrations-shell.mjs"),+ "import fs from 'node:fs'; if (!fs.existsSync('.build-verified') || fs.existsSync('.env.local')) throw Error('unsafe shell fixture'); console.log('isolated shell fixture passed');",+ );git("init", "-q");git("add", "scripts");git(@@ -113,6 +117,7 @@ describe("isolated worktree release guards", () => {expect(run.stdout).toContain("isolated build fixture passed");expect(run.stdout).toContain("Playwright Chromium ready");expect(run.stdout).toContain("isolated E2E fixture passed");+ expect(run.stdout).toContain("isolated shell fixture passed");expect(readFileSync(path.join(repo, ".next/keep"), "utf8")).toBe("live marker",);