A desktop coding agent with free access to frontier models.
TypeScript
fix: list every allowed MCP server
ogsamrat7b034fbd0944
diff --git a/apps/server/src/mcp-allow/state.test.ts b/apps/server/src/mcp-allow/state.test.tsindex f98a2f1d..63f7a97e 100644--- a/apps/server/src/mcp-allow/state.test.ts+++ b/apps/server/src/mcp-allow/state.test.ts@@ -105,20 +105,21 @@ describe("the engine plugin (omnirush-mcp-policy)", () => {await hooks.config({}, output);const mcp = output.mcp as Record<string, { command: string[] }>;expect(Object.keys(mcp).sort()).toEqual(["filesystem", "time"]);- expect(mcp.filesystem!.command).toEqual(["npx", "-y", "@modelcontextprotocol/[email protected]", "."]);- expect(mcp.time!.command).toEqual(["uvx", "[email protected]"]);+ const npx = ["npx", "--prefix", path.join(process.env.OMNIRUSH_MCP_REPORT_DIR!, "..", "npx-prefix"), "-y"];+ expect(mcp.filesystem!.command).toEqual([...npx, "@modelcontextprotocol/[email protected]", "."]);+ expect(mcp.time!.command).toEqual(["uvx", "--no-config", "[email protected]"]);const report = workspaceMcpReport(state, root);const byName = Object.fromEntries((report?.decisions ?? []).map((decision) => [decision.name, decision]));expect(byName.script).toMatchObject({ status: "blocked", code: "unknown_command" });expect(byName.notion).toMatchObject({ status: "blocked", code: "remote" });expect(byName.files).toMatchObject({ status: "allowed", renamed_to: "filesystem", sandbox: false });expect(mcpServersInUse(report)).toEqual([- { id: "time", package: "mcp-server-time", version: "2026.8.18", runtime: "pypi", sandbox: false },- { id: "filesystem", package: "@modelcontextprotocol/server-filesystem", version: "2026.8.31", runtime: "npm", sandbox: false },+ { id: "time", package: "mcp-server-time", version: "2026.8.18", runtime: "pypi", sandbox: false, enabled: true },+ { id: "filesystem", package: "@modelcontextprotocol/server-filesystem", version: "2026.8.31", runtime: "npm", sandbox: false, enabled: true },]);});- test("a server the user turned off is not listed as in use", async () => {+ test("a server the user turned off is listed, marked enabled: false", async () => {const { state, root } = setup();rememberMcpPolicy(state, { mcp: policyFixture });writeWorkspaceMcp(state, root, { files: { ...FILESYSTEM, enabled: false } });@@ -127,7 +128,7 @@ describe("the engine plugin (omnirush-mcp-policy)", () => {await hooks.config({}, output);const report = workspaceMcpReport(state, root);expect(report?.decisions[0]?.enabled).toBe(false);- expect(mcpServersInUse(report)).toBeNull();+ expect(mcpServersInUse(report)).toEqual([{ id: "filesystem", package: "@modelcontextprotocol/server-filesystem", version: "2026.8.31", runtime: "npm", sandbox: false, enabled: false }]);});test("a project whose sandbox is on runs its servers through the box shell", async () => {@@ -145,7 +146,7 @@ describe("the engine plugin (omnirush-mcp-policy)", () => {await hooks.config({}, output);const entry = (output.mcp as Record<string, { command: string[]; environment: Record<string, string> }>).filesystem!;expect(entry.command[0]).toBe(path.join(home, "shell", process.platform === "win32" ? "bash.exe" : "bash"));- expect(entry.command.slice(1)).toEqual(["-c", "exec npx -y @modelcontextprotocol/[email protected] ."]);+ expect(entry.command.slice(1)).toEqual(["-c", "mkdir -p /tmp/omnirush-mcp-npx && exec npx --prefix /tmp/omnirush-mcp-npx -y @modelcontextprotocol/[email protected] ."]);expect(entry.environment).toEqual({ OMNIRUSH_BOX_KEY: key });expect(mcpServersInUse(workspaceMcpReport(state, root))?.[0]?.sandbox).toBe(true);});diff --git a/apps/server/src/mcp-allow/state.ts b/apps/server/src/mcp-allow/state.tsindex e1864a63..68301405 100644--- a/apps/server/src/mcp-allow/state.ts+++ b/apps/server/src/mcp-allow/state.ts@@ -152,19 +152,25 @@ export function decideMcpEntry(stateDir: string, root: string, name: string, entreturn decisions[0] ?? { name, status: "blocked", code: "invalid", reason: "This MCP server entry is not valid." };}-export type McpServerUse = { id: string; package: string; version: string; runtime: string; sandbox: boolean };+export type McpServerUse = { id: string; package: string; version: string; runtime: string; sandbox: boolean; enabled: boolean };-/** The servers a session in this project uses (from the plugin's report); null when none is on. */+/**+ * The servers a session in this project can use (from the plugin's report);+ * null when none is allowed. A server the user turned off is listed with+ * `enabled: false`: it can still be switched on during the session, so the+ * replay installs it too.+ */export function mcpServersInUse(report: McpReport | null): McpServerUse[] | null {if (!report || !report.enabled) return null;const used = report.decisions- .filter((decision) => decision.status === "allowed" && decision.enabled !== false && decision.id && decision.package && decision.version && decision.runtime)+ .filter((decision) => decision.status === "allowed" && decision.id && decision.package && decision.version && decision.runtime).map((decision) => ({id: decision.id as string,package: decision.package as string,version: decision.version as string,runtime: decision.runtime as string,sandbox: decision.sandbox === true,+ enabled: decision.enabled !== false,}));return used.length ? used : null;}