A desktop coding agent with free access to frontier models.
TypeScript
fix: no MCP servers without the filter
ogsamrate34a4f1decaf
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 8a245d24..f5a194fa 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -701,6 +701,8 @@ export type OmniRushMcpPolicyView = {ignored?: Array<{ kind: "plugin" | "lsp" | "formatter" | "provider"; name: string; source: string | null }>;/** One line about it, or null. */ignoredNotice?: string | null;+ /** The engine's MCP filter is missing, so no MCP server starts (fails closed); the warning, or null. */+ filterMissing?: string | null;};export type OmniRushMcpAppResource = {diff --git a/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx b/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsxindex bccde0d0..66905c7a 100644--- a/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx+++ b/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx@@ -107,6 +107,9 @@ export function McpSupportedPanel(props: {const [addError, setAddError] = useState<{ id: string; message: string } | null>(null);const decisionFor = (name: string) => props.policy.decisions.find((decision) => decision.name === name) ?? null;+ const filterMissing = props.policy.filterMissing?.trim() ? (+ <p data-testid="mcp-filter-missing" className="text-sm font-medium text-amber-11">{props.policy.filterMissing.trim()}</p>+ ) : null;const ignoredNotice = props.policy.ignoredNotice?.trim() ? (<p data-testid="mcp-project-code-ignored" className="text-xs text-dls-secondary">{props.policy.ignoredNotice.trim()}</p>) : null;@@ -117,6 +120,7 @@ export function McpSupportedPanel(props: {<p data-testid="mcp-policy-off" className="text-sm text-dls-secondary">{props.policy.message?.trim() || "MCP servers are turned off for this account."}</p>+ {filterMissing}{ignoredNotice}</div>);@@ -137,6 +141,7 @@ export function McpSupportedPanel(props: {return (<div data-testid="mcp-supported-panel" className="mb-6 flex flex-col gap-5">+ {filterMissing}{ignoredNotice}{props.policy.engineV2 ? (<p data-testid="mcp-engine-v2-note" className="text-sm text-dls-secondary">{MCP_ENGINE_V2_NOTE}</p>diff --git a/apps/app/tests/mcp-supported-panel.test.tsx b/apps/app/tests/mcp-supported-panel.test.tsxindex 1600d649..c076e9e0 100644--- a/apps/app/tests/mcp-supported-panel.test.tsx+++ b/apps/app/tests/mcp-supported-panel.test.tsx@@ -167,4 +167,11 @@ describe("Settings > MCP: supported servers", () => {expect(render({ policy: policy({ supported: [remote], decisions: on }), servers: [server("figma", { type: "remote", url: "https://mcp.figma.com/mcp" })] })).not.toContain("mcp-sign-in-figma");expect(MCP_BLOCKED_HINTS.secret_missing).toContain("environment");});++ test("a missing MCP filter: one clear warning (no MCP server starts), enabled or not", () => {+ const warning = "The MCP filter did not load, so no MCP servers start in this app (none run unfiltered).";+ expect(render({ policy: policy({ filterMissing: warning }) })).toContain("mcp-filter-missing");+ expect(render({ policy: policy({ enabled: false, mode: "disabled", filterMissing: warning }) })).toContain(warning);+ expect(render()).not.toContain("mcp-filter-missing");+ });});diff --git a/apps/server/src/mcp-allow/PARITY.sha256 b/apps/server/src/mcp-allow/PARITY.sha256index a397ebc2..34f1cbe7 100644--- a/apps/server/src/mcp-allow/PARITY.sha256+++ b/apps/server/src/mcp-allow/PARITY.sha256@@ -1,4 +1,4 @@# The MCP allowlist module: the same files in omnirush-cli (src/mcp/) and omnirush-gui (apps/server/src/mcp-allow/).# A change to one must be ported to the other and this list updated in both.-382deaf703ca07b9c83444311b24e642599c49e840780fd09d9cefaf222257f6 mcp-allow.mjs-482fb25ea7dba6dc91aeeb24891e0b2e94d4abe8ff585b0068eb2a7575e75491 mcp-allow.d.mts+0626335ae120a2f35558fde1b743e68ad603d9b812d297c8a29e01ce3e8534bd mcp-allow.mjs+a6ebbd91aac94482fd933ff835a2629c63350bb380197de567998b75ab5d4d08 mcp-allow.d.mtsdiff --git a/apps/server/src/mcp-allow/mcp-allow.d.mts b/apps/server/src/mcp-allow/mcp-allow.d.mtsindex 035297f4..e4cbe31a 100644--- a/apps/server/src/mcp-allow/mcp-allow.d.mts+++ b/apps/server/src/mcp-allow/mcp-allow.d.mts@@ -103,6 +103,7 @@ export function splitSpec(spec: string, runtime: McpRuntime): { name: string; veexport function parseLaunch(command: unknown): McpLaunch | null;export function launchCommand(entry: McpAllowEntry, launch: McpLaunch, version: string, npmPrefix: string): string[];export function windowsDirect(found: string, platform?: string, exists?: (file: string) => boolean): string[] | null;+export const MCP_FILTERED_MARK: unique symbol;export function normalizeRemoteUrl(value: unknown): string | null;export function resolveRunner(runner: string, options?: { root?: string | null; platform?: string; env?: Record<string, string | undefined>; exists?: (file: string) => boolean; home?: string; accept?: ((file: string) => boolean) | null }): string | null;export function projectCodeIgnored(cfg: unknown): McpIgnored[];diff --git a/apps/server/src/mcp-allow/mcp-allow.mjs b/apps/server/src/mcp-allow/mcp-allow.mjsindex 42c60c7d..aa554697 100644--- a/apps/server/src/mcp-allow/mcp-allow.mjs+++ b/apps/server/src/mcp-allow/mcp-allow.mjs@@ -859,6 +859,20 @@ export function describeDecision(d) {return `MCP ${d.name}: blocked. ${d.reason}`;}+/**+ * The mark the engine looks for (OMNIRUSH_MCP_FILTER=required): this filter ran on its config. Without it the+ * engine starts no MCP server, so a missing or broken filter fails closed. Not enumerable: never in a config.+ */+export const MCP_FILTERED_MARK = Symbol.for("omnirush.mcp.filtered");++function markFiltered(...configs) {+ for (const config of configs) {+ if (isRecord(config)) {+ try { Object.defineProperty(config, MCP_FILTERED_MARK, { value: true, enumerable: false, configurable: true }); } catch { /* frozen */ }+ }+ }+}+function configTarget(input, output) {if (isRecord(output) && (Object.hasOwn(output, "mcp") || !isRecord(input))) return output;return isRecord(input) ? input : isRecord(output) ? output : null;@@ -910,12 +924,14 @@ export function createMcpPolicyHooks(options = {}) {config: async (input, output) => {try {apply(input, output);+ markFiltered(input, output);} catch {// Never leave the engine's own list in place: no servers at all.const target = configTarget(input, output);if (target) target.mcp = {};state.localOnly = [];state.pathInputs = [];+ markFiltered(input, output);}},"tool.execute.before": async (input, output) => {diff --git a/apps/server/src/mcp-allow/state.test.ts b/apps/server/src/mcp-allow/state.test.tsindex 724c7fd5..f39bf140 100644--- a/apps/server/src/mcp-allow/state.test.ts+++ b/apps/server/src/mcp-allow/state.test.ts@@ -9,6 +9,7 @@ import { describeIgnored, readPolicyFile } from "./mcp-allow.mjs";import {decideMcpEntry,mcpEngineEnv,+ mcpFilterMissing,mcpPolicyEnabled,mcpServersInUse,readWorkspaceMcp,@@ -56,6 +57,8 @@ describe("the remembered MCP list", () => {test("the engine never takes plugins or commands from a project's config, unless the app itself says so", () => {const state = temp("mcp-state-");expect(mcpEngineEnv(state, {}).OMNIRUSH_PROJECT_CODE).toBe("0");+ // The engine starts no MCP server unless the plugin marked its config (a missing plugin fails closed).+ expect(mcpEngineEnv(state, {}).OMNIRUSH_MCP_FILTER).toBe("required");expect(mcpEngineEnv(state, { OMNIRUSH_PROJECT_CODE: "true" }).OMNIRUSH_PROJECT_CODE).toBe("0");expect(mcpEngineEnv(state, { OMNIRUSH_PROJECT_CODE: "1" }).OMNIRUSH_PROJECT_CODE).toBe("1");});@@ -201,5 +204,17 @@ describe("the engine plugin (omnirush-mcp-policy)", () => {const reports = mcpEngineEnv(state).OMNIRUSH_MCP_REPORT_DIR;expect(readFileSync(path.join(reports, readdirSync(reports)[0] ?? ""), "utf8")).toContain("playwright");});-});+ test("a missing or empty MCP plugin file is reported (the engine then starts no MCP server)", () => {+ const dir = mkdtempSync(path.join(tmpdir(), "mcp-filter-"));+ try {+ expect(mcpFilterMissing(path.join(dir, "omnirush-mcp-policy.js"))).toBe(true);+ writeFileSync(path.join(dir, "empty.js"), "");+ expect(mcpFilterMissing(path.join(dir, "empty.js"))).toBe(true);+ writeFileSync(path.join(dir, "ok.js"), "export default {}");+ expect(mcpFilterMissing(path.join(dir, "ok.js"))).toBe(false);+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ });+});diff --git a/apps/server/src/mcp-allow/state.ts b/apps/server/src/mcp-allow/state.tsindex ff975c61..10d73665 100644--- a/apps/server/src/mcp-allow/state.ts+++ b/apps/server/src/mcp-allow/state.ts@@ -6,7 +6,7 @@//// The engine gets the three paths in its environment; its plugin// (opencode-plugins/omnirush-mcp-policy.ts) reads them at each project's start.-import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";+import { mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";import path from "node:path";import {@@ -50,9 +50,24 @@ export function mcpEngineEnv(stateDir: string, env: Record<string, string | undeOMNIRUSH_MCP_REPORT_DIR: mcpReportDir(stateDir),OMNIRUSH_MCP_WORKSPACE_DIR: mcpWorkspaceDir(stateDir),OMNIRUSH_PROJECT_CODE: env.OMNIRUSH_PROJECT_CODE?.trim() === "1" ? "1" : "0",+ // The engine starts no MCP server unless the MCP plugin marked its config: a missing or broken plugin+ // fails closed (engine 1.18.32-ux3-cmd8 and later).+ OMNIRUSH_MCP_FILTER: "required",};}+export const MCP_FILTER_MISSING =+ "The MCP filter did not load, so no MCP servers start in this app (none run unfiltered). Reinstall OmniRush.ai if this keeps happening.";++/** Whether the MCP plugin file the engine loads is missing or cannot be read (then the engine starts no MCP server). */+export function mcpFilterMissing(pluginPath: string): boolean {+ try {+ return !statSync(pluginPath).isFile() || readFileSync(pluginPath, "utf8").length === 0;+ } catch {+ return true;+ }+}+/** The policy as last seen; null: MCP off (never seen, or unreadable). */export function currentMcpPolicy(stateDir: string): McpPolicy | null {return readPolicyFile(mcpPolicyFile(stateDir));diff --git a/apps/server/src/server.ts b/apps/server/src/server.tsindex 441accd7..bd5f4b5a 100644--- a/apps/server/src/server.ts+++ b/apps/server/src/server.ts@@ -185,7 +185,8 @@ import { rememberWebSearchSwitch, watchWebSearchSwitch } from "./web-search.js";import { normalizeBackend } from "./box/backends/index.js";import { buildOmniRushRuntimeConfigObject, omnirushGatewayConfigured, omnirushRuntimeConfigFilePath, writeOmniRushRuntimeConfigFile } from "./omnirush-runtime-config.js";import { assertMcpAllowed, mcpAllowed, mcpDisabledMessage, mcpPolicyForConfig, refuseAccountLinkedMcp } from "./mcp-policy.js";-import { currentMcpPolicy, rememberMcpPolicy, watchMcpPolicy, workspaceMcpReport, writeWorkspaceMcp } from "./mcp-allow/state.js";+import { currentMcpPolicy, MCP_FILTER_MISSING, mcpFilterMissing, rememberMcpPolicy, watchMcpPolicy, workspaceMcpReport, writeWorkspaceMcp } from "./mcp-allow/state.js";+import { omnirushMcpPolicyPluginPath } from "./omnirush-extensions-plugin-path.js";import { isOmniRushUiMcpRegistryEntry } from "./omnirush-ui-mcp-command.js";import { describeIgnored, type McpAllowEntry } from "./mcp-allow/mcp-allow.mjs";import { omnirushModelWantsReasoningSummary, readOmniRushModelCatalog } from "./omnirush-model-catalog.js";@@ -5145,6 +5146,8 @@ function createRoutes(// What of the project's own config the engine left out (plugins, language server and formatter commands).ignored: report?.ignored ?? [],ignoredNotice: describeIgnored(report?.ignored),+ // The engine's MCP plugin is missing: no MCP server starts (OMNIRUSH_MCP_FILTER=required).+ filterMissing: mcpFilterMissing(omnirushMcpPolicyPluginPath()) ? MCP_FILTER_MISSING : null,},});});