Skip to main content
Glama
README.md
# Opera GX Control for Claude

Give Claude control of Opera GX. It can switch GX Control limiters, the
sidebar, tab bar settings and themes, apply one-click presets, and drive tabs
and pages.

Install the VS Code extension and click **Connect**. Claude Code and Claude
Desktop can then take requests like *"put Opera in gaming mode"*, *"hide the
sidebar and switch to the After Eight theme"* or *"summarize the tab I have
open"*.

> Unofficial. Not affiliated with or endorsed by Opera. It works through
> Opera's local DevTools port and undocumented settings APIs, so an Opera
> update can break parts of it. Read [Security](#security) before installing.

## What's included

| Piece | What it does |
|---|---|
| **VS Code extension** | Bundles everything below. Connects Claude Code and Claude Desktop in one click, restarts Opera GX with access turned on, and adds presets and toggles to the command palette and status bar. No Node.js install needed. |
| **MCP server** (`mcp/server.mjs`) | The tools Claude uses: 13 for settings, 9 for tabs and pages. |
| **Opera toolbar extension** (`opera-extension/`) | Optional popup and sidebar panel with presets, toggles and keyboard shortcuts, inside Opera itself. |
| **CLI** (`cli/opera-gx.mjs`) | The same controls from a terminal or script. |

## Install

### With VS Code (recommended)

1. Install **Opera GX Control for Claude** from the VS Code Marketplace. Or
   download the `.vsix` from [Releases](https://github.com/trifactorscalingllc/opera-gx-control/releases),
   then in VS Code open **Extensions → ⋯ → Install from VSIX…**.
2. When VS Code asks *"Connect Claude Code and Claude Desktop to Opera GX?"*,
   click **Connect**. You can also run **Opera GX: Connect Claude** from the
   command palette later.
3. Run **Opera GX: Restart Opera GX with Claude Access**. Opera closes and
   reopens with its DevTools port open. Choose **Restart and Keep Access On**
   to make that stick for future launches (Windows).
4. Start a new Claude Code session, or quit and reopen Claude Desktop, then
   ask Claude to do something in Opera GX.

The status bar shows `GX` with any active limits. Click it for the control menu.

### Without VS Code

Requires Node.js 22 or newer.

```sh
git clone https://github.com/trifactorscalingllc/opera-gx-control
cd opera-gx-control
npm install --omit=dev
```

**Connect Claude Code:**

```sh
claude mcp add --scope user opera-gx -- node /absolute/path/to/opera-gx-control/mcp/server.mjs
```

**Connect Claude Desktop:** add this to `claude_desktop_config.json`
(Settings → Developer → Edit Config), then restart Claude Desktop:

```json
{
  "mcpServers": {
    "opera-gx": {
      "command": "node",
      "args": ["/absolute/path/to/opera-gx-control/mcp/server.mjs"]
    }
  }
}
```

**Start Opera GX with access.** On Windows, from the repo folder:

```powershell
.\scripts\launch-opera-gx.ps1 -Restart            # this launch only
.\scripts\launch-opera-gx.ps1 -UpdateShortcuts    # also every launch from the Desktop/Start Menu shortcuts
```

On macOS (implemented, not yet tested), quit Opera GX, then:

```sh
open -na "Opera GX" --args --remote-debugging-port=9222 --remote-allow-origins=chrome-extension://jhcegjnggmmdpoipdgfhfgppnefojmeh
```

## What Claude can do

### Settings

| Tool | Does |
|---|---|
| `gx_status` | Limiters, sidebar, tab bar, dark mode, theme and active preset at a glance |
| `gx_limiter` | RAM (MB), CPU (%) or network limiter on/off, with an optional limit |
| `gx_sidebar` | Show/hide the sidebar, auto-hide on/off |
| `gx_sidebar_items`, `gx_set_sidebar_item` | List sidebar items; show or hide one (Player, Discord, Twitch, workspaces…) |
| `gx_themes`, `gx_set_theme` | List color themes; switch theme |
| `gx_presets`, `gx_apply_preset`, `gx_restore` | Apply a preset; undo back to the settings from before it |
| `gx_list_prefs`, `gx_get_pref`, `gx_set_pref` | Any of Opera's ~570 exposed settings, type-checked |

### Tabs and pages

| Tool | Does |
|---|---|
| `browser_tabs` | List open tabs |
| `browser_open_tab`, `browser_close_tab`, `browser_activate_tab` | Open, close, focus |
| `browser_navigate` | Load a URL in a tab and wait for it |
| `browser_read_page` | A tab's title, URL and visible text |
| `browser_evaluate` | Run JavaScript in a page |
| `browser_screenshot` | PNG of a tab |
| `browser_cdp` | Any Chrome DevTools Protocol command, for everything else |

### Presets

| Preset | Changes |
|---|---|
| Gaming | RAM limiter at 2 GB, CPU limiter at 25%, network limiter on, sidebar hidden |
| Focus | Sidebar, tab previews and hover cards hidden; inactive tabs snoozed; reduced motion |
| Battery saver | RAM limiter at 4 GB, CPU limiter at 50%; inactive tabs snoozed; reduced motion |

Applying a preset saves the values it replaces, and restore puts them back.
Stacked presets restore to where you were before the first one. The restore
point lives in Opera, so the VS Code menu, the toolbar popup, the shortcuts,
the CLI and Claude all share it.

## Opera toolbar extension (optional)

Adds a popup and an Opera sidebar panel with presets, an undo button, the
limiter/sidebar/tab bar/theme toggles, and shortcuts.

1. In VS Code, run **Opera GX: Set Up the Opera Toolbar Extension**. It copies
   the extension to `~/.opera-gx-control/opera-extension` and copies that path.
   Without VS Code, use the `opera-extension` folder from a release zip or this
   repo.
2. In Opera GX, open `opera://extensions`, turn on **Developer mode**, click
   **Load unpacked**, and choose the folder.
3. Make sure Opera runs with Claude access (above). The
   `--remote-allow-origins` flag is what lets this extension connect; its ID is
   fixed at `jhcegjnggmmdpoipdgfhfgppnefojmeh`.

| Shortcut | Does |
|---|---|
| Alt+Shift+G | Gaming preset |
| Alt+Shift+R | Undo the preset |
| Alt+Shift+S | Show/hide sidebar |
| Alt+Shift+L | RAM limiter on/off |
| *(unassigned)* | Focus preset, Battery saver preset, CPU limiter, network limiter |

Change or assign them at `opera://extensions/shortcuts`.

## Security

**The DevTools port is full remote control of your browser.** While Opera
runs with `--remote-debugging-port`, any program on your computer can read
every page, act inside logged-in sites and read cookies. The port listens on
127.0.0.1 only, so other devices can't reach it, but local software can. Only
turn it on when you trust what runs on your machine.

**Claude gets the same reach.** The browser tools can read and act on any site
you're signed in to. Web pages can contain text written to mislead an AI.
Claude Code asks before each tool call by default. Keep asking on for
`browser_evaluate`, `browser_cdp` and `browser_navigate`, rather than
allowlisting them.

- Never launch Opera with `--remote-allow-origins=*`. That lets web pages use
  the port too.
- To turn access off, quit Opera and start it normally. If you used **Keep
  Access On**, run `scripts\launch-opera-gx.ps1 -RemoveFromShortcuts` first.
- To disconnect Claude, run **Opera GX: Disconnect Claude**, or
  `claude mcp remove --scope user opera-gx`.

## How it works

Opera gates its settings APIs (`chrome.settingsPrivate`,
`opr.themesPrivate`, `opr.browserSidebarPrivate`) to its own internal pages and
built-in extensions, so an ordinary extension can't toggle GX Control. The
DevTools port can attach to one of those internal pages
(`chrome://easy-setup-gx/`) and make the call from inside it. For tabs and
pages it uses the DevTools Protocol directly.

All four pieces share one client:
[`opera-extension/gx-client.js`](opera-extension/gx-client.js).

## Compatibility

Tested on Windows 11 with Opera GX 135 (Chromium 151), VS Code 1.136 and
Claude Code 2.1. The macOS code paths exist but haven't been run. Opera GX
isn't available on Linux.

## Troubleshooting

| Symptom | Fix |
|---|---|
| "Nothing is answering on 127.0.0.1:9222" | Opera wasn't started with the flag. If it keeps running in the background (tray icon), quit it fully before restarting it with access. |
| Toolbar popup says the port refused it | Opera is missing `--remote-allow-origins=chrome-extension://jhcegjnggmmdpoipdgfhfgppnefojmeh`. Restart it through VS Code or the script. |
| "Pref … does not exist" | Your Opera version renamed that setting. Open an issue with your Opera GX version. |
| Claude doesn't list the tools | Start a new Claude Code session, or fully restart Claude Desktop. Run `claude mcp get opera-gx` to check the connection. |

## Development

```sh
npm install
npm test                         # structure checks + MCP server, no Opera needed
node test/opera.e2e.mjs 9333     # against a running Opera GX (see the file header)
npm run test:vscode -- 9333      # the VS Code extension, in a downloaded and isolated VS Code
```

Push a `v*` tag to release. CI tests, packages the `.vsix` and the Opera
extension zip, publishes a GitHub release, and publishes to the Marketplace
when the `VSCE_PAT` secret is set.

## License

[MIT](LICENSE). Opera and Opera GX are trademarks of Opera Norway AS.