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(oauth): issue distinct dynamic client ids
Rahman3c8b0a0388eb
diff --git a/CLAUDE.md b/CLAUDE.mdindex 567572f3..0519b392 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -348,7 +348,7 @@ the real runtime and working analogue before changing a tool or skill contract.it AND `tools/call` re-checks it — a client can call a name it was never shown.- **Tool names are an MSO public API contract.** Keep global names MSO-owned and generic.Project-owned MCP names are data behind `project_mcp_tools` / `project_mcp_call`; never copy them into the global catalog.- <!-- mcp-toolset: server=1.7.0 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->+ <!-- mcp-toolset: server=1.7.1 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->The full MSO transport exposes **73 tools**: **72 model/operator tools** (34 read, 24 write, 14 exec) plus app-only `workflow_status`.ChatGPT receives a deliberately smaller static profile; hidden full-catalog names are rejected at call time, not merely omitted from `tools/list`.- Store is `~/.mso/mcp.json`, **sha256 only**, same atomic-write + fail-loud-on-corruptdiff --git a/app/oauth/authorize/actions.ts b/app/oauth/authorize/actions.tsindex 708e02d5..1d5d8091 100644--- a/app/oauth/authorize/actions.ts+++ b/app/oauth/authorize/actions.ts@@ -45,8 +45,8 @@ export async function approve(form: FormData): Promise<ApprovalResult> {if (!expectedIssuer || issuer !== expectedIssuer || resource !== `${expectedIssuer}/mcp`) return { ok: false, error: "OAuth resource/issuer mismatch." };const client = await getClient(clientId);- // A user-defined client (ChatGPT's flow) never registers, so it has no record- // here. That is allowed — the redirect_uri is still https-checked above and the+ // A manually configured client may not have a DCR record. That compatibility path+ // is allowed — the redirect_uri is still https-checked above and the// code is still bound to this exact client_id + redirect_uri at exchange. What// is NOT allowed is a REGISTERED client redirecting somewhere it never declared.if (client && !client.redirectUris.includes(redirectUri)) {diff --git a/app/oauth/register/route.ts b/app/oauth/register/route.tsindex 4f4eecf8..bb139e07 100644--- a/app/oauth/register/route.ts+++ b/app/oauth/register/route.ts@@ -40,6 +40,7 @@ export async function POST(req: Request) {return Response.json({client_id: clientId,+ client_id_issued_at: Math.floor(Date.now() / 1000),redirect_uris: uris,client_name: name.slice(0, 80),token_endpoint_auth_method: "none",diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 30b4adab..414c1984 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -160,7 +160,7 @@ park a visible Approve/Deny card. The complete semantic contract is**MCP** is for external clients such as ChatGPT, Claude.ai and Cursor. Its catalog lives in`lib/mcp/`; access is controlled by the OAuth token scope rather than Alfa approval cards.-<!-- mcp-toolset: server=1.7.0 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->+<!-- mcp-toolset: server=1.7.1 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->The full transport exposes **73 tools**: **72 model/operator tools** (34 read, 24 write, 14 exec) plus app-only `workflow_status`. ChatGPT gets a compact client profile rather than the full set. Project function/MCP names remain data behind `project_capabilities`, `project_function_call`, `project_mcp_tools`, and `project_mcp_call`; they never rewrite the global tool prefix. `GET /mcp` reports both full and ChatGPT signatures.See `docs/MCP.md` for protocol/security internals, `docs/A2A.md` for peer-agent delegation, and `docs/CHATGPT-PLUGIN.md` for thediff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 687e9836..9b664a85 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -12,6 +12,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `oauth` issue distinct dynamic client ids- `mcp` make read pipeline schema portable**Faster**diff --git a/docs/CHATGPT-PLUGIN.md b/docs/CHATGPT-PLUGIN.mdindex 41b836d6..0865f346 100644--- a/docs/CHATGPT-PLUGIN.md+++ b/docs/CHATGPT-PLUGIN.md@@ -4,9 +4,9 @@>> ChatGPT's Developer Mode/App UI can change independently of MSO. Use the current OpenAI MCP/App documentation for exact menu labels, and use MSO Settings → MCP / `GET /mcp` for the live server/profile signatures.-<!-- mcp-chatgpt-profile: server=1.7.0 version=2026.09.03.4 tools=28 read=14 write=8 exec=6 app-only=1 total=29 -->+<!-- mcp-chatgpt-profile: server=1.7.1 version=2026.09.03.4 tools=28 read=14 write=8 exec=6 app-only=1 total=29 -->-MSO server **1.7.0**, toolset **2026.09.03.4** exposes a full generic catalog for MCP clients, but a registered ChatGPT client receives only **29 transport tools**: **28 model/operator tools** (14 read, 8 write, 6 exec) plus app-only `workflow_status`.+MSO server **1.7.1**, toolset **2026.09.03.4** exposes a full generic catalog for MCP clients, but a registered ChatGPT client receives only **29 transport tools**: **28 model/operator tools** (14 read, 8 write, 6 exec) plus app-only `workflow_status`.The compact descriptor regression currently measures **31,908 JSON bytes** for all 29 ChatGPT tool definitions (roughly 8k tokens at a 4-byte/token estimate), with the largest individual descriptor **2,507 bytes**. CI keeps the profile below 40 KiB and each descriptor below 8 KiB. Bytes are the deterministic contract; token estimates vary by tokenizer.diff --git a/docs/MCP.md b/docs/MCP.mdindex 31864ddc..5a2aaa82 100644--- a/docs/MCP.md+++ b/docs/MCP.md@@ -116,9 +116,9 @@ The catalog has a stable server version plus a schema-derived toolset signature.Settings → MCP shows the current version/hash/count and stores a browser-local acknowledgement when the operator marks ChatGPT refreshed. A later signature change becomes an explicit stale-snapshot warning. This does not mutate ChatGPT remotely; it makes the required refresh visible instead of relying on memory.-<!-- mcp-toolset: server=1.7.0 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->+<!-- mcp-toolset: server=1.7.1 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->-Current full transport catalog: **73 tools**, server `1.7.0` / toolset `2026.09.03.4`.+Current full transport catalog: **73 tools**, server `1.7.1` / toolset `2026.09.03.4`.The model/operator catalog is **72 tools** (34 read, 24 write, 14 exec); `workflow_status` is the one app-only MCP Apps bridge. ChatGPT receives a smaller client profile rather than this full set; see [`CHATGPT-PLUGIN.md`](./CHATGPT-PLUGIN.md).`agent_memory_search` is the typed-memory retrieval surface. It resolves semantic/episodic/procedural claims at an optional point in time, returns confidence/provenance and competing effective claims, and can expose superseded/retracted history when explicitly requested. `agent_memory_remember` remains the write surface and now accepts typed metadata; raw ChatGPT conversation ids are never stored as provenance.diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 1f789421..a61775d1 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -2,6 +2,12 @@Running log of what shipped each phase. Newest at top.+## 2026-09-03 — OAuth DCR registration identity fix++- **Fresh app means fresh OAuth client:** `POST /oauth/register` now mints a distinct RFC 7591 client id for every registration. Redirect URIs are client metadata, not identity; two ChatGPT dev apps sharing the same `chatgpt.com` callback no longer collapse onto an August-era client record.+- **Safe bounded store:** registration pruning removes only old client records that are not referenced by a live authorization code, access token, or refresh grant. Existing connectors/tokens remain valid. The DCR response now also reports `client_id_issued_at`.+- **Why this matters:** real ChatGPT testing showed a supposedly new app at 10:55 UTC receiving the historical `probe-chatgpt` client id solely because its redirect set matched. That defeated the purpose of a clean Scan Tools registration and could retain stale app identity server-side. MCP server patch version is 1.7.1; toolset remains 2026.09.03.4 because the advertised tool catalog did not change.+## 2026-09-03 — MCP 1.7 ChatGPT compact profile + dynamic project MCP- **ChatGPT scanner contract:** full MSO remains 73 transport tools / 72 model tools (34 read / 24 write / 14 exec + app-only `workflow_status`), while ChatGPT is client-profiled to **29 transport tools = 28 model tools (14 read / 8 write / 6 exec) + app-only bridge**. The profile is fail-closed at list and direct-call time, keeps only MSO-owned generic names, and regression-measures **31,908 descriptor bytes (~8k rough tokens)** with a 40 KiB total / 8 KiB per-tool guard.diff --git a/docs/TESTING-HANDOFF.md b/docs/TESTING-HANDOFF.mdindex f187a133..feb8295c 100644--- a/docs/TESTING-HANDOFF.md+++ b/docs/TESTING-HANDOFF.md@@ -4,7 +4,7 @@ Update this file at the end of every manual or automated test session. Keep it f## Current status-The current release target is **MSO CLI 1.12.0**, MCP server `1.7.0`, toolset `2026.09.03.4`; use `mso --version` plus `/api/health` for the exact Git build because documentation-only release commits also advance that identity. The v1.10/v1.11 findings and the v1.12 sectioned-terminal/recoverable-error work below are resolved and retained as historical test evidence. Do not re-open a resolved finding from prose alone: reproduce it against the current build first. There is no known 1.12 release blocker in this handoff.+The current release target is **MSO CLI 1.12.0**, MCP server `1.7.1`, toolset `2026.09.03.4`; use `mso --version` plus `/api/health` for the exact Git build because documentation-only release commits also advance that identity. The v1.10/v1.11 findings and the v1.12 sectioned-terminal/recoverable-error work below are resolved and retained as historical test evidence. Do not re-open a resolved finding from prose alone: reproduce it against the current build first. There is no known 1.12 release blocker in this handoff.Current verified behavior:- MCP 1.7 release candidate: ChatGPT is fail-closed to a 29-tool compact MSO-only profile (~31.8 KiB descriptor JSON / ~8k rough tokens), full MSO remains 73 transport tools, and project-specific MCP names stay dynamic behind `project_mcp_tools` / `project_mcp_call`. OAuth resource binding + rotating refresh credentials, Streamable HTTP protocol handling, and legacy registered ChatGPT-client profile detection have focused regression coverage. Deterministic security gates (Trivy/OSV/Gitleaks/Semgrep/ShellCheck) pass; Codex Security AI scanning is explicitly incomplete because executor/cost guards stopped it, with 0 findings in the targeted partial reports.@@ -29,7 +29,7 @@ Current verified behavior:```textYou are taking over MSO testing work in /home/rahman/projects/mso.-Read docs/TESTING-HANDOFF.md first. Current verified source baseline: CLI 1.12.0, MCP server 1.7.0, toolset 2026.09.03.4; resolve the exact live Git build from `mso --version`/`/api/health`. Preserve existing work and do not re-open resolved v1.10-v1.12 findings unless you can reproduce them against the current build.+Read docs/TESTING-HANDOFF.md first. Current verified source baseline: CLI 1.12.0, MCP server 1.7.1, toolset 2026.09.03.4; resolve the exact live Git build from `mso --version`/`/api/health`. Preserve existing work and do not re-open resolved v1.10-v1.12 findings unless you can reproduce them against the current build.For a new issue: record the exact reproduction, distinguish durable state from live receiver/process state, avoid duplicate write/exec retries when outcome is uncertain, add the smallest focused regression, run typecheck plus the relevant contract tests, then update this handoff with factual results.```diff --git a/lib/mcp/dispatch.test.ts b/lib/mcp/dispatch.test.tsindex 668e978a..5a49ee54 100644--- a/lib/mcp/dispatch.test.ts+++ b/lib/mcp/dispatch.test.ts@@ -46,7 +46,7 @@ describe("protocol", () => {it("publishes server and toolset metadata so action drift is visible", async () => {const r = await dispatch({ id: 1, method: "initialize" }, "exec");const result = r.result as { serverInfo: { version: string }; _meta: { toolset: { toolCount: number; hash: string } } };- expect(result.serverInfo.version).toBe("1.7.0");+ expect(result.serverInfo.version).toBe("1.7.1");expect(result._meta.toolset.toolCount).toBe(TOOLS.length);expect(result._meta.toolset.hash).toMatch(/^[a-f0-9]{16}$/);});diff --git a/lib/mcp/store.test.ts b/lib/mcp/store.test.tsindex 1d84e627..eb61715d 100644--- a/lib/mcp/store.test.ts+++ b/lib/mcp/store.test.ts@@ -114,12 +114,12 @@ describe("tokens", () => {});describe("clients", () => {- it("returns the SAME id for an identical redirect set — clients re-register on every launch", async () => {- const a = await store.registerClient("Cursor", ["https://cursor.sh/cb"]);- const b = await store.registerClient("Cursor", ["https://cursor.sh/cb"]);- expect(b).toBe(a);- const c = await store.registerClient("Cursor", ["https://cursor.sh/other"]);- expect(c).not.toBe(a);+ it("mints a distinct client id for every registration even when redirect URIs are identical", async () => {+ const a = await store.registerClient("ChatGPT", ["https://chatgpt.com/connector/oauth/example"]);+ const b = await store.registerClient("ChatGPT", ["https://chatgpt.com/connector/oauth/example"]);+ expect(b).not.toBe(a);+ expect(await store.getClient(a)).toMatchObject({ name: "ChatGPT" });+ expect(await store.getClient(b)).toMatchObject({ name: "ChatGPT" });});it("reads back a registered client", async () => {diff --git a/lib/mcp/store.ts b/lib/mcp/store.tsindex a9cc6ead..7588e48a 100644--- a/lib/mcp/store.ts+++ b/lib/mcp/store.ts@@ -1,3 +1,4 @@+import { randomUUID } from "node:crypto";import { promises as fs } from "node:fs";import os from "node:os";import path from "node:path";@@ -63,7 +64,7 @@ export const CODE_TTL_MS = 60_000; // RFC 6749 wants ≤10 min; the exchange isexport const TOKEN_TTL_MS = 90 * 24 * 60 * 60 * 1000; // legacy/manual bearer lifetimeexport const OAUTH_ACCESS_TOKEN_TTL_MS = 60 * 60 * 1000; // short-lived; refresh token rotates itexport const REFRESH_TOKEN_TTL_MS = 90 * 24 * 60 * 60 * 1000;-const MAX_CLIENTS = 32;+const MAX_CLIENTS = 64;const empty = (): Store => ({ clients: {}, codes: {}, tokens: {}, refreshTokens: {} });@@ -114,22 +115,34 @@ function sweep(store: Store): Store {return store;}+function referencedClientIds(store: Store): Set<string> {+ const now = Date.now();+ return new Set([+ ...Object.values(store.codes).filter((row) => row.expiresAt >= now).map((row) => row.clientId),+ ...Object.values(store.tokens).filter((row) => !row.revokedAt && row.expiresAt >= now).map((row) => row.clientId),+ ...Object.values(store.refreshTokens).filter((row) => !row.revokedAt && row.expiresAt >= now).map((row) => row.clientId),+ ].filter(Boolean));+}++function pruneUnreferencedClients(store: Store): void {+ const ids = Object.keys(store.clients);+ if (ids.length < MAX_CLIENTS) return;+ const referenced = referencedClientIds(store);+ const removable = ids+ .filter((id) => !referenced.has(id))+ .sort((a, b) => store.clients[a].createdAt - store.clients[b].createdAt);+ const removeCount = Math.min(removable.length, ids.length - MAX_CLIENTS + 1);+ for (const id of removable.slice(0, removeCount)) delete store.clients[id];+}+export function registerClient(name: string, redirectUris: string[]): Promise<string> {return mutate(async () => {const store = sweep(await read());- // Re-registering the same redirect set returns the existing id instead of- // minting a new one — mcp-remote and Cursor re-register on every launch.- const key = [...redirectUris].sort().join(" ");- for (const [id, c] of Object.entries(store.clients)) {- if ([...c.redirectUris].sort().join(" ") === key) return id;- }- const ids = Object.keys(store.clients);- if (ids.length >= MAX_CLIENTS) {- ids.sort((a, b) => store.clients[a].createdAt - store.clients[b].createdAt)- .slice(0, ids.length - MAX_CLIENTS + 1)- .forEach((id) => delete store.clients[id]);- }- const clientId = "mcpc_" + sha256hex(key + Date.now()).slice(0, 24);+ // RFC 7591 registration represents a client registration instance. Redirect+ // URIs are metadata, not client identity: two ChatGPT apps legitimately share+ // the same callback host and must not collapse onto one historical client_id.+ pruneUnreferencedClients(store);+ const clientId = "mcpc_" + randomUUID().replaceAll("-", "").slice(0, 24);const cleanName = name.slice(0, 80) || "MCP Client";store.clients[clientId] = { name: cleanName, redirectUris, profile: detectMcpToolProfile({ clientId, name: cleanName, redirectUris }), createdAt: Date.now() };await write(store);diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.tsindex 626de0a3..d8f2c705 100644--- a/lib/mcp/toolset.ts+++ b/lib/mcp/toolset.ts@@ -3,7 +3,7 @@ import type { Scope } from "./scope";import type { McpTool } from "./tool-kit";import { toolDescriptor, type McpToolProfile } from "./tool-contract";-export const MCP_SERVER_VERSION = "1.7.0";+export const MCP_SERVER_VERSION = "1.7.1";export const MCP_TOOLSET_VERSION = "2026.09.03.4";export const MCP_TOOLSET_CHANGED_AT = "2026-09-03T10:23:00Z";