Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

feat: MCP settings states

Samrat Talukdarf2e201493a40
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.ts
index bc54c41f..2128ea4c 100644
--- a/apps/app/src/app/lib/omnirush-server.ts
+++ b/apps/app/src/app/lib/omnirush-server.ts
@@ -610,6 +610,49 @@ export type OmniRushMcpItem = {
source: "config.project" | "config.global" | "config.remote";
disabledByTools?: boolean;
managedOAuth?: OmniRushManagedMcpConnection | null;
+ /** The engine plugin's decision for this entry (null until the project's engine read it). */
+ decision?: OmniRushMcpDecision | null;
+};
+
+/** What the engine's MCP plugin decided for one configured server (the server's list). */
+export type OmniRushMcpDecision = {
+ name: string;
+ status: "allowed" | "blocked";
+ code: string;
+ reason?: string;
+ id?: string;
+ package?: string;
+ runtime?: "npm" | "pypi";
+ title?: string;
+ version?: string;
+ sandbox?: boolean;
+ renamed_to?: string;
+ notes?: string[];
+};
+
+/** A server the list supports, as a one-click preset. */
+export type OmniRushMcpPreset = {
+ id: string;
+ title: string;
+ why: string | null;
+ runtime: "npm" | "pypi";
+ package: string;
+ version: string | null;
+ versions: string;
+ command: string[];
+ localPagesOnly: boolean;
+};
+
+/** The MCP list as the desktop last saw it (GET /workspace/:id/mcp). */
+export type OmniRushMcpPolicyView = {
+ mode: "allowlist" | "disabled";
+ enabled: boolean;
+ message: string | null;
+ /** The preview engine routes chats: MCP stays off there. */
+ engineV2?: boolean;
+ supported: OmniRushMcpPreset[];
+ decisions: OmniRushMcpDecision[];
+ reportAt: number | null;
};
export type OmniRushMcpAppResource = {
@@ -2283,6 +2326,7 @@ export function createOmniRushServerClient(options: { baseUrl: string; token?: s
items: OmniRushMcpItem[];
engineSync?: OmniRushMcpEngineSync | null;
managedOAuthState?: OmniRushManagedOAuthState | null;
+ mcpPolicy?: OmniRushMcpPolicyView | null;
}>(
baseUrl,
`/workspace/${workspaceId}/mcp`,
diff --git a/apps/app/src/react-app/domains/connections/store.ts b/apps/app/src/react-app/domains/connections/store.ts
index 2eac0d9d..6dc52329 100644
--- a/apps/app/src/react-app/domains/connections/store.ts
+++ b/apps/app/src/react-app/domains/connections/store.ts
@@ -35,6 +35,7 @@ import {
} from "../../../app/mcp";
import {
buildOmniRushWorkspaceBaseUrl,
+ type OmniRushMcpPolicyView,
type OmniRushServerClient,
} from "../../../app/lib/omnirush-server";
import type {
@@ -78,7 +79,9 @@ 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.";
+const MCP_DISABLED_BY_POLICY = "MCP servers are turned off for this account.";
+/** Connect and other account-linked MCP services: never run here (a session could not be repeated). */
+const ACCOUNT_LINKED_MCP_OFF: boolean = true;
async function withLocalOmniRushServerRecoveryTimeout<T>(
task: Promise<T>,
@@ -135,6 +138,8 @@ export type ConnectionsStoreSnapshot = {
mcpAuthNeedsReload: boolean;
/** False when the server reports managed OAuth secure storage is unavailable. */
managedOAuthAvailable: boolean;
+ /** The server's MCP list for this project: supported servers and each configured one's decision. */
+ mcpPolicy: OmniRushMcpPolicyView | null;
};
type MutableState = ConnectionsStoreSnapshot;
@@ -184,6 +189,7 @@ export function createConnectionsStore(options: {
mcpAuthEntry: null,
mcpAuthNeedsReload: false,
managedOAuthAvailable: true,
+ mcpPolicy: null,
};
const emitChange = () => {
@@ -202,6 +208,7 @@ export function createConnectionsStore(options: {
mcpAuthEntry: state.mcpAuthEntry,
mcpAuthNeedsReload: state.mcpAuthNeedsReload,
managedOAuthAvailable: state.managedOAuthAvailable,
+ mcpPolicy: state.mcpPolicy,
};
};
@@ -273,6 +280,15 @@ export function createConnectionsStore(options: {
|| current.omnirushServerCapabilities?.mcp?.read !== true;
};
+ // Adding or turning on a server needs the server's list to be on (the
+ // server checks each server against it again).
+ const mcpWritesDisabledByPolicy = () => {
+ if (mcpDisabledByPolicy()) return true;
+ if (state.mcpPolicy) return !state.mcpPolicy.enabled;
+ return getOmniRushSnapshot().omnirushServerCapabilities?.mcp?.write !== true;
+ };
+ const mcpPolicyMessage = () => state.mcpPolicy?.message?.trim() || MCP_DISABLED_BY_POLICY;
+
const resolveOmniRushWorkspaceId = async () => {
const current = options.runtimeWorkspaceId()?.trim();
if (current) return current;
@@ -517,6 +533,7 @@ export function createConnectionsStore(options: {
observedStatuses,
engineSync,
managedOAuthAvailable: response.managedOAuthState?.available ?? true,
+ mcpPolicy: response.mcpPolicy ?? null,
};
};
@@ -649,6 +666,7 @@ export function createConnectionsStore(options: {
mcpLastUpdatedAt: Date.now(),
mcpStatuses: projectedStatuses,
managedOAuthAvailable: serverResult.managedOAuthAvailable,
+ mcpPolicy: serverResult.mcpPolicy,
mcpStatus: failedNames
? `Some MCPs could not be registered with the engine: ${failedNames}. They may appear disconnected — try reloading the engine.`
: serverResult.next.length ? null : "No MCP servers configured yet.",
@@ -797,9 +815,10 @@ export function createConnectionsStore(options: {
}
function mcpMutationDenied(builtIn: boolean) {
- if (mcpDisabledByPolicy()) {
- setStateField("mcpStatus", MCP_DISABLED_BY_POLICY);
- return MCP_DISABLED_BY_POLICY;
+ if (mcpWritesDisabledByPolicy()) {
+ const message = mcpPolicyMessage();
+ setStateField("mcpStatus", message);
+ return message;
}
const restriction = builtIn ? "allowBuiltInExtensions" : "allowManageExtensions";
if (!options.checkDesktopAppRestriction({ restriction })) return null;
@@ -1214,8 +1233,8 @@ export function createConnectionsStore(options: {
* waiting for the marker to expire.
*/
async function syncCloudControlMcp(options?: { force?: boolean }): Promise<"synced" | "unchanged" | "skipped"> {
- if (mcpDisabledByPolicy()) {
- setStateField("mcpStatus", MCP_DISABLED_BY_POLICY);
+ // The account-linked Connect server is not run in this app (the server refuses it).
+ if (mcpDisabledByPolicy() || ACCOUNT_LINKED_MCP_OFF) {
return "skipped";
}
const settings = readDenSettings();
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 a22b354c..69dbdb67 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
@@ -2846,7 +2846,7 @@ export function SessionSurface(props: SessionSurfaceProps) {
const listMcp = useCallback(async (): Promise<{ servers: McpServerEntry[]; statuses: McpStatusMap; status: string | null }> => {
if (props.mcpDisabled === true) {
- const status = "MCP servers are disabled in OmniRush.ai.";
+ const status = "This project's MCP servers are listed in Settings > MCP.";
setToolMcpServers([]);
setToolMcpStatuses({});
setToolMcpStatus(status);
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.tsx
new file mode 100644
index 00000000..4f3a65ca
--- /dev/null
+++ b/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx
@@ -0,0 +1,166 @@
+/** @jsxImportSource react */
+// Settings > MCP: the servers the account's list supports (one-click
+// presets) and this project's configured servers with the engine plugin's
+// decision for each: on (its version, and whether it runs in the sandbox) or
+// blocked with the reason. Remote and account-linked services are not
+// supported: a session that used them could not be repeated.
+import { useState } from "react";
+import { Loader2, Plus } from "lucide-react";
+
+import type { OmniRushMcpDecision, OmniRushMcpPolicyView, OmniRushMcpPreset } from "../../../../app/lib/omnirush-server";
+import type { McpServerEntry } from "../../../../app/types";
+import { Button } from "@/components/ui/button";
+
+export const MCP_REMOTE_NOT_SUPPORTED =
+ "Remote services (Notion, Linear, GitHub, Slack and other sign-in connectors) are not supported: they answer from an outside account, so a session that used them could not be repeated.";
+
+export const MCP_ENGINE_V2_NOTE =
+ "MCP servers are off while the preview engine runs chats. Turn the preview engine off to use them.";
+
+export type McpServerState =
+ | { kind: "on"; detail: string }
+ | { kind: "blocked"; reason: string }
+ | { kind: "off" }
+ | { kind: "pending" };
+
+/** The line a configured server shows, from the plugin's decision. */
+export function mcpServerState(entry: Pick<McpServerEntry, "name" | "config">, decision: OmniRushMcpDecision | null | undefined): McpServerState {
+ if (!decision) return { kind: "pending" };
+ if (decision.status === "blocked") return { kind: "blocked", reason: decision.reason?.trim() || "This MCP server is not supported." };
+ if ((entry.config as { enabled?: unknown } | undefined)?.enabled === false) return { kind: "off" };
+ const parts = [
+ decision.package && decision.version ? `${decision.package}@${decision.version}` : null,
+ decision.sandbox ? "runs in the sandbox" : null,
+ decision.renamed_to && decision.renamed_to !== decision.name ? `tools named ${decision.renamed_to}_…` : null,
+ ].filter((part): part is string => Boolean(part));
+ return { kind: "on", detail: parts.join(" · ") };
+}
+
+/** The command a preset adds, as one line. */
+export function presetCommandLine(preset: Pick<OmniRushMcpPreset, "command">): string {
+ return preset.command.map((word) => (/^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replace(/'/g, "'\\''")}'`)).join(" ");
+}
+
+/** Whether a configured entry already starts the preset's package. */
+export function presetConfigured(preset: Pick<OmniRushMcpPreset, "id">, servers: Array<Pick<McpServerEntry, "name">>, decisions: OmniRushMcpDecision[]): boolean {
+ return servers.some((server) => server.name === preset.id)
+ || decisions.some((decision) => decision.status === "allowed" && decision.id === preset.id);
+}
+
+export function McpSupportedPanel(props: {
+ policy: OmniRushMcpPolicyView;
+ servers: McpServerEntry[];
+ canAdd: boolean;
+ busy: boolean;
+ addPreset: (preset: OmniRushMcpPreset) => Promise<{ ok: boolean; error?: string }>;
+ removeServer?: (name: string) => void;
+}) {
+ const [adding, setAdding] = useState<string | null>(null);
+ const [addError, setAddError] = useState<{ id: string; message: string } | null>(null);
+ const decisionFor = (name: string) => props.policy.decisions.find((decision) => decision.name === name) ?? null;
+
+ if (!props.policy.enabled) {
+ return (
+ <p data-testid="mcp-policy-off" className="mb-5 text-sm text-dls-secondary">
+ {props.policy.message?.trim() || "MCP servers are turned off for this account."}
+ </p>
+ );
+ }
+
+ const add = async (preset: OmniRushMcpPreset) => {
+ setAdding(preset.id);
+ setAddError(null);
+ try {
+ const result = await props.addPreset(preset);
+ if (!result.ok) setAddError({ id: preset.id, message: result.error ?? "Could not add this server." });
+ } finally {
+ setAdding(null);
+ }
+ };
+
+ return (
+ <div data-testid="mcp-supported-panel" className="mb-6 flex flex-col gap-5">
+ {props.policy.engineV2 ? (
+ <p data-testid="mcp-engine-v2-note" className="text-sm text-dls-secondary">{MCP_ENGINE_V2_NOTE}</p>
+ ) : null}
+
+ {props.servers.length > 0 ? (
+ <div className="flex flex-col gap-2">
+ <h3 className="text-sm font-medium text-foreground">This project's MCP servers</h3>
+ <ul className="flex flex-col divide-y divide-dls-border rounded-xl border border-dls-border">
+ {props.servers.map((server) => {
+ const state = mcpServerState(server, decisionFor(server.name));
+ return (
+ <li key={server.name} data-testid={`mcp-server-${server.name}`} className="flex items-start justify-between gap-3 px-4 py-3">
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-foreground">{server.name}</p>
+ {state.kind === "on" ? (
+ <p className="mt-0.5 text-xs text-dls-secondary">
+ <span className="font-medium text-green-11">On</span>
+ {state.detail ? ` · ${state.detail}` : null}
+ </p>
+ ) : state.kind === "blocked" ? (
+ <p className="mt-0.5 text-xs text-dls-secondary">
+ <span className="font-medium text-foreground">Blocked</span>{` · ${state.reason}`}
+ </p>
+ ) : state.kind === "off" ? (
+ <p className="mt-0.5 text-xs text-dls-secondary">Off</p>
+ ) : (
+ <p className="mt-0.5 text-xs text-dls-secondary">Checked when the project's next chat starts.</p>
+ )}
+ {server.source === "config.project" || server.source === "config.global" ? (
+ <p className="mt-0.5 text-xs text-dls-secondary">{server.source === "config.project" ? "From the project's opencode.json" : "From your global opencode config"}</p>
+ ) : null}
+ </div>
+ {props.removeServer && server.source === "config.remote" ? (
+ <Button variant="ghost" size="sm" disabled={props.busy} onClick={() => props.removeServer?.(server.name)}>
+ Remove
+ </Button>
+ ) : null}
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ ) : null}
+
+ {props.policy.supported.length > 0 ? (
+ <div className="flex flex-col gap-2">
+ <h3 className="text-sm font-medium text-foreground">Supported servers</h3>
+ <p className="text-xs text-dls-secondary">Local servers that work on this project's own files. Each runs a fixed version, inside the project's sandbox when it is on.</p>
+ <ul className="flex flex-col divide-y divide-dls-border rounded-xl border border-dls-border">
+ {props.policy.supported.map((preset) => {
+ const configured = presetConfigured(preset, props.servers, props.policy.decisions);
+ return (
+ <li key={preset.id} data-testid={`mcp-preset-${preset.id}`} className="flex items-start justify-between gap-3 px-4 py-3">
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-foreground">{preset.title}</p>
+ {preset.why ? <p className="mt-0.5 text-xs text-dls-secondary">{preset.why}</p> : null}
+ <code className="mt-1 block truncate rounded-md bg-dls-hover px-2 py-1 font-mono text-[11px] text-dls-secondary" title={presetCommandLine(preset)}>
+ {presetCommandLine(preset)}
+ </code>
+ <p className="mt-1 text-[11px] text-dls-secondary">
+ {preset.version ? `Runs ${preset.package}@${preset.version}` : preset.package}
+ {preset.localPagesOnly ? " · local pages only" : null}
+ </p>
+ {addError?.id === preset.id ? <p className="mt-1 text-xs text-red-11">{addError.message}</p> : null}
+ </div>
+ {configured ? (
+ <span className="shrink-0 pt-1 text-xs text-dls-secondary">Added</span>
+ ) : props.canAdd ? (
+ <Button variant="outline" size="sm" className="shrink-0" disabled={props.busy || adding !== null} onClick={() => void add(preset)}>
+ {adding === preset.id ? <Loader2 size={13} className="animate-spin" /> : <Plus size={13} />}
+ Add
+ </Button>
+ ) : null}
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ ) : null}
+
+ <p data-testid="mcp-remote-not-supported" className="text-xs text-dls-secondary">{MCP_REMOTE_NOT_SUPPORTED}</p>
+ </div>
+ );
+}
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 1d1e5ac8..5a82350b 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
@@ -78,6 +78,8 @@ import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { ConfirmModal } from "../../../design-system/modals/confirm-modal";
import { isConnectDirectMcpServerName } from "../../connections/cloud-mcp-user-state";
+import type { OmniRushMcpPolicyView, OmniRushMcpPreset } from "../../../../app/lib/omnirush-server";
+import { McpSupportedPanel } from "./mcp-supported-panel";
import { AddMcpModal } from "../../connections/modals/add-mcp-modal";
import type { McpConnectResult } from "../../connections/store";
import { ClaudePluginImportModal } from "../../connections/modals/claude-plugin-import-modal";
@@ -103,7 +105,6 @@ import {
type McpViewLocalState,
} from "./mcp-view-state";
import { useCloudSession } from "../cloud/cloud-session-provider";
-import { isConnectAdminRole } from "../connect-cloud-readiness";
import { useDenAuth } from "../../cloud/den-auth-provider";
import {
libraryAddAction,
@@ -175,6 +176,8 @@ export type McpViewProps = {
/** MCP capabilities assigned through omnirush.ai Connect. */
/** True when the connected OmniRush server has disabled MCP for this client. */
mcpDisabled?: boolean;
+ /** The server's MCP list for this project (supported servers, each configured one's decision). */
+ mcpPolicy?: OmniRushMcpPolicyView | null;
availableConnectMcpServers?: McpServerEntry[];
availableConnectMcpStatuses?: McpStatusMap;
/** Organization inventory is still being fetched and nothing is cached yet. */
@@ -533,20 +536,32 @@ export function McpView(props: McpViewProps) {
const setTogglingMcp = (value: SetStateAction<string | null>) => setLocal("togglingMcp", value);
const configRequestId = useRef(0);
- const mcpDisabled = props.mcpDisabled === true;
+ const mcpPolicy = props.mcpPolicy ?? null;
+ const mcpDisabled = props.mcpDisabled === true || mcpPolicy?.enabled !== true;
const isMcpDirectoryEntry = (entry: McpDirectoryInfo) =>
entry.kind === "mcp" || Boolean(entry.type || entry.command?.length || entry.url);
- const quickConnectList = mcpDisabled
- ? props.quickConnect.filter((entry) => !isMcpDirectoryEntry(entry))
- : props.quickConnect;
+ // MCP servers come from the account's supported list (McpSupportedPanel).
+ // The quick-connect services, Connect and organization MCPs are remote and
+ // account-linked: never listed (a session that used them could not be repeated).
+ const quickConnectList = props.quickConnect.filter((entry) => !isMcpDirectoryEntry(entry));
const installedSkills = props.installedSkills ?? [];
const installedCommands = props.installedCommands ?? [];
const installedAgents = props.installedAgents ?? [];
- const availableConnectMcpServers = mcpDisabled ? [] : props.availableConnectMcpServers ?? [];
- const installedPlugins = mcpDisabled
- ? (props.installedPlugins ?? []).filter((plugin) => !plugin.files.some((file) => file.objectType === "mcp"))
- : props.installedPlugins ?? [];
- const orgMcpItems = mcpDisabled ? [] : props.orgMcpItems ?? [];
+ const availableConnectMcpServers: McpServerEntry[] = [];
+ const installedPlugins = (props.installedPlugins ?? []).filter((plugin) => !plugin.files.some((file) => file.objectType === "mcp"));
+ const orgMcpItems: ExtensionItem[] = [];
+ const addSupportedMcp = async (preset: OmniRushMcpPreset) => {
+ const result = await props.connectMcp({
+ id: preset.id,
+ name: preset.id,
+ description: preset.why ?? preset.title,
+ kind: "mcp",
+ type: "local",
+ command: preset.command,
+ oauth: false,
+ });
+ return result.ok ? { ok: true } : { ok: false, error: result.error };
+ };
const libraryDetailLists = {
quickConnect: quickConnectList,
skills: installedSkills,
@@ -628,7 +643,7 @@ export function McpView(props: McpViewProps) {
canCreateWorkspaceSkill: typeof props.createWorkspaceSkill === "function",
});
const libraryAddKinds = libraryAddKindsForFilter(filter).filter((kind) => (
- !mcpDisabled || (kind !== "mcp" && kind !== "workspace-mcp")
+ kind !== "mcp" && (!mcpDisabled || kind !== "workspace-mcp")
)).filter((kind) => (
libraryAddAction(kind, libraryAddOptions) !== null
|| (kind === "skill" && workspaceSkillAdd)
@@ -914,7 +929,8 @@ export function McpView(props: McpViewProps) {
// Auto-configured built-ins like omnirush-cloud remain active but hidden from
// Your apps until Show hidden reveals the row for disable/remove. Projected
// direct org connections are shown through their omnirush.ai Connect card.
- const visibleMcpServers = !mcpDisabled && inventoryState === "all" && (filter === "all" || filter === "mcp")
+ // Configured servers are listed with their status in McpSupportedPanel.
+ const visibleMcpServers = !mcpDisabled && !mcpPolicy && inventoryState === "all" && (filter === "all" || filter === "mcp")
? showHidden
? props.mcpServers
: props.mcpServers.filter((entry) => {
@@ -1405,11 +1421,24 @@ export function McpView(props: McpViewProps) {
return (
<section className="w-full max-w-3xl animate-in fade-in duration-300">
- {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">MCP servers cannot be enabled in OmniRush.ai.</p>
- </div>
+ {(filter === "all" || filter === "mcp") && inventoryState === "all" ? (
+ mcpPolicy ? (
+ <McpSupportedPanel
+ policy={mcpPolicy}
+ servers={props.mcpServers.filter((entry) => !isConnectDirectMcpServerName(entry.name) && entry.name !== "omnirush-cloud")}
+ canAdd={props.allowManageExtensions && !props.isRemoteWorkspace && mcpPolicy.engineV2 !== true}
+ busy={props.busy}
+ addPreset={addSupportedMcp}
+ removeServer={props.allowManageExtensions ? (name) => {
+ setRemoveTarget(name);
+ setRemoveOpen(true);
+ } : undefined}
+ />
+ ) : mcpDisabled ? (
+ <p data-testid="mcp-disabled-policy-notice" className="mb-5 text-sm text-dls-secondary">
+ MCP servers are turned off for this account.
+ </p>
+ ) : null
) : null}
{props.builtInExtensionsDisabled && props.allowManageExtensions ? (
<div className="mb-5 rounded-xl border border-amber-6 bg-amber-2 px-4 py-3 text-xs text-amber-11">
@@ -1723,7 +1752,7 @@ export function McpView(props: McpViewProps) {
kind={addAuthorableKind}
busy={props.busy}
cloud={cloudSession.isSignedIn}
- canConfigureMcpConnections={!mcpDisabled && isConnectAdminRole(cloudSession.activeOrganization?.role)}
+ canConfigureMcpConnections={false}
onClose={() => setAddAuthorableKind(null)}
onCreate={handleCreateLibraryItem}
/>
diff --git a/apps/app/src/react-app/shell/settings-route.tsx b/apps/app/src/react-app/shell/settings-route.tsx
index 5e3fea7d..f588cf6c 100644
--- a/apps/app/src/react-app/shell/settings-route.tsx
+++ b/apps/app/src/react-app/shell/settings-route.tsx
@@ -215,7 +215,8 @@ import {
const ROUTE_OMNIRUSH_CAPABILITIES: OmniRushServerCapabilities = {
skills: { read: true, write: true, source: "omnirush" },
plugins: { read: true, write: true },
- mcp: { read: false, write: false },
+ // The server checks each MCP server against the account's list (GET /workspace/:id/mcp says whether it is on).
+ mcp: { read: true, write: true },
commands: { read: true, write: true },
config: { read: true, write: true },
};
@@ -2411,6 +2412,7 @@ function SettingsRouteContent(props: SettingsSurfaceProps = {}) {
isRemoteWorkspace={isRemoteWorkspace}
mcpServers={connectionsSnapshot.mcpServers}
mcpDisabled={mcpDisabledByPolicy}
+ mcpPolicy={connectionsSnapshot.mcpPolicy}
mcpStatus={connectionsSnapshot.mcpStatus}
mcpLastUpdatedAt={connectionsSnapshot.mcpLastUpdatedAt}
mcpStatuses={connectionsSnapshot.mcpStatuses}
diff --git a/apps/app/tests/mcp-supported-panel.test.tsx b/apps/app/tests/mcp-supported-panel.test.tsx
new file mode 100644
index 00000000..e59dfc13
--- /dev/null
+++ b/apps/app/tests/mcp-supported-panel.test.tsx
@@ -0,0 +1,96 @@
+import { describe, expect, test } from "bun:test";
+import { renderToStaticMarkup } from "react-dom/server";
+
+import type { OmniRushMcpPolicyView, OmniRushMcpPreset } from "../src/app/lib/omnirush-server";
+import type { McpServerEntry } from "../src/app/types";
+import {
+ MCP_ENGINE_V2_NOTE,
+ MCP_REMOTE_NOT_SUPPORTED,
+ McpSupportedPanel,
+ mcpServerState,
+ presetCommandLine,
+ presetConfigured,
+} from "../src/react-app/domains/settings/pages/mcp-supported-panel";
+
+const filesystem: OmniRushMcpPreset = {
+ id: "filesystem",
+ title: "Filesystem",
+ why: "Reads and writes files in the project.",
+ runtime: "npm",
+ package: "@modelcontextprotocol/server-filesystem",
+ version: "2026.8.31",
+ versions: ">=2025.1.14",
+ command: ["npx", "-y", "@modelcontextprotocol/server-filesystem", "."],
+ localPagesOnly: false,
+};
+const sqlite: OmniRushMcpPreset = { ...filesystem, id: "sqlite", title: "SQLite", why: null, package: "mcp-server-sqlite-npx", version: "0.8.0", command: ["npx", "-y", "mcp-server-sqlite-npx", "data.db"] };
+
+function policy(overrides: Partial<OmniRushMcpPolicyView> = {}): OmniRushMcpPolicyView {
+ return { mode: "allowlist", enabled: true, message: null, engineV2: false, supported: [filesystem, sqlite], decisions: [], reportAt: null, ...overrides };
+}
+
+const render = (props: Partial<Parameters<typeof McpSupportedPanel>[0]> = {}) => renderToStaticMarkup(
+ <McpSupportedPanel
+ policy={policy()}
+ servers={[]}
+ canAdd
+ busy={false}
+ addPreset={async () => ({ ok: true })}
+ {...props}
+ />,
+);
+
+const server = (name: string, config: Record<string, unknown> = { type: "local", command: ["npx", "x"] }, source: McpServerEntry["source"] = "config.remote"): McpServerEntry => ({ name, config: config as McpServerEntry["config"], source });
+
+describe("Settings > MCP: supported servers", () => {
+ test("MCP off: one calm line, in the server's words when it gave some", () => {
+ const off = render({ policy: policy({ enabled: false, mode: "disabled", message: null, supported: [] }) });
+ expect(off).toContain("MCP servers are turned off for this account.");
+ expect(off).not.toContain("mcp-supported-panel");
+ expect(render({ policy: policy({ enabled: false, message: "Paused while we update the list." }) })).toContain("Paused while we update the list.");
+ });
+
+ test("presets show what they are, the command they add, and the version they run", () => {
+ const html = render();
+ expect(html).toContain("Filesystem");
+ expect(html).toContain("Reads and writes files in the project.");
+ expect(html).toContain("npx -y @modelcontextprotocol/server-filesystem .");
+ expect(html).toContain("npx -y mcp-server-sqlite-npx data.db");
+ expect(html).toContain("Runs @modelcontextprotocol/[email protected]");
+ expect(html).toContain(MCP_REMOTE_NOT_SUPPORTED);
+ expect(html).toContain(">Add<");
+ });
+
+ test("configured servers: on with version and sandbox, blocked with the reason (not an error), or pending", () => {
+ const html = render({
+ servers: [server("filesystem"), server("notion", { type: "remote", url: "https://mcp.notion.com/mcp" }), server("time", { type: "local", command: ["uvx", "mcp-server-time"] }, "config.project")],
+ policy: policy({
+ decisions: [
+ { name: "filesystem", status: "allowed", code: "allowed", id: "filesystem", package: "@modelcontextprotocol/server-filesystem", version: "2026.8.31", sandbox: true },
+ { name: "notion", status: "blocked", code: "remote", reason: "Remote MCP servers are not supported." },
+ ],
+ }),
+ });
+ expect(html).toContain("On</span> · @modelcontextprotocol/[email protected] · runs in the sandbox");
+ expect(html).toContain("Blocked</span> · Remote MCP servers are not supported.");
+ expect(html).toContain("Checked when the project&#x27;s next chat starts.");
+ expect(html).toContain("From the project&#x27;s opencode.json");
+ expect(html).not.toContain("text-red-11");
+ // The configured preset says Added instead of offering it again.
+ expect(html).toMatch(/data-testid="mcp-preset-filesystem".*Added/s);
+ });
+
+ test("the preview engine: MCP stays off there, and nothing is offered", () => {
+ const html = render({ policy: policy({ engineV2: true }), canAdd: false });
+ expect(html).toContain(MCP_ENGINE_V2_NOTE);
+ expect(html).not.toContain(">Add<");
+ });
+
+ test("helpers", () => {
+ expect(presetCommandLine({ command: ["uvx", "mcp-server-git", "--repository", "my repo"] })).toBe("uvx mcp-server-git --repository 'my repo'");
+ expect(presetConfigured(filesystem, [], [{ name: "files", status: "allowed", code: "allowed", id: "filesystem" }])).toBe(true);
+ expect(presetConfigured(filesystem, [server("other")], [])).toBe(false);
+ expect(mcpServerState(server("x", { type: "local", command: ["npx", "x"], enabled: false }), { name: "x", status: "allowed", code: "allowed" })).toEqual({ kind: "off" });
+ expect(mcpServerState(server("x"), null)).toEqual({ kind: "pending" });
+ });
+});