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.

feat: enable image generation and full access defaults

Rahman5c6b17b00c03
diff --git a/.env.example b/.env.example
index 11685966..c866fe36 100644
--- a/.env.example
+++ b/.env.example
@@ -56,10 +56,10 @@ OS_SESSION_SECRET=
# (stored in ~/.mso/config.json). If unset, the assistant returns 501.
# ANTHROPIC_API_KEY=
#
-# Provider-run tools the Codex backend may use, comma/space separated (currently
-# only `image_generation`). OFF by default and deliberately opt-in: a built-in runs
-# on the provider's side, BILLS TO YOUR ChatGPT account, and returns content this
-# shell does not render yet — none of which should be a surprise on the next reply.
+# Provider-run tools the Codex backend may use, comma/space separated. Default:
+# `image_generation`. Set an explicit empty value to disable every built-in, or set
+# another allowlisted list to replace the default. Provider-run usage may bill the
+# connected ChatGPT account.
# OS_CODEX_BUILTIN_TOOLS=image_generation
# --- Managed apps: Hermes / OpenClaw (optional) ---
@@ -194,10 +194,10 @@ OS_SESSION_SECRET=
# OFF by default. While unset, /mcp and the OAuth discovery documents return 404 —
# there is no MCP surface at all, not an unauthenticated one.
# OS_MCP_ENABLED=1
-# Highest tier the consent screen may grant. read | write | exec. Default write,
-# so shell access is opt-in twice: once here, once per token on the consent page.
-# `exec` means a leaked bearer runs any command on this box as you.
-# OS_MCP_MAX_SCOPE=write
+# Highest tier the consent screen may grant. read | write | exec. Default: exec,
+# and the consent screen preselects that highest allowed tier. Set read or write to
+# opt down. `exec` means a leaked bearer runs any command on this box as you.
+# OS_MCP_MAX_SCOPE=exec
# Where clients/codes/tokens live. Default ~/.mso/mcp.json (0600). Only sha256 of
# each code and token is ever written.
# OS_MCP_STORE=/home/you/.mso/mcp.json
diff --git a/CLAUDE.md b/CLAUDE.md
index 66277319..fa7d66d9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -309,9 +309,9 @@ that is the kill switch, and demo mode forces it off. Read `docs/MCP.md` first.
(including `~/.mso` itself) and `exec.ts`'s destructive filter for free. A tool that
reimplements an operation reimplements its guard too — don't.
- Scope ladder `read < write < exec`, picked per token on the consent page, capped by
- `OS_MCP_MAX_SCOPE` (default `write`; **the running box is set to `exec`** — open
- decision, see the integration doc below). `tools/list` filters by it AND `tools/call`
- re-checks it — a client can call a name it was never shown.
+ `OS_MCP_MAX_SCOPE`. The default ceiling is `exec`, and consent preselects the highest
+ permitted tier; set the env to `read` or `write` to opt down. `tools/list` filters by
+ it AND `tools/call` re-checks it — a client can call a name it was never shown.
- **Tool names are a cross-repo contract.** `rahmanef63/connectors-gateway` registered
mso as a connector on 2026-08-17 and pins 15 of the 22 names as literal strings
(`x-upstream`), omitting `exec_run`, `browser_power`, and the five skill/workflow/visual tools added later. `GET /mcp` plus `_meta.toolset` now expose a version/hash/name manifest for parity checks. Renaming or removing
diff --git a/README.md b/README.md
index 314b81c2..1dd71277 100644
--- a/README.md
+++ b/README.md
@@ -169,7 +169,7 @@ An authenticated MSO session can read allowed files and run commands as the user
- Treat any file Alfa reads as untrusted input. The approval card is the only thing between text hidden inside a file and an `exec.run`. Read the command on the card, not Alfa's summary of it.
- Agents and Skills group tools for your own convenience. They are not a permission boundary: every agent can call every tool.
- `exec.run` is not sandboxed. Its cwd is bounded to your write roots, but the command itself runs in your login shell as the service user. The destructive-command denylist is a short accident tripwire, not a guard.
-- The MCP server is off unless `OS_MCP_ENABLED=1`. When on, a bearer token is a standing credential with whatever scope you granted it: at `exec` it runs any command on the box as you, and every call and result goes to the client's provider. Grant `read` unless you need more, cap the ceiling with `OS_MCP_MAX_SCOPE`, and treat anything the model reads as untrusted — scope is what stops a prompt-injected file talking it into a write. See [docs/MCP.md](./docs/MCP.md).
+- The MCP server is off unless `OS_MCP_ENABLED=1`. When on, a bearer token is a standing credential with whatever scope you granted it: at `exec` it runs any command on the box as you, and every call and result goes to the client's provider. The consent screen preselects the server ceiling (`exec` by default), so lower it before Allow when a client needs less; cap all tokens with `OS_MCP_MAX_SCOPE`, and treat anything the model reads as untrusted — scope is what stops a prompt-injected file talking it into a write. See [docs/MCP.md](./docs/MCP.md).
- MSO has not had a third-party security audit.
More detail: [SECURITY.md](./SECURITY.md), [docs/FAQ.md](./docs/FAQ.md) and [docs/INSTALL.md](./docs/INSTALL.md).
diff --git a/app/oauth/authorize/consent-form.tsx b/app/oauth/authorize/consent-form.tsx
index 012ec28a..1206fe6c 100644
--- a/app/oauth/authorize/consent-form.tsx
+++ b/app/oauth/authorize/consent-form.tsx
@@ -4,7 +4,7 @@ import { useState } from "react";
import { Button } from "@/components/ui/button";
import { approve } from "./actions";
import { followOAuthRedirect } from "./oauth-navigation";
-import type { Scope } from "@/lib/mcp/scope";
+import { defaultConsentScope, type Scope } from "@/lib/mcp/scope";
const TIERS: { value: Scope; label: string; blurb: string }[] = [
{ value: "read", label: "Read only", blurb: "List and read files, disk usage, CPU/memory, processes, installed apps." },
@@ -32,7 +32,8 @@ export function ConsentForm({
hidden: Record<string, string>;
}) {
const allowed = TIERS.slice(0, TIERS.findIndex((t) => t.value === ceiling) + 1);
- const [scope, setScope] = useState<Scope>("read");
+ // Preselect the highest tier this deployment permits; the owner may still lower it before allowing.
+ const [scope, setScope] = useState<Scope>(defaultConsentScope(ceiling));
const [error, setError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 712a69b0..e68f67a7 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Added**
+- enable image generation and full access defaults
- `mcp` isolate workflows and standardize skill flows
- `mcp` streamline bootstrap and workflow visibility
- add semantic skill memory and workflow recipes
diff --git a/docs/MCP.md b/docs/MCP.md
index 5a42e09f..67bc9d0b 100644
--- a/docs/MCP.md
+++ b/docs/MCP.md
@@ -13,7 +13,7 @@ unauthenticated one.
```bash
# .env.local
OS_MCP_ENABLED=1
-OS_MCP_MAX_SCOPE=write # read | write | exec — the ceiling the consent screen may grant
+OS_MCP_MAX_SCOPE=exec # optional: exec is the default; use read/write to opt down
```
Then `bun run build && sudo systemctl restart mso.service` (build THEN restart —
@@ -55,7 +55,7 @@ OAuth" — it means `OS_MCP_ENABLED` is not set on the running process.
## The three scopes
-Picked per token, on the consent screen, capped by `OS_MCP_MAX_SCOPE`.
+Picked per token, on the consent screen, capped by `OS_MCP_MAX_SCOPE`. The highest allowed tier is preselected (`exec` on a default install); lower it before Allow when a client does not need full host access.
| Scope | Tools |
|---|---|
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 4613021d..514ec688 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -8,6 +8,20 @@ Running log of what shipped each phase. Newest at top.
> Read those phases as history. **This file is the source of truth for what exists** —
> `ARCHITECTURE.md` is no longer maintained and carries a stale-warning banner.
+## 2026-08-20 — image generation and full-access defaults (DONE)
+
+Fresh MSO installs now expose Codex provider-side `image_generation` when
+`OS_CODEX_BUILTIN_TOOLS` is absent, matching the owner's expected assistant capability.
+An explicit empty value still disables every provider built-in, and an explicit list
+replaces the default through the existing allowlist. Regression tests cover the default,
+the opt-out, and unknown-tool filtering.
+
+MCP now defaults its ceiling to `exec`, and the OAuth consent form preselects the highest
+tier that ceiling permits, so “Allow” grants full access without an extra radio change on
+the owner's single-user deployment. `OS_MCP_MAX_SCOPE=read|write` still opts the whole
+server down, malformed explicit values fail closed to `write`, the form still shows the
+full-shell warning, and the server action keeps absent/unknown submitted scopes at `read`.
+
## 2026-08-19 — isolated parallel workflows and a skill-flow factory (DONE)
The first bootstrap release still had one unsafe fallback: active workflow memory was
diff --git a/lib/ai/codex-stream.test.ts b/lib/ai/codex-stream.test.ts
index bcbb879a..1d8a287a 100644
--- a/lib/ai/codex-stream.test.ts
+++ b/lib/ai/codex-stream.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it, vi, afterEach } from "vitest";
+import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { streamCodex } from "./codex-stream";
import type { OaMsg, OaTool } from "./openai-stream";
@@ -7,8 +7,14 @@ import type { OaMsg, OaTool } from "./openai-stream";
// simply never sent them — so the UI advertised a catalog the model never saw.
const realFetch = globalThis.fetch;
+beforeEach(() => {
+ // Most tests exercise host function tools in isolation. Provider built-ins have
+ // their own cases below, including the real default when the env is absent.
+ vi.stubEnv("OS_CODEX_BUILTIN_TOOLS", "");
+});
afterEach(() => {
globalThis.fetch = realFetch;
+ vi.unstubAllEnvs();
});
const sse = (...events: unknown[]) =>
@@ -191,18 +197,25 @@ describe("reading calls back", () => {
});
describe("provider-executed built-ins", () => {
- it("declares nothing extra by default — a provider-run tool bills the owner", async () => {
+ it("enables image_generation when OS_CODEX_BUILTIN_TOOLS is absent", async () => {
+ vi.unstubAllEnvs();
+ delete process.env.OS_CODEX_BUILTIN_TOOLS;
+ const sent = capture(sse({ type: "response.completed", response: { output: [] } }));
+ await run({ tools: [TOOL] });
+ expect((sent().tools ?? []).map((t) => t.type)).toEqual(["function", "image_generation"]);
+ });
+
+ it("accepts an explicit empty value to disable every provider built-in", async () => {
const sent = capture(sse({ type: "response.completed", response: { output: [] } }));
await run({ tools: [TOOL] });
expect(sent().tools).toHaveLength(1);
});
- it("adds an opted-in built-in by type alone, and ignores an unknown one", async () => {
+ it("uses an explicit built-in list by type alone and ignores unknown entries", async () => {
vi.stubEnv("OS_CODEX_BUILTIN_TOOLS", "image_generation, not_a_tool");
const sent = capture(sse({ type: "response.completed", response: { output: [] } }));
await run({ tools: [TOOL] });
const tools = sent().tools ?? [];
expect(tools.map((t) => t.type)).toEqual(["function", "image_generation"]);
- vi.unstubAllEnvs();
});
});
diff --git a/lib/ai/codex-stream.ts b/lib/ai/codex-stream.ts
index 483e9efc..32742aa0 100644
--- a/lib/ai/codex-stream.ts
+++ b/lib/ai/codex-stream.ts
@@ -39,12 +39,11 @@ type ResponsesTool =
| { type: "function"; name: string; description: string; strict: boolean; parameters: Record<string, unknown> }
| { type: string };
-/** Built-ins the owner opted into, e.g. `OS_CODEX_BUILTIN_TOOLS=image_generation`.
- * Off by default: a provider-run tool bills to the owner's ChatGPT account and
- * returns content this shell does not render yet, so it is opt-in rather than a
- * surprise on the next reply. */
+/** Provider-run built-ins available to Codex. `image_generation` is enabled when
+ * the variable is absent; an explicit empty `OS_CODEX_BUILTIN_TOOLS=` disables all
+ * built-ins, while a comma/space-separated value replaces the default. */
function builtinTools(): ResponsesTool[] {
- return (process.env.OS_CODEX_BUILTIN_TOOLS ?? "")
+ return (process.env.OS_CODEX_BUILTIN_TOOLS ?? "image_generation")
.split(/[\s,]+/)
.filter((t) => BUILTIN_TOOL_TYPES.has(t))
.map((type) => ({ type }));
diff --git a/lib/mcp/scope.test.ts b/lib/mcp/scope.test.ts
index 9163a9a9..71e1eada 100644
--- a/lib/mcp/scope.test.ts
+++ b/lib/mcp/scope.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect, afterEach } from "vitest";
-import { parseScope, allows, mcpEnabled, maxScope, clampScope } from "./scope";
+import { parseScope, allows, mcpEnabled, maxScope, clampScope, defaultConsentScope } from "./scope";
const env = { ...process.env };
afterEach(() => {
@@ -55,10 +55,16 @@ describe("mcpEnabled", () => {
});
describe("maxScope / clampScope", () => {
- it("defaults the ceiling to write, so shell access is opt-in twice", () => {
+ it("defaults the ceiling to exec for full-access owner workflows", () => {
delete process.env.OS_MCP_MAX_SCOPE;
- expect(maxScope()).toBe("write");
- expect(clampScope("exec")).toBe("write");
+ expect(maxScope()).toBe("exec");
+ expect(clampScope("exec")).toBe("exec");
+ });
+
+ it("preselects the highest tier the deployment permits on OAuth consent", () => {
+ expect(defaultConsentScope("exec")).toBe("exec");
+ expect(defaultConsentScope("write")).toBe("write");
+ expect(defaultConsentScope("read")).toBe("read");
});
it("honours a lower ceiling", () => {
diff --git a/lib/mcp/scope.ts b/lib/mcp/scope.ts
index 82bce994..be4714b5 100644
--- a/lib/mcp/scope.ts
+++ b/lib/mcp/scope.ts
@@ -33,12 +33,13 @@ export function mcpEnabled(): boolean {
return process.env.OS_MCP_ENABLED === "1";
}
-/** The ceiling the deployment allows, whatever a consent page asks for. Set
- * `OS_MCP_MAX_SCOPE=read` to make it impossible to mint an exec token even by
- * accident. Defaults to `write`: shell access is opt-in, twice. */
+/** The ceiling the deployment allows, whatever a consent page asks for. The
+ * owner wants full MCP capability on a fresh install, so an absent value defaults
+ * to `exec`. Set `OS_MCP_MAX_SCOPE=read` or `write` to opt down. A malformed explicit
+ * value still fails closed to `write` rather than silently granting shell access. */
export function maxScope(): Scope {
const raw = process.env.OS_MCP_MAX_SCOPE;
- if (!raw) return "write";
+ if (!raw) return "exec";
const s = String(raw).trim();
return (SCOPES as readonly string[]).includes(s) ? (s as Scope) : "write";
}
@@ -47,3 +48,8 @@ export function clampScope(asked: Scope): Scope {
const ceiling = maxScope();
return RANK[asked] > RANK[ceiling] ? ceiling : asked;
}
+
+/** OAuth consent starts at the deployment ceiling; the owner may select a lower tier. */
+export function defaultConsentScope(ceiling: Scope): Scope {
+ return ceiling;
+}