Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@ export function shouldRunHeaded(): boolean {
export function buildTransportArgs(): string[] {
const args: string[] = [];

// opera-devtools-mcp 0.6+ requires pageId on page-scoped tools by default.
// We never route by pageId — disable it so every tool works on the selected page.
args.push("--no-page-id-routing");

const browserUrl = process.env.OPERA_CLI_BROWSER_URL;
const userDataDir = process.env.OPERA_CLI_USER_DATA_DIR;
const executablePath = process.env.OPERA_CLI_EXECUTABLE_PATH;
Expand Down
6 changes: 3 additions & 3 deletions test/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ describe("buildTransportArgs", () => {
process.env.OPERA_CLI_EXECUTABLE_PATH = savedEnv.OPERA_CLI_EXECUTABLE_PATH;
});

it("defaults to headless and isolated", () => {
it("defaults to headless and isolated with no-page-id-routing", () => {
const args = buildTransportArgs();
expect(args).toEqual(["--isolated", "--headless"]);
expect(args).toEqual(["--no-page-id-routing", "--isolated", "--headless"]);
});

it("omits --headless when OPERA_CLI_HEADED=1", () => {
process.env.OPERA_CLI_HEADED = "1";
const args = buildTransportArgs();
expect(args).toEqual(["--isolated"]);
expect(args).toEqual(["--no-page-id-routing", "--isolated"]);
});

it("forwards chrome args via --chrome-arg=", () => {
Expand Down
Loading