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(update): enforce main and raise MCP daily limit

Rahman0a619dc51fc9
diff --git a/app/mcp/route.test.ts b/app/mcp/route.test.ts
index 7908f424..8a7e4c01 100644
--- a/app/mcp/route.test.ts
+++ b/app/mcp/route.test.ts
@@ -54,8 +54,8 @@ describe("/mcp request boundary", () => {
mocks.touchToken.mockClear();
mocks.dispatch.mockClear();
mocks.clampScope.mockClear();
- mocks.rateLimited.mockReturnValue(false);
- mocks.rateLimitedUntrusted.mockReturnValue(false);
+ mocks.rateLimited.mockClear().mockReturnValue(false);
+ mocks.rateLimitedUntrusted.mockClear().mockReturnValue(false);
});
afterEach(() => vi.unstubAllEnvs());
@@ -117,6 +117,14 @@ describe("/mcp request boundary", () => {
expect(mocks.dispatch).toHaveBeenCalledWith(body, "read", `mcp:${token.hash.slice(0, 16)}`);
});
+ it("applies the 50,000-call daily token limit", async () => {
+ const token = { hash: "d".repeat(64), scope: "read" as const };
+ mocks.validateToken.mockResolvedValueOnce(token);
+ const { POST } = await import("./route");
+ await POST(request(JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" })));
+ expect(mocks.rateLimited).toHaveBeenNthCalledWith(2, `mcp:day:${token.hash}`, 50_000, 86_400_000);
+ });
+
it("does not acknowledge an unauthenticated notification", async () => {
mocks.validateToken.mockResolvedValueOnce(null);
const { POST } = await import("./route");
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 11747547..905e549d 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-08-31
+
+**Fixed**
+
+- `update` enforce main and raise MCP daily limit
+- `mcp` raise daily token call limit
+
## 2026-08-30
**Added**
diff --git a/docs/MCP.md b/docs/MCP.md
index f504f3c9..b3b3e5da 100644
--- a/docs/MCP.md
+++ b/docs/MCP.md
@@ -533,7 +533,7 @@ arguments. The v2 store keeps up to 20 isolated active workflows per MCP actor,
## Rate limits
-Per token: 120 calls/min, 5,000/day. Per IP before auth: 240/min. DCR: 10
+Per token: 120 calls/min, 50,000/day. Per IP before auth: 240/min. DCR: 10
registrations/hour/IP. Token exchange: 30/min/IP. All in-memory (process-local,
resets on restart) — enough to blunt a runaway agent, which is the realistic
failure mode for an endpoint whose top scope is a shell.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 671cd860..c648352e 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -2,6 +2,17 @@
Running log of what shipped each phase. Newest at top.
+## 2026-08-31 — 10× MCP daily allowance + truthful Settings updater preflight (SHIPPED)
+
+The authenticated MCP endpoint now permits 50,000 calls per token per fixed 24-hour process-local
+window, up from 5,000, while retaining the 120-per-minute runaway-client guard. The public MCP
+tool names, schemas, scopes and toolset signature are unchanged; this is an endpoint limit only.
+
+Settings software update now refuses non-`main` checkouts before starting its transient updater,
+matching the CLI contract and preventing a feature branch from being misreported as merely one
+commit behind `origin/main`. The executor independently enforces the same branch boundary, and the
+panel no longer labels an unsupported checkout as a remote-connectivity failure.
+
## 2026-08-30 — Loopback-only public gateway + resilient WSL CLI lifecycle (SHIPPED)
MSO now has an explicit laptop/WSL public-access lifecycle without widening the application bind.
diff --git a/frontend/slices/os-settings/components/update-section.tsx b/frontend/slices/os-settings/components/update-section.tsx
index 8940273c..d75da1ae 100644
--- a/frontend/slices/os-settings/components/update-section.tsx
+++ b/frontend/slices/os-settings/components/update-section.tsx
@@ -138,7 +138,7 @@ export function UpdateSection() {
</p>
)}
{info?.currentSubject && <p className="line-clamp-2 text-[11px] text-muted-foreground">{info.currentSubject}</p>}
- {info && !info.remoteChecked && !running && (
+ {info?.supported !== false && !info?.remoteChecked && !running && (
<p className="text-[11px] text-amber-500">
Could not reach the remote — this is what was last fetched, not necessarily what is on main now.
</p>
diff --git a/lib/host/self-update.test.ts b/lib/host/self-update.test.ts
index e7b356f0..76d6bc6f 100644
--- a/lib/host/self-update.test.ts
+++ b/lib/host/self-update.test.ts
@@ -7,7 +7,7 @@ import { describe, expect, it, vi } from "vitest";
vi.mock("server-only", () => ({}));
-const { parseCommits, blockingReason, updateUnitArgs } = await import("./self-update");
+const { parseCommits, blockingReason, updateBranchReason, updateUnitArgs } = await import("./self-update");
const status = (over: Partial<Parameters<typeof blockingReason>[0]> = {}) => ({
supported: true,
@@ -66,6 +66,14 @@ describe("updateUnitArgs", () => {
});
});
+describe("updateBranchReason", () => {
+ it("keeps Settings updates on main", () => {
+ expect(updateBranchReason("main\n")).toBeNull();
+ expect(updateBranchReason("feat/runtime")).toContain("current: feat/runtime");
+ expect(updateBranchReason("")).toContain("detached HEAD");
+ });
+});
+
describe("blockingReason", () => {
it("lets a normal update through", () => {
expect(blockingReason(status(), false)).toBeNull();
diff --git a/lib/host/self-update.ts b/lib/host/self-update.ts
index 02b1ba33..3752b720 100644
--- a/lib/host/self-update.ts
+++ b/lib/host/self-update.ts
@@ -64,6 +64,13 @@ export const updateLogPath = (): string => {
const repoRoot = (): string => process.cwd();
+export function updateBranchReason(branch: string): string | null {
+ const current = branch.trim();
+ return current === "main"
+ ? null
+ : `software updates require the checkout to be on main (current: ${current || "detached HEAD"})`;
+}
+
/** Arguments are pure/testable because this boundary is security-sensitive: the
* request may choose only update vs rebuild. No path, command, ref, or root-capable
* argument comes from the client. */
@@ -185,6 +192,12 @@ export async function getUpdateStatus(fetchRemote = true): Promise<UpdateStatus>
return { ...base, reason: "this deployment is not a git checkout, so there is nothing to pull" };
}
+ const branch = await git(["branch", "--show-current"]);
+ const branchReason = updateBranchReason(branch.stdout);
+ if (branch.code !== 0 || branchReason) {
+ return { ...base, reason: branch.code === 0 ? branchReason : "could not determine the checkout branch" };
+ }
+
// The installer enables linger and gives mso.service XDG_RUNTIME_DIR precisely
// so the service can reach this per-user manager. Unlike the old sudo path, this
// is both non-interactive and non-root.
diff --git a/lib/mcp/tool-kit.ts b/lib/mcp/tool-kit.ts
index 40b64292..c4141a66 100644
--- a/lib/mcp/tool-kit.ts
+++ b/lib/mcp/tool-kit.ts
@@ -62,7 +62,7 @@ export interface McpTool {
};
/** Per-OPERATION rate limit, mirroring the one its /api/v1 route already applies.
*
- * The token bucket in app/mcp/route.ts is per TOKEN (120/min, 5000/day) and says
+ * The token bucket in app/mcp/route.ts is per TOKEN (120/min, 50,000/day) and says
* nothing about which tool was called, so an MCP client got the same allowance
* for `apps_power` as for `fs_list` — while the browser and the CLI hit
* `managed-app:<id>` at 12/min going through the route. That is a 10x gap on a
diff --git a/scripts/mso-gateway-boundaries.test.ts b/scripts/mso-gateway-boundaries.test.ts
index e17a2478..0b4c4089 100644
--- a/scripts/mso-gateway-boundaries.test.ts
+++ b/scripts/mso-gateway-boundaries.test.ts
@@ -92,7 +92,7 @@ esac
expect(after.mode).toBe("temporary");
expect(after.tunnelIdentity.pid).toBe(before.tunnelIdentity.pid);
run(["stop"], f.baseEnv);
- });
+ }, 15_000);
it("uses kernel flock locks instead of stale-directory reclamation", () => {
for (const name of ["gateway-lock.sh", "update-state.sh"]) {
diff --git a/scripts/mso-update-authority.test.ts b/scripts/mso-update-authority.test.ts
index e5b1ebbb..c8cbc1fe 100644
--- a/scripts/mso-update-authority.test.ts
+++ b/scripts/mso-update-authority.test.ts
@@ -56,4 +56,13 @@ describe("origin/main deployment authority", () => {
expect(fs.readFileSync(log, "utf8")).toContain("ahead of origin/main");
expect(fs.existsSync(f.capture) ? fs.readFileSync(f.capture, "utf8") : "").not.toContain("bun");
});
+
+ it("active-service updates refuse a feature branch before building", () => {
+ const f = fixture(), log = path.join(f.base, "self-update.log");
+ git(f.repo, "switch", "-c", "feat/runtime");
+ const out = spawnSync(path.join(f.repo, "scripts/self-update.sh"), ["--rebuild-only"], { env: { ...f.env, MSO_UPDATE_LOG: log }, encoding: "utf8" });
+ expect(out.status).not.toBe(0);
+ expect(fs.readFileSync(log, "utf8")).toContain("current: feat/runtime");
+ expect(fs.existsSync(f.capture) ? fs.readFileSync(f.capture, "utf8") : "").not.toContain("bun");
+ });
});
diff --git a/scripts/self-update.sh b/scripts/self-update.sh
index 18970f60..d32d59b1 100755
--- a/scripts/self-update.sh
+++ b/scripts/self-update.sh
@@ -45,6 +45,8 @@ esac
step "self-update starting (rebuild-only=$REBUILD_ONLY, ship-finalize=$SHIP_FINALIZE)"
HEAD_SHA="$(git rev-parse HEAD 2>/dev/null || true)"
[ -n "$HEAD_SHA" ] || die "could not read checkout HEAD"
+CURRENT_BRANCH="$(git branch --show-current 2>/dev/null || true)"
+[ "$CURRENT_BRANCH" = main ] || die "updates require checkout to be on main (current: ${CURRENT_BRANCH:-detached HEAD})"
printf 'at %s
' "${HEAD_SHA:0:7}"