Skip to content

feat: forward MCP server flags via OPERA_CLI_MCP_ARGS env var - #43

Merged
mateuszk-opera merged 2 commits into
mainfrom
feat/propagate-mcp-args-to-devtools
Sep 14, 2026
Merged

mateuszk-opera merged 2 commits into
mainfrom
feat/propagate-mcp-args-to-devtools

Conversation

@mateuszk-opera

Copy link
Copy Markdown
Contributor

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.

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 macieju-opera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two remarks, both minor:

  1. Verbatim passthrough has no isolation. OPERA_CLI_CHROME_ARGS is namespaced (--chrome-arg=…) so a bad flag only affects the Chrome launch. OPERA_CLI_MCP_ARGS is 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.

  2. 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 macieju-opera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — both prior comments are addressed (raw-arg override caveat documented; tests no longer duplicate the default tuple). Tests pass (61/61).

@mateuszk-opera
mateuszk-opera merged commit 7b813a8 into main Sep 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants