feat: forward MCP server flags via OPERA_CLI_MCP_ARGS env var - #43
Conversation
Add OPERA_CLI_MCP_ARGS to buildTransportArgs so users can pass flags like --categoryExtensions to the MCP server at bridge startup without modifying source code. Closes the chrome-extension:// navigation gate for the bridge.
macieju-opera
left a comment
There was a problem hiding this comment.
Two remarks, both minor:
-
Verbatim passthrough has no isolation.
OPERA_CLI_CHROME_ARGSis namespaced (--chrome-arg=…) so a bad flag only affects the Chrome launch.OPERA_CLI_MCP_ARGSis injected unprefixed as a top-level arg, so a misspelled/unknown flag is passed straight to the MCP server's parser and can fail the whole bridge startup rather than failing locally — and since these come after the bridge-set args, they can also shadow bridge-managed flags (--isolated,--headless,--userDataDir). Worth a sentence in docs stating these are raw server args and can override built-in behavior. The value-with-spaces limitation is already documented. -
Tests duplicate the production default tuple. Three tests hard-code
["--no-page-id-routing", "--isolated", "--headless"](defaults to no extra mcp args,rejects whitespace-only OPERA_CLI_MCP_ARGS,rejects whitespace-only OPERA_CLI_CHROME_ARGS). When a default arg changes, these break for an unrelated reason. Prefer asserting on the forwardable flags instead, e.g.expect(args).not.toContain("--categoryExtensions").
macieju-opera
left a comment
There was a problem hiding this comment.
LGTM — both prior comments are addressed (raw-arg override caveat documented; tests no longer duplicate the default tuple). Tests pass (61/61).
Add OPERA_CLI_MCP_ARGS to buildTransportArgs so users can pass flags like --categoryExtensions to the MCP server at bridge startup without modifying source code.
Closes the chrome-extension:// navigation gate for the bridge.