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(settings): improve MCP UI and activity scrolling
Rahman81d26a7720f5
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex f424a7d2..68017f01 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -4,6 +4,12 @@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-08-22++**Fixed**++- `settings` improve MCP UI and activity scrolling+## 2026-08-21**Added**diff --git a/frontend/slices/os-settings/components/mcp-audit-section.tsx b/frontend/slices/os-settings/components/mcp-audit-section.tsxnew file mode 100644index 00000000..4a444e5a--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-audit-section.tsx@@ -0,0 +1,63 @@+"use client";++import { Activity, CheckCircle2, XCircle } from "lucide-react";+import { ScrollArea } from "@/components/ui/scroll-area";+import { SettingsBlock, SettingsSection } from "@/features/shell-settings";++export type McpAuditRow = {+ ts?: string;+ action: string;+ actor?: string | null;+ target?: string;+ ok?: boolean;+ detail?: string;+};++export function McpAuditSection({ trail }: { trail: McpAuditRow[] }) {+ return (+ <SettingsSection+ icon={<Activity />}+ title="Recent activity"+ footnote={<>This forensic trail records privileged mutations and denials. Assistant → MCP shows the live stream for every tool call, including reads. Full trail: <code className="font-mono">mso audit</code>.</>}+ >+ <SettingsBlock className="p-0">+ <div className="flex min-h-[46px] items-center justify-between gap-3 border-b border-border/60 px-4 py-2.5">+ <div>+ <p className="text-[13px] font-medium">Privileged MCP log</p>+ <p className="text-[10px] text-muted-foreground">Newest events first</p>+ </div>+ <span className="shrink-0 rounded-md bg-secondary px-2 py-1 text-[10px] text-muted-foreground">Latest {trail.length}</span>+ </div>+ {trail.length === 0 ? (+ <div className="grid min-h-32 place-items-center px-4 py-8 text-center text-xs text-muted-foreground">+ No privileged MCP activity yet.+ </div>+ ) : (+ <ScrollArea aria-label="MCP audit log" className="h-72 max-h-[42dvh]">+ <ul className="divide-y divide-border/60 pr-2">+ {trail.map((entry, index) => {+ const failed = entry.ok === false;+ const StatusIcon = failed ? XCircle : CheckCircle2;+ return (+ <li key={`${entry.ts ?? "event"}-${index}`} className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-2.5 gap-y-1 px-4 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto]">+ <StatusIcon className={failed ? "mt-0.5 size-3.5 text-destructive" : "mt-0.5 size-3.5 text-success"} />+ <div className="min-w-0">+ <code className={failed ? "font-mono text-[11px] font-medium text-destructive" : "font-mono text-[11px] font-medium"}>{entry.action}</code>+ {(entry.target || entry.detail) && (+ <p className="mt-0.5 line-clamp-2 break-all font-mono text-[10px] leading-relaxed text-muted-foreground">{entry.target ?? entry.detail}</p>+ )}+ {entry.actor && <p className="mt-0.5 truncate text-[10px] text-muted-foreground">{entry.actor}</p>}+ </div>+ <time className="col-start-2 shrink-0 text-[10px] text-muted-foreground sm:col-start-3 sm:row-start-1">+ {entry.ts ? new Date(entry.ts).toLocaleString() : ""}+ </time>+ </li>+ );+ })}+ </ul>+ </ScrollArea>+ )}+ </SettingsBlock>+ </SettingsSection>+ );+}diff --git a/frontend/slices/os-settings/components/mcp-connection-section.tsx b/frontend/slices/os-settings/components/mcp-connection-section.tsxnew file mode 100644index 00000000..b28933d4--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-connection-section.tsx@@ -0,0 +1,76 @@+"use client";++import { useState } from "react";+import { Check, Copy, Plug, Wrench } from "lucide-react";+import { Button } from "@/components/ui/button";+import { SettingsBlock, SettingsSection } from "@/features/shell-settings";+import { McpToolsetCard, type McpToolsetInfo } from "./mcp-toolset-card";++function CopyRow({ label, value }: { label: string; value: string }) {+ const [copied, setCopied] = useState(false);+ return (+ <SettingsBlock className="flex flex-col gap-2.5 sm:flex-row sm:items-center">+ <span className="shrink-0 text-[13px] font-medium sm:w-32">{label}</span>+ <div className="min-w-0 flex-1 rounded-lg bg-secondary/60 px-3 py-2">+ <code className="block break-all font-mono text-[11px] leading-relaxed text-secondary-foreground sm:text-xs">{value}</code>+ </div>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ aria-label={`Copy ${label}`}+ className="size-9 shrink-0 self-end sm:self-auto [@media(pointer:coarse)]:size-11"+ onClick={() => {+ void navigator.clipboard.writeText(value).then(() => {+ setCopied(true);+ window.setTimeout(() => setCopied(false), 1500);+ });+ }}+ >+ {copied ? <Check className="size-4" /> : <Copy className="size-4" />}+ </Button>+ </SettingsBlock>+ );+}++export function McpConnectionSection({+ origin,+ maxScope,+ toolset,+}: {+ origin: string;+ maxScope: string;+ toolset: McpToolsetInfo;+}) {+ return (+ <div className="space-y-4 sm:space-y-5">+ <SettingsSection+ icon={<Plug />}+ title="Connection"+ footnote={<>Highest scope this server will mint: <strong>{maxScope}</strong> (<code className="font-mono">OS_MCP_MAX_SCOPE</code>).</>}+ >+ <SettingsBlock className="space-y-1.5 py-4">+ <p className="text-sm font-medium">Connect ChatGPT with User-Defined OAuth</p>+ <p className="text-xs leading-relaxed text-muted-foreground">+ In ChatGPT open Settings → Connectors → New App. Use OAuth, leave Client Secret empty, and set token endpoint authentication to none.+ </p>+ </SettingsBlock>+ <CopyRow label="MCP Server URL" value={`${origin}/mcp`} />+ <CopyRow label="Auth URL" value={`${origin}/oauth/authorize`} />+ <CopyRow label="Token URL" value={`${origin}/oauth/token`} />+ <CopyRow label="Resource" value={`${origin}/mcp`} />+ <CopyRow label="Client ID" value="chatgpt-mso" />+ <SettingsBlock className="space-y-1.5 py-4">+ <p className="text-[13px] font-medium">Other MCP clients</p>+ <p className="text-xs leading-relaxed text-muted-foreground">+ Claude.ai, Cursor and mcp-remote register themselves. Give them <code className="break-all font-mono">{origin}/mcp</code> and nothing else.+ </p>+ </SettingsBlock>+ </SettingsSection>++ <SettingsSection icon={<Wrench />} title="Toolset status" bare>+ <McpToolsetCard info={toolset} />+ </SettingsSection>+ </div>+ );+}diff --git a/frontend/slices/os-settings/components/mcp-section.tsx b/frontend/slices/os-settings/components/mcp-section.tsxindex 206ea25c..86ce0f82 100644--- a/frontend/slices/os-settings/components/mcp-section.tsx+++ b/frontend/slices/os-settings/components/mcp-section.tsx@@ -1,91 +1,48 @@"use client";import { useCallback, useEffect, useState } from "react";-import { Plug, Copy, Check } from "lucide-react";-import { Button } from "@/components/ui/button";-import { SettingsSection } from "@/features/shell-settings";+import { Plug } from "lucide-react";+import { SettingsBlock, SettingsSection } from "@/features/shell-settings";import { toast } from "@/features/os-shell";import { IS_DEMO } from "@/lib/demo";-import { McpToolsetCard, type McpToolsetInfo } from "./mcp-toolset-card";+import { McpAuditSection, type McpAuditRow } from "./mcp-audit-section";+import { McpConnectionSection } from "./mcp-connection-section";+import { McpTokenSection, type McpTokenRow } from "./mcp-token-section";+import type { McpToolsetInfo } from "./mcp-toolset-card";-type AuditRow = {- ts?: string;- action: string;- actor?: string | null;- target?: string;- ok?: boolean;- detail?: string;+type McpState = {+ enabled: boolean;+ maxScope: string;+ toolset: McpToolsetInfo;+ tokens: McpTokenRow[];};-type TokenRow = {- id: string;- label: string;- clientId: string;- scope: string;- createdAt: number;- expiresAt: number;- lastUsedAt?: number;- status: "active" | "revoked" | "expired";-};--const fmt = (t?: number) => (t ? new Date(t).toLocaleString() : "—");--function CopyRow({ label, value }: { label: string; value: string }) {- const [copied, setCopied] = useState(false);- return (- <div className="flex items-center gap-2 py-1.5">- <span className="w-40 shrink-0 text-xs text-muted-foreground">{label}</span>- <code className="min-w-0 flex-1 truncate rounded bg-secondary px-2 py-1 font-mono text-[11px]">{value}</code>- <Button- type="button"- variant="ghost"- size="icon"- aria-label={`Copy ${label}`}- className="size-8 shrink-0 [@media(pointer:coarse)]:size-11"- onClick={() => {- void navigator.clipboard.writeText(value).then(() => {- setCopied(true);- setTimeout(() => setCopied(false), 1500);- });- }}- >- {copied ? <Check className="size-4" /> : <Copy className="size-4" />}- </Button>- </div>- );-}-export function McpSection() {- const [state, setState] = useState<{ enabled: boolean; maxScope: string; toolset: McpToolsetInfo; tokens: TokenRow[] } | null>(null);- const [trail, setTrail] = useState<AuditRow[]>([]);+ const [state, setState] = useState<McpState | null>(null);+ const [trail, setTrail] = useState<McpAuditRow[]>([]);const [origin, setOrigin] = useState("");const load = useCallback(() => {if (IS_DEMO) return;fetch("/api/mcp/tokens", { cache: "no-store" })- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`HTTP ${r.status}`))))- .then((s) => {- // Read the origin here rather than in the effect body: window.location is- // an impure render-time read, and a synchronous setState in an effect is a- // cascading render. Both are lint errors, and both are avoidable by doing- // it once, in the callback that already updates this component.+ .then((response) => (response.ok ? response.json() : Promise.reject(new Error(`HTTP ${response.status}`))))+ .then((next: McpState) => {setOrigin(window.location.origin);- setState(s);+ setState(next);}).catch(() => toast("Couldn't load MCP tokens", { tone: "error" }));- // What those tokens actually DID. Revoking is a weak control if you cannot- // see the writes and commands that already went through.+fetch("/api/v1/sys/audit?actor=mcp%3A&limit=20", { cache: "no-store" })- .then((r) => (r.ok ? r.json() : { entries: [] }))- .then((d: { entries?: AuditRow[] }) => setTrail(d.entries ?? []))+ .then((response) => (response.ok ? response.json() : { entries: [] }))+ .then((data: { entries?: McpAuditRow[] }) => setTrail(data.entries ?? [])).catch(() => setTrail([]));}, []);useEffect(load, [load]);async function revoke(id: string, what: string) {- const r = await fetch(`/api/mcp/tokens?id=${encodeURIComponent(id)}`, { method: "DELETE" });- if (!r.ok) {+ const response = await fetch(`/api/mcp/tokens?id=${encodeURIComponent(id)}`, { method: "DELETE" });+ if (!response.ok) {toast(`Couldn't revoke ${what}`, { tone: "error" });return;}@@ -93,106 +50,52 @@ export function McpSection() {load();}- const live = state?.tokens.filter((t) => t.status === "active") ?? [];+ if (IS_DEMO) {+ return (+ <SettingsSection icon={<Plug />} title="MCP connection">+ <SettingsBlock className="space-y-1.5 py-4">+ <p className="text-sm font-medium">MCP is unavailable in demo mode</p>+ <p className="text-xs leading-relaxed text-muted-foreground">Connect to a live MSO host to configure OAuth, inspect tokens, and review MCP activity.</p>+ </SettingsBlock>+ </SettingsSection>+ );+ }- return (- <SettingsSection- icon={<Plug />}- title="MCP — control this VPS from ChatGPT"- footnote="Tokens are stored as a hash; the raw value is shown to the client once, at mint. Revoking is immediate — it is re-checked on every call."- >- {!state?.enabled ? (- <p className="text-xs text-muted-foreground">- Disabled. Set <code className="font-mono">OS_MCP_ENABLED=1</code> in <code className="font-mono">.env.local</code>{" "}- and restart mso.service. While it is off, <code className="font-mono">/mcp</code> and the OAuth- discovery documents return 404 — there is no MCP surface at all, not an unauthenticated one.- </p>- ) : (- <>- <div className="space-y-0.5">- <p className="pb-1 text-xs text-muted-foreground">- In ChatGPT: Settings → Connectors → New App. Authentication <strong>OAuth</strong>, registration{" "}- <strong>User-Defined OAuth Client</strong>, Client Secret <strong>empty</strong>, token endpoint auth{" "}- <strong>none</strong>.- </p>- <CopyRow label="MCP Server URL" value={`${origin}/mcp`} />- <CopyRow label="Auth URL" value={`${origin}/oauth/authorize`} />- <CopyRow label="Token URL" value={`${origin}/oauth/token`} />- <CopyRow label="Resource" value={`${origin}/mcp`} />- <CopyRow label="Client ID" value="chatgpt-mso" />- <p className="pt-1 text-xs text-muted-foreground">- Claude.ai, Cursor and mcp-remote register themselves — give them{" "}- <code className="font-mono">{origin}/mcp</code> and nothing else. Highest tier this server will- mint: <strong>{state.maxScope}</strong> (<code className="font-mono">OS_MCP_MAX_SCOPE</code>).- </p>- <McpToolsetCard info={state.toolset} />+ if (!state) {+ return (+ <SettingsSection icon={<Plug />} title="MCP connection">+ <SettingsBlock>+ <div className="space-y-2" aria-live="polite">+ <div className="h-4 w-40 animate-pulse rounded bg-secondary" />+ <div className="h-3 w-3/4 animate-pulse rounded bg-secondary/70" /></div>+ </SettingsBlock>+ </SettingsSection>+ );+ }- <div className="mt-3 border-t border-border pt-3">- {state.tokens.length === 0 ? (- <p className="text-xs text-muted-foreground">- No tokens yet. One is minted when you approve a client on the consent screen.- </p>- ) : (- <ul className="space-y-1.5">- {state.tokens.map((t) => {- const dead = t.status !== "active";- return (- <li key={t.id} className="flex items-center gap-2 text-xs">- <span className={dead ? "min-w-0 flex-1 truncate text-muted-foreground line-through" : "min-w-0 flex-1 truncate"}>- {t.label}- <span className="ml-1.5 rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px]">{t.scope}</span>- </span>- <span className="hidden shrink-0 text-muted-foreground sm:inline">last used {fmt(t.lastUsedAt)}</span>- {dead ? (- <span className="shrink-0 text-muted-foreground">{t.status}</span>- ) : (- <Button- type="button"- variant="ghost"- size="sm"- className="h-8 shrink-0 text-destructive [@media(pointer:coarse)]:min-h-[44px]"- onClick={() => void revoke(t.id, t.label)}- >- Revoke- </Button>- )}- </li>- );- })}- </ul>- )}- {trail.length > 0 && (- <div className="mt-4 border-t border-border pt-3">- <p className="pb-1.5 text-xs font-medium">Recent MCP activity</p>- <ul className="space-y-1">- {trail.map((e, i) => (- <li key={i} className="flex items-baseline gap-2 text-[11px]">- <code className={e.ok === false ? "shrink-0 font-mono text-destructive" : "shrink-0 font-mono"}>{e.action}</code>- <span className="min-w-0 flex-1 truncate font-mono text-muted-foreground">{e.target ?? e.detail ?? ""}</span>- <span className="shrink-0 text-muted-foreground">{e.ts ? new Date(e.ts).toLocaleString() : ""}</span>- </li>- ))}- </ul>- <p className="pt-1.5 text-[11px] text-muted-foreground">- This forensic trail still records privileged mutations and denials. The Assistant → MCP tab adds a separate live activity stream for all tool calls, including reads. Full forensic trail: <code className="font-mono">mso audit</code>.- </p>- </div>- )}- {live.length > 0 && (- <Button- type="button"- variant="secondary"- size="sm"- className="mt-3 w-full text-destructive [@media(pointer:coarse)]:min-h-[44px]"- onClick={() => void revoke("all", `all ${live.length} live token(s)`)}- >- Revoke all ({live.length})- </Button>- )}- </div>- </>- )}- </SettingsSection>+ if (!state.enabled) {+ return (+ <SettingsSection+ icon={<Plug />}+ title="MCP connection"+ footnote="When disabled, the MCP endpoint and OAuth discovery documents return 404, so no unauthenticated MCP surface remains exposed."+ >+ <SettingsBlock className="space-y-2 py-4">+ <p className="text-sm font-medium">MCP is disabled</p>+ <p className="text-xs leading-relaxed text-muted-foreground">+ Set <code className="font-mono">OS_MCP_ENABLED=1</code> in <code className="font-mono">.env.local</code> and restart <code className="font-mono">mso.service</code>.+ </p>+ </SettingsBlock>+ </SettingsSection>+ );+ }++ return (+ <div className="space-y-4 sm:space-y-5">+ <McpConnectionSection origin={origin} maxScope={state.maxScope} toolset={state.toolset} />+ <McpTokenSection tokens={state.tokens} onRevoke={revoke} />+ <McpAuditSection trail={trail} />+ </div>);}diff --git a/frontend/slices/os-settings/components/mcp-token-section.tsx b/frontend/slices/os-settings/components/mcp-token-section.tsxnew file mode 100644index 00000000..055c87ba--- /dev/null+++ b/frontend/slices/os-settings/components/mcp-token-section.tsx@@ -0,0 +1,78 @@+"use client";++import { KeyRound } from "lucide-react";+import { Button } from "@/components/ui/button";+import { SettingsActionRow, SettingsBlock, SettingsSection } from "@/features/shell-settings";++export type McpTokenRow = {+ id: string;+ label: string;+ clientId: string;+ scope: string;+ createdAt: number;+ expiresAt: number;+ lastUsedAt?: number;+ status: "active" | "revoked" | "expired";+};++const formatTime = (time?: number) => (time ? new Date(time).toLocaleString() : "Never");++export function McpTokenSection({+ tokens,+ onRevoke,+}: {+ tokens: McpTokenRow[];+ onRevoke: (id: string, what: string) => Promise<void>;+}) {+ const live = tokens.filter((token) => token.status === "active");+ return (+ <SettingsSection+ icon={<KeyRound />}+ title={`Access tokens (${tokens.length})`}+ footnote="Tokens are stored as hashes; the raw value is shown once when minted. Revocation is checked on every MCP call."+ >+ {tokens.length === 0 ? (+ <SettingsBlock className="py-4">+ <p className="text-xs leading-relaxed text-muted-foreground">No tokens yet. One is minted after you approve a client on the OAuth consent screen.</p>+ </SettingsBlock>+ ) : (+ tokens.map((token) => {+ const inactive = token.status !== "active";+ return (+ <SettingsBlock key={token.id} className="flex flex-col gap-3 py-4 sm:flex-row sm:items-center">+ <div className="min-w-0 flex-1 space-y-1">+ <div className="flex flex-wrap items-center gap-1.5">+ <span className={inactive ? "text-sm font-medium text-muted-foreground line-through" : "text-sm font-medium"}>{token.label}</span>+ <span className="rounded-md bg-secondary px-2 py-0.5 font-mono text-[10px]">{token.scope}</span>+ {inactive && <span className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">{token.status}</span>}+ </div>+ <p className="break-all font-mono text-[10px] leading-relaxed text-muted-foreground">{token.clientId}</p>+ <p className="text-[11px] leading-relaxed text-muted-foreground">+ Last used {formatTime(token.lastUsedAt)} · expires {formatTime(token.expiresAt)}+ </p>+ </div>+ {!inactive && (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="min-h-9 shrink-0 self-end text-destructive sm:self-auto [@media(pointer:coarse)]:min-h-[44px]"+ onClick={() => void onRevoke(token.id, token.label)}+ >+ Revoke+ </Button>+ )}+ </SettingsBlock>+ );+ })+ )}+ {live.length > 0 && (+ <SettingsActionRow+ label={`Revoke all (${live.length})`}+ tone="destructive"+ onClick={() => void onRevoke("all", `all ${live.length} live token(s)`)}+ />+ )}+ </SettingsSection>+ );+}diff --git a/frontend/slices/os-settings/components/mcp-toolset-card.tsx b/frontend/slices/os-settings/components/mcp-toolset-card.tsxindex c3632cd2..f15a70ef 100644--- a/frontend/slices/os-settings/components/mcp-toolset-card.tsx+++ b/frontend/slices/os-settings/components/mcp-toolset-card.tsx@@ -34,19 +34,19 @@ export function McpToolsetCard({ info }: { info: McpToolsetInfo }) {const changed = Boolean(ack && !current);return (- <div className="mt-3 rounded-xl border border-border bg-secondary/30 p-3">+ <div className="rounded-xl border border-border/70 bg-card p-4 shadow-sm"><div className="flex items-start gap-2"><Wrench className="mt-0.5 size-4 shrink-0" /><div className="min-w-0 flex-1"><div className="flex flex-wrap items-center gap-x-2 gap-y-1">- <p className="text-xs font-medium">MCP toolset {info.version}</p>- <span className="rounded bg-secondary px-1.5 py-0.5 font-mono text-[10px]">{info.toolCount} tools</span>- <span className="font-mono text-[10px] text-muted-foreground">{info.hash}</span>+ <p className="text-sm font-medium">MCP toolset {info.version}</p>+ <span className="rounded-md bg-secondary px-2 py-0.5 font-mono text-[11px]">{info.toolCount} tools</span>+ <span className="font-mono text-[11px] text-muted-foreground">{info.hash}</span></div>- <p className="mt-1 text-[11px] text-muted-foreground">+ <p className="mt-1.5 text-xs leading-relaxed text-muted-foreground">Server {info.serverVersion} · read {info.byScope.read} · write {info.byScope.write} · exec {info.byScope.exec} · changed {info.changedAt.slice(0, 10)}</p>- <p className={`mt-1 text-[11px] ${changed ? "text-warning" : "text-muted-foreground"}`}>+ <p className={`mt-2 text-xs leading-relaxed ${changed ? "text-warning" : "text-muted-foreground"}`}>{current? "ChatGPT action snapshot marked current for this browser.": changed@@ -56,15 +56,15 @@ export function McpToolsetCard({ info }: { info: McpToolsetInfo }) {</div>{current ? <BadgeCheck className="size-4 shrink-0 text-success" /> : <RefreshCw className="size-4 shrink-0 text-warning" />}</div>- <div className="mt-2 flex gap-2">+ <div className="mt-3 flex flex-col gap-2 sm:flex-row"><Button- type="button" variant="secondary" size="sm" className="h-8 text-[11px]"+ type="button" variant="secondary" size="sm" className="min-h-9 flex-1 text-xs sm:flex-none [@media(pointer:coarse)]:min-h-[44px]"onClick={() => { window.localStorage.setItem(ACK_KEY, signature); window.dispatchEvent(new Event(ACK_EVENT)); }}>{current ? "Marked refreshed" : "Mark ChatGPT refreshed"}</Button><Button- type="button" variant="ghost" size="sm" className="h-8 text-[11px]"+ type="button" variant="ghost" size="sm" className="min-h-9 flex-1 text-xs sm:flex-none [@media(pointer:coarse)]:min-h-[44px]"onClick={() => void navigator.clipboard.writeText(signature).then(() => {setCopied(true); window.setTimeout(() => setCopied(false), 1500);})}