Skip to content

armgit / mso

Public Imported from GitHub
0

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

fix(mcp): advertise implemented protocol era

Rahmana49cd45ba6ec
diff --git a/CLAUDE.md b/CLAUDE.md
index 5c1e8bdd..059c51e7 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.2 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->
+ <!-- mcp-toolset: server=1.7.3 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-corrupt
diff --git a/app/mcp/route.test.ts b/app/mcp/route.test.ts
index 6e0278e4..1f47a7d2 100644
--- a/app/mcp/route.test.ts
+++ b/app/mcp/route.test.ts
@@ -45,7 +45,7 @@ vi.mock("@/lib/host", () => ({
vi.mock("@/lib/mcp/tools", () => ({ TOOLS: [] }));
vi.mock("@/lib/mcp/toolset", () => ({ toolsetInfo: () => ({}) }));
vi.mock("@/lib/mcp/client-profile", () => ({ detectMcpToolProfile: ({ name }: { name?: string }) => name === "ChatGPT" ? "chatgpt" : "full" }));
-vi.mock("@/lib/mcp/protocol", () => ({ supportedMcpProtocol: (v: string) => ["2026-07-28", "2025-11-25", "2024-11-05"].includes(v) }));
+vi.mock("@/lib/mcp/protocol", () => ({ supportedMcpProtocol: (v: string) => ["2025-06-18", "2025-03-26", "2024-11-05"].includes(v) }));
vi.mock("@/lib/mcp/tool-contract", () => ({ visibleToolsForProfile: () => [] }));
vi.mock("@/lib/agent/session-store", () => ({
@@ -192,6 +192,14 @@ describe("/mcp request boundary", () => {
expect(mocks.dispatch).not.toHaveBeenCalled();
});
+ it("rejects a 2026-07-28 modern probe so the client can fall back to initialize", async () => {
+ mocks.validateToken.mockResolvedValueOnce({ hash: "2".repeat(64), scope: "read", clientId: "client-modern-probe", label: "Modern probe" });
+ const { POST } = await import("./route");
+ const res = await POST(request(JSON.stringify({ jsonrpc: "2.0", id: 1, method: "server/discover", params: { _meta: { "io.modelcontextprotocol/protocolVersion": "2026-07-28" } } }), { "MCP-Protocol-Version": "2026-07-28", "Mcp-Method": "server/discover" }));
+ expect(res.status).toBe(400);
+ expect(mocks.dispatch).not.toHaveBeenCalled();
+ });
+
it("rejects an unsupported MCP-Protocol-Version before dispatch", async () => {
mocks.validateToken.mockResolvedValueOnce({ hash: "1".repeat(64), scope: "read", clientId: "client-protocol", label: "Protocol" });
const { POST } = await import("./route");
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index f3b8609a..2ba08192 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.2 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->
+<!-- mcp-toolset: server=1.7.3 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 the
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 6ee1f33f..3b4425e3 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**
+- `mcp` advertise implemented protocol era
- `mcp` support trusted browser probes
- `oauth` issue distinct dynamic client ids
- `mcp` make read pipeline schema portable
diff --git a/docs/CHATGPT-PLUGIN.md b/docs/CHATGPT-PLUGIN.md
index 789c282d..378d8df5 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.2 version=2026.09.03.4 tools=28 read=14 write=8 exec=6 app-only=1 total=29 -->
+<!-- mcp-chatgpt-profile: server=1.7.3 version=2026.09.03.4 tools=28 read=14 write=8 exec=6 app-only=1 total=29 -->
-MSO server **1.7.2**, 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.3**, 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`.
Browser-hosted MCP probes from ChatGPT are allowed only when they target the configured public `OS_PUBLIC_ORIGIN`; arbitrary origins and ChatGPT-origin requests aimed at loopback remain denied. Additional trusted browser hosts can be added explicitly with comma-separated `OS_MCP_BROWSER_ORIGINS`. Public OAuth discovery and DCR responses carry CORS metadata; authenticated `/mcp` echoes only an approved exact origin.
diff --git a/docs/MCP.md b/docs/MCP.md
index c944e17f..ac99189c 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.2 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->
+<!-- mcp-toolset: server=1.7.3 version=2026.09.03.4 tools=72 read=34 write=24 exec=14 -->
-Current full transport catalog: **73 tools**, server `1.7.2` / toolset `2026.09.03.4`.
+Current full transport catalog: **73 tools**, server `1.7.3` / 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.md
index a480f11c..d8a5887f 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,5 +1,6 @@
# mso — Progress Log
+- **MCP protocol-era correctness (2026-09-03):** server `1.7.3` stops claiming the stateless `2026-07-28` protocol while serving the legacy initialize/session wire shape. The supported ceiling is deliberately `2025-06-18` (matching the known-good CareerPack ChatGPT connector); a modern HTTP probe receives a 400 and can fall back to initialize. `server/discover` is no longer aliased to the legacy initialize payload. Browser CORS also permits `Mcp-Method`/`Mcp-Name` so a standards-aware probe can reach the server and receive the fallback signal. Toolset stays `2026.09.03.4`.
Running log of what shipped each phase. Newest at top.
## 2026-09-03 — OAuth DCR registration identity fix
diff --git a/docs/TESTING-HANDOFF.md b/docs/TESTING-HANDOFF.md
index 3db3cafc..82653e6d 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.2`, 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.3`, 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:
```text
You 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.2, 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.3, 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.ts
index eabdb266..e2eeb090 100644
--- a/lib/mcp/dispatch.test.ts
+++ b/lib/mcp/dispatch.test.ts
@@ -43,10 +43,15 @@ describe("protocol", () => {
expect(execInstructions).toContain("workflow_finish");
});
+ it("does not impersonate modern server/discover with an initialize-shaped result", async () => {
+ const r = await dispatch({ id: 9, method: "server/discover" }, "read");
+ expect(r.error).toMatchObject({ code: -32601 });
+ });
+
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.2");
+ expect(result.serverInfo.version).toBe("1.7.3");
expect(result._meta.toolset.toolCount).toBe(TOOLS.length);
expect(result._meta.toolset.hash).toMatch(/^[a-f0-9]{16}$/);
});
diff --git a/lib/mcp/dispatch.ts b/lib/mcp/dispatch.ts
index 3e428498..a496e3ca 100644
--- a/lib/mcp/dispatch.ts
+++ b/lib/mcp/dispatch.ts
@@ -30,8 +30,7 @@ function instructions(scope: Scope, profile: McpToolProfile = "full"): string {
export async function dispatch(req: RpcRequest, scope: Scope, actor?: string, agentContext?: McpAgentContext): Promise<Record<string, unknown>> {
const id = req.id ?? null;
switch (req.method) {
- case "initialize":
- case "server/discover": {
+ case "initialize": {
const profile = agentContext?.toolProfile ?? "full";
const tools = visibleTools(scope, profile), toolset = toolsetInfo(tools, scope, profile);
return rpcOk(id, {
diff --git a/lib/mcp/origin.ts b/lib/mcp/origin.ts
index 64fd9801..21d368f4 100644
--- a/lib/mcp/origin.ts
+++ b/lib/mcp/origin.ts
@@ -92,7 +92,7 @@ export function mcpCorsHeaders(req: Request): Record<string, string> {
return {
"Access-Control-Allow-Origin": origin,
"Access-Control-Allow-Methods": "POST, GET, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type, Authorization, Mcp-Session-Id, MCP-Protocol-Version",
+ "Access-Control-Allow-Headers": "Content-Type, Authorization, Mcp-Session-Id, MCP-Protocol-Version, Mcp-Method, Mcp-Name",
"Access-Control-Expose-Headers": "Mcp-Session-Id, WWW-Authenticate",
"Access-Control-Max-Age": "86400",
Vary: "Origin",
diff --git a/lib/mcp/protocol.test.ts b/lib/mcp/protocol.test.ts
new file mode 100644
index 00000000..81efa0cb
--- /dev/null
+++ b/lib/mcp/protocol.test.ts
@@ -0,0 +1,15 @@
+import { describe, expect, it } from "vitest";
+import { MCP_PROTOCOL_LATEST, MCP_PROTOCOLS, negotiateMcpProtocol, supportedMcpProtocol } from "./protocol";
+
+describe("MCP protocol era", () => {
+ it("advertises only initialize-capable revisions", () => {
+ expect(MCP_PROTOCOL_LATEST).toBe("2025-06-18");
+ expect(MCP_PROTOCOLS).toEqual(["2025-06-18", "2025-03-26", "2024-11-05"]);
+ expect(supportedMcpProtocol("2026-07-28")).toBe(false);
+ });
+
+ it("never counter-offers the stateless revision from initialize", () => {
+ expect(negotiateMcpProtocol("2026-07-28")).toBe("2025-06-18");
+ expect(negotiateMcpProtocol("2025-06-18")).toBe("2025-06-18");
+ });
+});
diff --git a/lib/mcp/protocol.ts b/lib/mcp/protocol.ts
index 2f406db4..a03cb075 100644
--- a/lib/mcp/protocol.ts
+++ b/lib/mcp/protocol.ts
@@ -1,5 +1,10 @@
-export const MCP_PROTOCOL_LATEST = "2026-07-28";
-export const MCP_PROTOCOLS = [MCP_PROTOCOL_LATEST, "2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"] as const;
+// MSO currently serves the initialize/session-era MCP wire contract.
+// Do not advertise the 2026-07-28 stateless era until server/discover,
+// per-request metadata and modern Streamable HTTP headers are implemented as
+// one coherent transport. A modern HTTP client can probe 2026-07-28, receive
+// an explicit 400 from app/mcp/route.ts, then fall back to this legacy ceiling.
+export const MCP_PROTOCOL_LATEST = "2025-06-18";
+export const MCP_PROTOCOLS = [MCP_PROTOCOL_LATEST, "2025-03-26", "2024-11-05"] as const;
export function negotiateMcpProtocol(requested?: string): string {
return requested && (MCP_PROTOCOLS as readonly string[]).includes(requested) ? requested : MCP_PROTOCOL_LATEST;
diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.ts
index 6617d5c2..73f5851b 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.2";
+export const MCP_SERVER_VERSION = "1.7.3";
export const MCP_TOOLSET_VERSION = "2026.09.03.4";
export const MCP_TOOLSET_CHANGED_AT = "2026-09-03T10:23:00Z";