Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: remove MCP Harbor opt-in

OmniRush Review626bf3209c62
diff --git a/apps/app/src/react-app/domains/connections/store.ts b/apps/app/src/react-app/domains/connections/store.ts
index 397a7b7f..2eac0d9d 100644
--- a/apps/app/src/react-app/domains/connections/store.ts
+++ b/apps/app/src/react-app/domains/connections/store.ts
@@ -78,7 +78,7 @@ const OMNIRUSH_UI_MCP_UNAVAILABLE = "UI control requires the omnirush.ai desktop
const COMPUTER_USE_HELPER_UNAVAILABLE = "Computer Use helper app is unavailable. Restart omnirush.ai or reinstall the app.";
const COMPUTER_USE_CONNECT_TIMEOUT_MS = 15_000;
const COMPUTER_USE_RECONNECT_COOLDOWN_MS = 30_000;
-const MCP_DISABLED_BY_POLICY = "MCP servers are disabled in OmniRush.ai. Run the isolated Docker Harbor task to reproduce MCP behavior.";
+const MCP_DISABLED_BY_POLICY = "MCP servers are disabled in OmniRush.ai.";
async function withLocalOmniRushServerRecoveryTimeout<T>(
task: Promise<T>,
@@ -268,8 +268,7 @@ export function createConnectionsStore(options: {
const mcpDisabledByPolicy = () => {
const current = getOmniRushSnapshot();
- // A GUI without an OmniRush policy-bearing server must fail closed. The
- // Harbor exception is server-side only and is never exposed to the app.
+ // A GUI without an OmniRush policy-bearing server must fail closed.
return current.omnirushServerStatus !== "connected"
|| current.omnirushServerCapabilities?.mcp?.read !== true;
};
diff --git a/apps/app/src/react-app/domains/session/surface/session-surface.tsx b/apps/app/src/react-app/domains/session/surface/session-surface.tsx
index 44752619..4df3abb3 100644
--- a/apps/app/src/react-app/domains/session/surface/session-surface.tsx
+++ b/apps/app/src/react-app/domains/session/surface/session-surface.tsx
@@ -571,7 +571,7 @@ function createImageLightboxEvalMessages(sessionId: string): UIMessage[] {
}
export type SessionSurfaceProps = {
- /** OmniRush GUI has no MCP capability; isolated Harbor tasks do not use this surface. */
+ /** OmniRush GUI has no MCP capability. */
mcpDisabled?: boolean;
client: OmniRushServerClient;
environmentClient?: OmniRushServerClient | null;
diff --git a/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx b/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx
index 3b6f2bd7..1d1e5ac8 100644
--- a/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx
+++ b/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx
@@ -1408,7 +1408,7 @@ export function McpView(props: McpViewProps) {
{mcpDisabled ? (
<div data-testid="mcp-disabled-policy-notice" className="mb-5 rounded-xl border border-dls-border bg-dls-hover px-4 py-4 text-xs leading-5 text-dls-secondary">
<p className="text-sm font-medium text-foreground">MCP servers are disabled</p>
- <p className="mt-1">OmniRush.ai does not allow MCP servers in the GUI or CLI. MCP behavior can only be reproduced inside an isolated Docker Harbor task.</p>
+ <p className="mt-1">MCP servers cannot be enabled in OmniRush.ai.</p>
</div>
) : null}
{props.builtInExtensionsDisabled && props.allowManageExtensions ? (
diff --git a/apps/server/src/cli.ts b/apps/server/src/cli.ts
index d5eb5cf3..fa040d85 100644
--- a/apps/server/src/cli.ts
+++ b/apps/server/src/cli.ts
@@ -91,13 +91,7 @@ if (!config.opencodeBaseUrl && process.env.OMNIRUSH_MANAGE_OPENCODE === "1") {
OMNIRUSH_SERVER_URL: serverUrl,
OMNIRUSH_SERVER_TOKEN: config.token,
OMNIRUSH_POLICY_TOKEN: managedDesktopPolicy(config).evaluationToken,
- OMNIRUSH_MCP_POLICY: config.mcpPolicy ?? "disabled",
- ...(config.mcpPolicy === "harbor-local" && process.env.OMNIRUSH_HARBOR_TASK_ID?.trim()
- ? { OMNIRUSH_HARBOR_TASK_ID: process.env.OMNIRUSH_HARBOR_TASK_ID }
- : {}),
- ...(config.mcpPolicy === "harbor-local" && process.env.OMNIRUSH_SANDBOX_BACKEND?.trim()
- ? { OMNIRUSH_SANDBOX_BACKEND: process.env.OMNIRUSH_SANDBOX_BACKEND }
- : {}),
+ OMNIRUSH_MCP_POLICY: "disabled",
OPENCODE_CONFIG: runtimeConfigPath,
...opencodeModelsEnv,
};
diff --git a/apps/server/src/embedded.ts b/apps/server/src/embedded.ts
index a96b574d..3009250a 100644
--- a/apps/server/src/embedded.ts
+++ b/apps/server/src/embedded.ts
@@ -258,13 +258,7 @@ export async function startEmbeddedServer(options: EmbeddedServerOptions): Promi
OMNIRUSH_SERVER_URL: serverUrl,
OMNIRUSH_SERVER_TOKEN: config.token,
OMNIRUSH_POLICY_TOKEN: managedDesktopPolicy(config).evaluationToken,
- OMNIRUSH_MCP_POLICY: config.mcpPolicy ?? "disabled",
- ...(config.mcpPolicy === "harbor-local" && process.env.OMNIRUSH_HARBOR_TASK_ID?.trim()
- ? { OMNIRUSH_HARBOR_TASK_ID: process.env.OMNIRUSH_HARBOR_TASK_ID }
- : {}),
- ...(config.mcpPolicy === "harbor-local" && process.env.OMNIRUSH_SANDBOX_BACKEND?.trim()
- ? { OMNIRUSH_SANDBOX_BACKEND: process.env.OMNIRUSH_SANDBOX_BACKEND }
- : {}),
+ OMNIRUSH_MCP_POLICY: "disabled",
OPENCODE_CONFIG: runtimeConfigPath,
...opencodeModelsEnv,
};
diff --git a/apps/server/src/engine2/config.test.ts b/apps/server/src/engine2/config.test.ts
index 8e0a09da..9a222025 100644
--- a/apps/server/src/engine2/config.test.ts
+++ b/apps/server/src/engine2/config.test.ts
@@ -115,18 +115,13 @@ describe("the 1.x runtime config as the 2.x engine config", () => {
});
});
- test("MCP servers keep direct tools (no code mode)", () => {
- expect(config.mcp).toEqual({
- servers: {
- "omnirush-cloud": { type: "remote", url: "https://mcp.example/mcp", headers: { authorization: "Bearer x" }, disabled: false, codemode: false },
- local: { type: "local", command: ["node", "server.js"], environment: { A: "1" }, disabled: true, timeout: { catalog: 5000, execution: 5000 }, codemode: false },
- },
- });
+ test("MCP servers are never copied into the managed config", () => {
+ expect(config.mcp).toBeUndefined();
expect(v2Mcp({ type: "remote", url: "https://x", oauth: { clientId: "c" } })).toEqual({ type: "remote", url: "https://x", oauth: { client_id: "c" }, codemode: false });
});
test("disabled policy never renders MCP servers", () => {
- expect(buildEngine2Config({ v1: runtime, mcpAllowed: false }).mcp).toBeUndefined();
+ expect(buildEngine2Config({ v1: runtime }).mcp).toBeUndefined();
});
test("packages and permission names", () => {
diff --git a/apps/server/src/engine2/config.ts b/apps/server/src/engine2/config.ts
index a5a9ecab..3f6c803f 100644
--- a/apps/server/src/engine2/config.ts
+++ b/apps/server/src/engine2/config.ts
@@ -21,8 +21,6 @@ export type EngineConfigInput = {
apiKeys?: Record<string, string>;
/** Plugin directories the engine loads (OmniRush.ai's plugin bridge). */
plugins?: string[];
- /** Whether MCP servers may be rendered into the 2.x config. */
- mcpAllowed?: boolean;
};
/** 1.x tool / permission names in 2.x (core/src/v1/config/migrate.ts normalizeAction). */
@@ -258,13 +256,8 @@ export function buildEngine2Config(input: EngineConfigInput): JsonRecord {
}
const small = modelSelection(v1.small_model);
if (small) agents.title = { model: small, ...(isRecord(agents.title) ? agents.title : {}) };
+ // MCP is intentionally never copied into the managed engine config.
const servers: JsonRecord = {};
- if (input.mcpAllowed !== false && isRecord(v1.mcp)) {
- for (const [name, server] of Object.entries(v1.mcp)) {
- const mapped = v2Mcp(server);
- if (mapped) servers[name] = mapped;
- }
- }
const policies = [
...(Array.isArray(v1.enabled_providers)
? [
diff --git a/apps/server/src/engine2/facade.ts b/apps/server/src/engine2/facade.ts
index be43eceb..a6395e9f 100644
--- a/apps/server/src/engine2/facade.ts
+++ b/apps/server/src/engine2/facade.ts
@@ -59,7 +59,6 @@ export type EngineFacadeOptions = {
/** Plugin directories the rendered config names (OmniRush.ai's plugin bridge). */
plugins?: string[];
/** Whether MCP servers may be rendered into the 2.x config. */
- mcpAllowed?: boolean;
/** Engine state paths reported by `/path`. */
paths?: { state?: string; config?: string };
log?: (message: string, attributes?: Record<string, unknown>) => void;
@@ -264,7 +263,7 @@ export async function startEngineFacade(options: EngineFacadeOptions): Promise<E
let v1ConfigCache: JsonRecord = await readV1Config();
const refreshConfig = async (): Promise<void> => {
v1ConfigCache = await readV1Config();
- if (options.writeEngineConfig) await options.writeEngineConfig(buildEngine2Config({ v1: v1ConfigCache, apiKeys, plugins: options.plugins, mcpAllowed: options.mcpAllowed }));
+ if (options.writeEngineConfig) await options.writeEngineConfig(buildEngine2Config({ v1: v1ConfigCache, apiKeys, plugins: options.plugins }));
};
// ---- location reloads ---------------------------------------------------
diff --git a/apps/server/src/engine2/launch.ts b/apps/server/src/engine2/launch.ts
index a0da840e..e4b8b27f 100644
--- a/apps/server/src/engine2/launch.ts
+++ b/apps/server/src/engine2/launch.ts
@@ -168,10 +168,7 @@ export async function prepareEngine2Launch(input: {
v1 = {};
}
}
- const mcpAllowed = input.env.OMNIRUSH_MCP_POLICY?.trim().toLowerCase() === "harbor-local"
- && Boolean(input.env.OMNIRUSH_HARBOR_TASK_ID?.trim())
- && input.env.OMNIRUSH_SANDBOX_BACKEND?.trim().toLowerCase() === "docker";
- await writeEngineConfig(buildEngine2Config({ v1, plugins, mcpAllowed }));
+ await writeEngineConfig(buildEngine2Config({ v1, plugins }));
const env: NodeJS.ProcessEnv = { ...input.env };
delete env.OPENCODE_CONFIG_CONTENT;
env.OPENCODE_CONFIG = configFile;
diff --git a/apps/server/src/managed-opencode.ts b/apps/server/src/managed-opencode.ts
index 7c11ee32..e38e4269 100644
--- a/apps/server/src/managed-opencode.ts
+++ b/apps/server/src/managed-opencode.ts
@@ -255,9 +255,6 @@ async function startManagedEngine2Server(
v1ConfigPath: launch.v1ConfigPath,
writeEngineConfig: launch.writeEngineConfig,
plugins: launch.plugins,
- mcpAllowed: launch.env.OMNIRUSH_MCP_POLICY?.trim().toLowerCase() === "harbor-local"
- && Boolean(launch.env.OMNIRUSH_HARBOR_TASK_ID?.trim())
- && launch.env.OMNIRUSH_SANDBOX_BACKEND?.trim().toLowerCase() === "docker",
log: (message, attributes) => console.warn(`[engine-adapter] ${message}`, attributes ? JSON.stringify(attributes) : ""),
});
} catch (error) {
diff --git a/apps/server/src/mcp-policy.test.ts b/apps/server/src/mcp-policy.test.ts
index dee8c68f..b4f5009d 100644
--- a/apps/server/src/mcp-policy.test.ts
+++ b/apps/server/src/mcp-policy.test.ts
@@ -10,30 +10,14 @@ import {
describe("MCP execution policy", () => {
test("normal server environments deny MCP", () => {
expect(resolveMcpPolicyFromEnvironment({})).toBe("disabled");
- });
-
- test("only a marked Docker Harbor task may opt in", () => {
- expect(resolveMcpPolicyFromEnvironment({
- OMNIRUSH_MCP_POLICY: "harbor-local",
- OMNIRUSH_HARBOR_TASK_ID: "task-123",
- OMNIRUSH_SANDBOX_BACKEND: "docker",
- })).toBe("harbor-local");
expect(resolveMcpPolicyFromEnvironment({
- OMNIRUSH_MCP_POLICY: "harbor-local",
- OMNIRUSH_HARBOR_TASK_ID: "task-123",
- OMNIRUSH_SANDBOX_BACKEND: "none",
- })).toBe("disabled");
- expect(resolveMcpPolicyFromEnvironment({
- OMNIRUSH_MCP_POLICY: "harbor-local",
- OMNIRUSH_SANDBOX_BACKEND: "docker",
+ OMNIRUSH_MCP_POLICY: "enabled",
})).toBe("disabled");
});
- test("rejects a disabled server and preserves old direct test embedders", () => {
- expect(mcpPolicyForConfig({})).toBe("enabled");
+ test("rejects disabled servers and ignores legacy re-enable values", () => {
+ expect(mcpPolicyForConfig({})).toBe("disabled");
expect(mcpAllowed({ mcpPolicy: "disabled" })).toBe(false);
expect(() => assertMcpAllowed({ mcpPolicy: "disabled" })).toThrow(ApiError);
- expect(() => assertMcpAllowed({ mcpPolicy: "harbor-local" })).not.toThrow();
});
});
-
diff --git a/apps/server/src/mcp-policy.ts b/apps/server/src/mcp-policy.ts
index a65838b1..a08e4444 100644
--- a/apps/server/src/mcp-policy.ts
+++ b/apps/server/src/mcp-policy.ts
@@ -1,33 +1,26 @@
import { ApiError } from "./errors.js";
import type { ServerConfig } from "./types.js";
-/** MCP is deny-only in normal OmniRush.ai processes. */
-export type McpPolicyMode = "disabled" | "harbor-local" | "enabled";
+/** MCP is disabled for every OmniRush.ai process. */
+export type McpPolicyMode = "disabled";
export const MCP_DISABLED_MESSAGE =
- "MCP servers are disabled in OmniRush.ai. Run the isolated Docker Harbor task to reproduce MCP behavior.";
+ "MCP servers are disabled in OmniRush.ai.";
-export function resolveMcpPolicyFromEnvironment(env: NodeJS.ProcessEnv = process.env): McpPolicyMode {
- const requested = env.OMNIRUSH_MCP_POLICY?.trim().toLowerCase();
- if (
- requested === "harbor-local"
- && env.OMNIRUSH_HARBOR_TASK_ID?.trim()
- && env.OMNIRUSH_SANDBOX_BACKEND?.trim().toLowerCase() === "docker"
- ) return "harbor-local";
+export function resolveMcpPolicyFromEnvironment(_env: NodeJS.ProcessEnv = process.env): McpPolicyMode {
return "disabled";
}
-/** Older direct embedders/tests may omit the optional policy until migrated. */
-export function mcpPolicyForConfig(config: Pick<ServerConfig, "mcpPolicy">): McpPolicyMode {
- return config.mcpPolicy ?? "enabled";
+/** Legacy config values are ignored so an old persisted row cannot re-enable MCP. */
+export function mcpPolicyForConfig(_config: Pick<ServerConfig, "mcpPolicy">): McpPolicyMode {
+ return "disabled";
}
-export function mcpAllowed(config: Pick<ServerConfig, "mcpPolicy">): boolean {
- return mcpPolicyForConfig(config) !== "disabled";
+export function mcpAllowed(_config: Pick<ServerConfig, "mcpPolicy">): boolean {
+ return false;
}
export function assertMcpAllowed(config: Pick<ServerConfig, "mcpPolicy">): void {
if (mcpAllowed(config)) return;
throw new ApiError(403, "mcp_disabled", MCP_DISABLED_MESSAGE);
}
-
diff --git a/apps/server/src/mcp.ts b/apps/server/src/mcp.ts
index 4fd27162..c7365afb 100644
--- a/apps/server/src/mcp.ts
+++ b/apps/server/src/mcp.ts
@@ -6,7 +6,7 @@ import { readJsoncFile } from "./jsonc.js";
import { opencodeConfigPath } from "./workspace-files.js";
import { validateMcpConfig, validateMcpName, validateUserMcpName } from "./validators.js";
import { ApiError } from "./errors.js";
-import { assertMcpAllowed } from "./mcp-policy.js";
+import { assertMcpAllowed, mcpAllowed } from "./mcp-policy.js";
import { isOmniRushUiMcpRegistryEntry, OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE } from "./omnirush-ui-mcp-command.js";
import {
readRuntimeOpencodeConfig,
@@ -478,7 +478,7 @@ function isMcpDisabledByTools(config: Record<string, unknown>, name: string): bo
}
export async function listMcp(serverConfig: ServerConfig, workspaceId: string, workspaceRoot: string): Promise<McpItem[]> {
- if (serverConfig.mcpPolicy === "disabled") return [];
+ if (!mcpAllowed(serverConfig)) return [];
return listMcpFromRuntimeSnapshot(workspaceRoot, await readRuntimeOpencodeConfig(serverConfig, workspaceId));
}
diff --git a/apps/server/src/omnirush-runtime-config.ts b/apps/server/src/omnirush-runtime-config.ts
index 62912aca..86c73807 100644
--- a/apps/server/src/omnirush-runtime-config.ts
+++ b/apps/server/src/omnirush-runtime-config.ts
@@ -141,7 +141,7 @@ export async function buildOmniRushRuntimeConfigObject(
internalGateway && config ? await readOmniRushModelCatalog(config) : undefined,
config ? omnirushRuntimeSkillsDir(config) : undefined,
config ? omnirushBestPracticesSkillsDir(config) : undefined,
- config ? mcpPolicyForConfig(config) : "enabled",
+ config ? mcpPolicyForConfig(config) : "disabled",
);
}
@@ -171,7 +171,7 @@ export function buildOmniRushRuntimeConfigObjectFromSnapshot(
catalog: OmniRushModelCatalog = builtinOmniRushModelCatalog(),
skillsDir?: string,
bestPracticesDir?: string,
- mcpPolicy: McpPolicyMode = "enabled",
+ mcpPolicy: McpPolicyMode = "disabled",
): Record<string, unknown> {
const disabledProviders = runtimeDisabledProviderList(runtimeConfig);
// OMNIRUSH_APPROVALS in the server environment wins over the persisted setting.
diff --git a/apps/server/src/opencode-plugins/omnirush-mcp-policy.ts b/apps/server/src/opencode-plugins/omnirush-mcp-policy.ts
index 13ce73c6..c6a1b3b0 100644
--- a/apps/server/src/opencode-plugins/omnirush-mcp-policy.ts
+++ b/apps/server/src/opencode-plugins/omnirush-mcp-policy.ts
@@ -2,17 +2,9 @@
* Engine-side MCP fence. The HTTP/UI checks are useful for normal clients,
* but an OpenCode config can also come from a workspace file or a direct
* engine request. This hook removes those servers before the model sees
- * them, unless the server process explicitly belongs to an isolated Harbor
- * Docker task.
+ * them for every server process, including locally configured engines.
*/
-function harborMcpTask(): boolean {
- return process.env.OMNIRUSH_MCP_POLICY?.trim().toLowerCase() === "harbor-local"
- && Boolean(process.env.OMNIRUSH_HARBOR_TASK_ID?.trim())
- && process.env.OMNIRUSH_SANDBOX_BACKEND?.trim().toLowerCase() === "docker";
-}
-
export default async function omnirushMcpPolicy() {
- if (harborMcpTask()) return {};
return {
// OpenCode 1.x has shipped both config(config) and config(input, output)
// hook shapes; accept either so the fence survives engine upgrades.
diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts
index 76865dbe..9981200f 100644
--- a/apps/server/src/server.ts
+++ b/apps/server/src/server.ts
@@ -5891,9 +5891,8 @@ async function syncRuntimeMcpToOpencodeEngine(
serverState?: EngineMcpServerState | null,
): Promise<EngineMcpSyncResult> {
if (!mcpAllowed(config)) {
- // Existing runtime rows are retained for the isolated Harbor workflow,
- // but they must not remain live in an engine that has switched to the
- // normal deny policy.
+ // Existing runtime rows are retained for auditability, but must not remain
+ // live in an engine under the deny policy.
const runtimeConfig = await readEffectiveRuntimeOpencodeConfig(config, workspace.id).catch(() => undefined);
const names = Object.keys(runtimeConfig ? runtimeMcpMap(runtimeConfig) : {})
.filter((name) => !onlyNames || onlyNames.includes(name));
diff --git a/apps/server/src/types.ts b/apps/server/src/types.ts
index cd14e0de..76361da7 100644
--- a/apps/server/src/types.ts
+++ b/apps/server/src/types.ts
@@ -14,7 +14,7 @@ export type ProviderPlacement = "in-sandbox" | "host-machine" | "client-machine"
export type LogFormat = "pretty" | "json";
-export type McpPolicyMode = "disabled" | "harbor-local" | "enabled";
+export type McpPolicyMode = "disabled";
export interface WorkspaceConfig {
id?: string;