Yeachan-Heo/oh-my-codex · error · Error

Missing setup MCP mode value after --mcp. Expected one of: n

Error message

Missing setup MCP mode value after --mcp. Expected one of: none, compat

What it means

--mcp expects a value (`none` or `compat`) as the next token. The error fires when --mcp is last or the next token starts with `-`.

Source

Thrown at src/cli/index.ts:653

      );
    }
    return next as SetupMcpMode;
  };

  for (let index = 0; index < args.length; index += 1) {
    const arg = args[index];
    if (arg === "--no-mcp") {
      setValue("none", arg);
      continue;
    }
    if (arg === "--with-mcp") {
      setValue("compat", arg);
      continue;
    }
    if (arg === "--mcp") {
      const next = args[index + 1];
      if (!next || next.startsWith("-")) {
        throw new Error(
          `Missing setup MCP mode value after --mcp. Expected one of: none, compat`,
        );
      }
      setValue(parseValue(next), arg);
      index += 1;
      continue;
    }
    if (arg.startsWith("--mcp=")) {
      setValue(parseValue(arg.slice("--mcp=".length)), "--mcp");
    }
  }

  return value;
}

export function resolveSetupScopeArg(args: string[]): SetupScope | undefined {
  let value: string | undefined;
  for (let index = 0; index < args.length; index += 1) {

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Append a valid mode: `--mcp compat`
  2. Or use the boolean shorthand `--no-mcp`/flag form if you want the default

Example fix

# before
omx setup --mcp
# after
omx setup --mcp=compat
Defensive patterns

Strategy: validation

Validate before calling

const i = args.indexOf('--mcp');
const v = args[i + 1];
if (!v || v.startsWith('-')) throw new Error('missing MCP mode value');

Prevention

When it happens

Trigger: `omx setup --mcp` (end of args) or `--mcp --scope project`.

Common situations: Truncated commands or scripts dropping the value.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/2ddb7dd6c30ea3cb. Report an issue: GitHub.