@minhspark/codex-mcp-bridge 1.24.1 → 1.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,47 +4,95 @@ Connect Claude Desktop's **Code tab** and Codex Desktop through local MCP
4
4
  processes and sockets. Both apps still authenticate with their providers and
5
5
  use hosted models; local bridge transport does not mean offline inference.
6
6
 
7
- ## Local installation: required steps
7
+ ## One-command local installation
8
8
 
9
9
  The [ChatGPT plugin setup](../README.md#chatgpt-plugin) uses a hosted Sites
10
- connector. For a local Desktop installation, use the following path instead:
11
-
12
- 1. Install and sign in to Codex Desktop and Claude Desktop under the same macOS
13
- user. Have Node.js 22+, npm, the Codex CLI, and the Claude Code CLI available.
14
- Save the intended local project in Codex Desktop and open it in Claude's
15
- Code tab.
16
- 2. Follow [macOS installation](../README.md#macos-terminal) to install the bridge
17
- and register the native relay and reverse bridge. Keep bootstrap enabled on
18
- the first relay install. Do not use the ChatGPT plugin pairing instructions,
19
- run `codex-sites-connector`, or configure a hosted endpoint.
20
- 3. Follow [Claude Code registration](../README.md#register-claude-code) for the
21
- forward bridge. Use the intended project directories for
22
- `CODEX_BRIDGE_ALLOWED_ROOTS`, rather than the example's entire home directory;
23
- macOS separates multiple roots with `:`. Preserve an existing entry's
24
- custom settings.
25
- 4. Check that the relay entry has
26
- [native relay pipe forwarding](../README.md#native-relay-pipe-forwarding).
27
- The installer adds `CODEX_APP_TOOLS_PIPE_PATH` by name, never its temporary
28
- value. The relay needs the trusted app-bundled Node runtime selected by the
29
- installer; do not substitute an arbitrary Homebrew/nvm Node.
30
- 5. Reconnect the affected MCP servers in the actual Desktop Code conversations,
31
- or restart the affected app after active work finishes. Complete
32
- [installation verification](../README.md#verify-the-installation), including
33
- a message and reply in each direction.
34
-
35
- There are three registrations: `codex-bridge` in Claude Code, and
36
- `claude-bridge` plus `codex-native-relay` in Codex Desktop. The relay is transport
37
- plumbing, not a third agent. Ordinary Claude chat has a separate MCP registry;
38
- adding a server there does not register it in the Code tab.
10
+ connector. For local Desktop use, install Node.js 22.13+ and sign in to the apps
11
+ under the same macOS user. Save the intended local project in Codex Desktop and
12
+ open it in Claude's Code tab, then run:
13
+
14
+ ```bash
15
+ npm install -g @minhspark/codex-mcp-bridge@latest --allow-scripts=@minhspark/codex-mcp-bridge
16
+ ```
17
+
18
+ The script allowance applies only to this package's setup hook. npm versions
19
+ that block install scripts by default need it; a plain install is sufficient
20
+ only when the hook is allowed. Append `--foreground-scripts` to see progress.
21
+ If npm reports `1 package had install scripts blocked`, rerun the command above
22
+ or run `codex-bridge-setup` explicitly.
23
+
24
+ Setup registers the local bridges, adds native pipe forwarding, and bootstraps
25
+ the relay executor. It reuses an available Codex CLI or installs a pinned
26
+ official package under `~/.config/GptClaudeBridge/tools` (or
27
+ `XDG_CONFIG_HOME/GptClaudeBridge/tools`). No separate CLI install command is
28
+ required. Run the install under the account that uses the apps, without `sudo`.
29
+ The package remains installed if an app configuration step fails, preserving
30
+ the setup command for repair. A successful npm exit does not verify that every
31
+ component is configured.
32
+
33
+ | Client | Entry | Route |
34
+ | --- | --- | --- |
35
+ | Claude Code | `codex-bridge` | Native Codex Desktop handoffs |
36
+ | Claude Desktop shared connectors | `codex-bridge-desktop` | Local Codex app-server sessions from ordinary chat |
37
+ | Codex | `claude-bridge` | Claude Code messages and replies |
38
+ | Codex | `codex-native-relay` | Native Desktop transport |
39
+ | Codex and Claude Code | `antigravity-bridge` | Antigravity App and bridge-owned CLI sessions |
40
+ | Antigravity | `agent-bridge` and `codex-bridge` sidecar | Outbound messaging and native App connectivity |
41
+
42
+ The shared `codex-bridge-desktop` connector cannot establish a native Code
43
+ sender identity. The native route uses the actual Code session and the same
44
+ saved local Codex project. Setup does not pair the hosted ChatGPT connector.
45
+
46
+ The relay needs the trusted app-bundled Node runtime selected by setup; do not
47
+ substitute an arbitrary Homebrew/nvm Node. Pipe forwarding saves only the
48
+ `CODEX_APP_TOOLS_PIPE_PATH` variable name, never its temporary value.
49
+
50
+ Open or reconnect the affected MCP servers in the actual Desktop conversations,
51
+ or restart the app after active work finishes. Setup does not restart or kill
52
+ apps. Check `codex_bridge_status` inside Claude Code, `claude_bridge_status` and
53
+ `native_relay_status` in Codex, and `agent_bridge_status` in Antigravity. Complete
54
+ [installation verification](../README.md#verify-the-installation), including
55
+ a message and reply in each direction. Saved configuration is not a completed
56
+ live exchange or a claim of verification on another Mac.
57
+
58
+ ## Checks, recovery, and manual alternatives
59
+
60
+ ```bash
61
+ codex-bridge-setup --check
62
+ codex-bridge-setup --dry-run
63
+ codex-bridge-setup
64
+ ```
65
+
66
+ `--check` inspects registrations; `--dry-run` previews components and paths
67
+ without downloads or writes; the plain command applies setup again. Add
68
+ `--json` for structured output or `--no-download` to require an existing Codex
69
+ CLI. `codex-mcp-bridge setup` runs the same setup. An incomplete result identifies
70
+ the component to correct before rerunning. Explicit setup and `--check` return
71
+ a nonzero exit status while configuration is incomplete.
72
+
73
+ Local `npm install` and `npm ci` do not change app settings. Set
74
+ `CODEX_BRIDGE_SKIP_SETUP=1` or use `--ignore-scripts` to skip setup during a
75
+ global install. For Homebrew, run `codex-bridge-setup` after installing the
76
+ formula. A pinned source checkout can use `node scripts/setup.mjs`.
77
+
78
+ The [manual macOS commands](../README.md#macos-terminal) and
79
+ [Claude Code registration commands](../README.md#register-claude-code) remain
80
+ available for selective configuration. `codex-bridge-code-install --install`
81
+ can create a missing user-level Code entry; its existing policy migration mode
82
+ is described in [project onboarding](project-onboarding.md). Use intended
83
+ project paths when setting explicit `CODEX_BRIDGE_ALLOWED_ROOTS`; macOS
84
+ separates them with `:`.
39
85
 
40
86
  ## Restricted local configuration
41
87
 
42
- Local transport does not require Full Access. Keep the intended sandbox,
43
- approval reviewer, and project restrictions. Before running installers, check
44
- for `$CODEX_HOME/bridge-full-access.enabled` (normally
45
- `~/.codex/bridge-full-access.enabled`): a saved opt-in makes them enable Full
46
- Access even without `--full-access`. Resolve that existing opt-in deliberately
47
- before installing; `CODEX_BRIDGE_ENFORCE_FULL_ACCESS=0` does not disable it.
88
+ Local transport does not require Full Access. Automatic setup preserves the
89
+ intended sandbox, approval reviewer, project restrictions, and custom modes. It
90
+ does not grant workspace trust or tool approval, sign in, or enable permission
91
+ bypass. The older individual installers, when run manually without setup mode,
92
+ can still honor `$CODEX_HOME/bridge-full-access.enabled` (normally
93
+ `~/.codex/bridge-full-access.enabled`); review that saved preference before using
94
+ those advanced commands. `CODEX_BRIDGE_ENFORCE_FULL_ACCESS=0` does not delete the
95
+ saved preference.
48
96
 
49
97
  For a restricted Codex setup, these are top-level configuration settings,
50
98
  before any `[table]`:
@@ -57,7 +105,7 @@ sandbox_mode = "workspace-write"
57
105
 
58
106
  Verify the active Desktop task uses the intended restrictions; defaults alone
59
107
  are not evidence of its effective permissions. To suppress optional reporting,
60
- set `CODEX_BRIDGE_TELEMETRY=0` in all three MCP registrations' environments;
108
+ set `CODEX_BRIDGE_TELEMETRY=0` in the bridge MCP registrations' environments;
61
109
  see [telemetry controls](../README.md#optional-active-install-statistics).
62
110
 
63
111
  For workspace trust, shared project grants, and optional messaging automation,
@@ -1,70 +1,129 @@
1
- # New Windows setup and initial permissions
1
+ # Windows setup and initial permissions
2
2
 
3
- This is a Windows local Desktop source-install guide, not evidence of testing
4
- on a second machine. Use a pinned source revision containing these scripts;
5
- published npm versions may not yet include this branch. The optional card
6
- extension is distributed separately. Keep the source in a stable directory.
3
+ Install Node.js 22.13+ and sign in to the apps you intend to use. For native
4
+ handoffs, save the local project in Codex Desktop and open the same directory
5
+ in Claude Desktop's **Code tab**. Run one PowerShell command:
7
6
 
8
- Install/sign in to Codex Desktop and Claude Desktop; install Node 22+ and Git,
9
- and make the Codex CLI available. Record the source revision and optional MCPB
10
- version/hash. Do not copy login caches, old session identities, unfinished
11
- receipts or directory-identity grants from another machine.
7
+ ```powershell
8
+ npm.cmd install -g @minhspark/codex-mcp-bridge@latest --allow-scripts=@minhspark/codex-mcp-bridge
9
+ ```
10
+
11
+ The `--allow-scripts` value permits only this package's setup hook. npm versions
12
+ that block install scripts by default need it; a plain install runs setup only
13
+ when scripts are allowed. Add `--foreground-scripts` to see setup progress. If
14
+ npm reports `1 package had install scripts blocked`, run the recommended command
15
+ again or run `codex-bridge-setup.cmd` explicitly.
12
16
 
13
- ## Three messaging entries
17
+ The global installation configures the bridges and verifies their saved
18
+ registrations. It reuses an available native Codex CLI, or installs a pinned
19
+ official package in the current user's `.config\GptClaudeBridge\tools`
20
+ directory. It also configures native pipe forwarding and bootstraps the relay
21
+ executor. A failed component is reported as incomplete rather than ready. The
22
+ package stays installed when an app configuration step fails, so the setup
23
+ command remains available for repair. npm success alone does not verify setup.
24
+
25
+ ## Installed entries
14
26
 
15
27
  | Client | Entry | Purpose |
16
28
  | --- | --- | --- |
17
29
  | Codex | `claude-bridge` | Send to Claude and observe replies |
18
30
  | Codex | `codex-native-relay` | Deliver Claude requests through the Desktop host |
19
31
  | Claude Code, user scope | `codex-bridge` | Send to Codex and continue reply observation |
32
+ | Claude Desktop shared connectors | `codex-bridge-desktop` | Connect ordinary chat to local Codex app-server sessions |
33
+ | Codex and Claude Code | `antigravity-bridge` | Send to Antigravity App or bridge-owned CLI sessions |
34
+ | Antigravity | `agent-bridge` and `codex-bridge` sidecar | Outbound agent messages and native App connectivity |
35
+
36
+ The shared `codex-bridge-desktop` connector does not establish a native Code
37
+ sender identity. Use the actual Code session for native Codex Desktop work.
38
+ Existing project restrictions, permission modes, and custom settings are
39
+ preserved. Setup does not sign in, grant workspace trust, or close applications.
20
40
 
21
- Begin with one dedicated test directory and explicitly grant it:
41
+ After active work finishes, open or reconnect the affected apps so they load
42
+ the entries. A conversation refresh may leave the previous MCP process loaded.
43
+ Check `codex_bridge_status` inside the sending Claude Code task,
44
+ `claude_bridge_status` and `native_relay_status` in Codex, and
45
+ `agent_bridge_status` in Antigravity. Configuration verification is separate
46
+ from a completed live exchange.
47
+
48
+ ## Checks and recovery
22
49
 
23
50
  ```powershell
24
- node scripts/bridge-projects.mjs allow-project 'C:\Projects\BridgeTest'
51
+ codex-bridge-setup.cmd --check
52
+ codex-bridge-setup.cmd --dry-run
53
+ codex-bridge-setup.cmd
25
54
  ```
26
55
 
27
- Merge a user-level Claude Code entry, replacing placeholder paths with actual
28
- absolute paths and preserving unrelated settings:
29
-
30
- ```json
31
- {
32
- "mcpServers": {
33
- "codex-bridge": {
34
- "command": "C:/Tools/nodejs/node.exe",
35
- "args": ["C:/Tools/GptClaudeBridge/src/mcp-supervisor.mjs", "index.mjs"],
36
- "env": {
37
- "CODEX_BIN": "C:/Tools/Codex/codex.exe",
38
- "CODEX_BRIDGE_DESKTOP_TASKS": "1",
39
- "CODEX_BRIDGE_AUTOSTART": "0",
40
- "CODEX_BRIDGE_PROJECT_POLICY": "C:/Users/<user>/.config/GptClaudeBridge/projects.json",
41
- "CODEX_BRIDGE_ALLOWED_ROOTS": "C:/Projects/BridgeTest",
42
- "CODEX_BRIDGE_THREAD_POLICY": "roots",
43
- "CODEX_BRIDGE_APPROVAL_POLICY": "on-request",
44
- "CODEX_BRIDGE_SANDBOX": "workspace-write"
45
- }
46
- }
47
- }
48
- }
56
+ The first command inspects configuration; the second previews components and
57
+ paths without writes or downloads; the third applies setup again. Add `--json`
58
+ for structured output or `--no-download` to require an existing Codex CLI.
59
+ Explicit setup and `--check` return a nonzero exit status if configuration is
60
+ incomplete.
61
+ `codex-mcp-bridge.cmd setup` is an equivalent setup entry point. If Claude Code
62
+ has no bridge tools, inspect and reconnect `codex-bridge` using `/mcp` before
63
+ attempting delivery.
64
+
65
+ Local `npm install` and `npm ci` do not configure apps. To opt out during a
66
+ global install, set `CODEX_BRIDGE_SKIP_SETUP=1` or use `--ignore-scripts`.
67
+ The optional card extension, hosted ChatGPT pairing, and VS Code preview have
68
+ separate installation steps.
69
+
70
+ ## If startup still fails
71
+
72
+ Check the version reported by `codex_bridge_status` in the actual Claude Code
73
+ session against the installed package:
74
+
75
+ ```powershell
76
+ npm.cmd list -g @minhspark/codex-mcp-bridge --depth=0
49
77
  ```
50
78
 
51
- Then run `node scripts/install-claude-code.mjs --check`. That helper migrates or
52
- checks an existing supervised entry; it does not create a first entry from
53
- nothing. See [project onboarding](project-onboarding.md) for migration.
79
+ Also inspect the session's MCP command and script path. A source checkout can
80
+ keep an older version running even after npm updates the global package. If
81
+ the tool is unavailable, the startup log and configured path identify which
82
+ installation Claude tried to load. Rerun setup and reconnect the affected
83
+ client after active work finishes before comparing another result.
84
+
85
+ Setup prepares runtime snapshots in advance. However, a startup message such
86
+ as `prepared ... (reused)` means only that the runtime directory already
87
+ existed; missing or invalid integrity metadata can still require verification
88
+ work. If a 30-second connection timeout persists after the intended global
89
+ installation is loaded, collect the runtime version, startup log and exact
90
+ timeout. Configuration repair and a reused directory do not prove that the
91
+ reported startup delay has been resolved.
54
92
 
55
- Configure the same policy for Codex using the repository installers:
93
+ Claude may label ordinary startup diagnostics as `Server stderr`, including
94
+ `preparing`, `prepared`, and `ready` lines. Check the real connection status and
95
+ error rather than treating that label alone as failure. Keep diagnostics off
96
+ stdout: MCP uses stdout for protocol messages.
97
+
98
+ ## Optional source installation and project policy
99
+
100
+ For a pinned source checkout in a stable directory, `node scripts/setup.mjs`
101
+ runs the same setup. The individual installers remain available for deliberate
102
+ manual configuration. For example, with an available Codex CLI and an explicitly
103
+ selected test project:
56
104
 
57
105
  ```powershell
106
+ node scripts/bridge-projects.mjs allow-project 'C:\Projects\BridgeTest'
107
+ $env:CODEX_BIN = (Get-Command codex.exe).Source
108
+ $env:CODEX_EXE = $env:CODEX_BIN
58
109
  $env:CODEX_BRIDGE_PROJECT_POLICY = Join-Path $env:USERPROFILE '.config\GptClaudeBridge\projects.json'
59
110
  $env:CODEX_BRIDGE_DESKTOP_TASKS = '1'
111
+ $env:CODEX_BRIDGE_AUTOSTART = '0'
112
+ node scripts/install-claude-code.mjs --install
60
113
  node scripts/install-native-relay.mjs
61
114
  node scripts/install-codex-mcp.mjs
62
115
  ```
63
116
 
64
- If discovery fails, set `CODEX_EXE` to the real CLI executable. Relay setup may
65
- create an initial relay task. Do not add a permission-bypass mode. If CC Switch
66
- manages the entries, save the same configuration there. Reload affected clients
67
- and inspect the tools inside the actual Code/dispatch conversations.
117
+ `--install` creates a missing Code entry or updates a recognized one;
118
+ `--install --dry-run` previews it. For an existing entry with a different scope,
119
+ use the explicit policy migration in [project onboarding](project-onboarding.md).
120
+ `--check` on that helper checks the optional shared policy arrangement; it is
121
+ not the general setup check. Keep CC Switch or another configuration manager
122
+ consistent with the saved entries so it does not restore an obsolete copy.
123
+
124
+ Do not copy login caches, session identities, unfinished receipts or
125
+ directory-identity grants from another machine. This guide is not evidence
126
+ that a particular second machine or client build has passed live verification.
68
127
 
69
128
  ## Permissions are separate
70
129
 
@@ -1,5 +1,38 @@
1
1
  # Project onboarding and shared authorization
2
2
 
3
+ The recommended global installation registers the bridges automatically:
4
+
5
+ ```sh
6
+ npm install -g @minhspark/codex-mcp-bridge@latest --allow-scripts=@minhspark/codex-mcp-bridge
7
+ ```
8
+
9
+ In Windows PowerShell use `npm.cmd`. The script allowance authorizes only this
10
+ package's setup hook; npm versions that block install scripts by default need
11
+ it. A plain install runs setup only when the hook is allowed. Append
12
+ `--foreground-scripts` to see progress. If npm prints
13
+ `1 package had install scripts blocked`, rerun the recommended command or run
14
+ `codex-bridge-setup` explicitly. The setup creates
15
+ `codex-bridge` for Claude Code and the separate `codex-bridge-desktop` shared
16
+ Claude connector, configures Codex and Antigravity, and initializes the native
17
+ relay on Windows/macOS. See [installation](../README.md#installation).
18
+
19
+ Setup preserves existing scope and permission choices. Registration does not
20
+ grant workspace trust, authorize cross-project work, or establish a live
21
+ connection. The shared Desktop connector uses local app-server sessions;
22
+ native Codex Desktop handoffs require a verified Claude Code sender in the
23
+ same saved project.
24
+
25
+ `codex-bridge-setup --check` inspects all saved registrations. Use
26
+ `codex-bridge-setup --dry-run` to preview or rerun `codex-bridge-setup` to apply
27
+ setup after correcting an incomplete component. Add `.cmd` on Windows and
28
+ `--json` for structured output. Local package installs do not run setup;
29
+ `CODEX_BRIDGE_SKIP_SETUP=1` and npm `--ignore-scripts` opt out of global setup.
30
+ If app configuration is incomplete, npm retains the package for repair; its
31
+ success exit alone does not verify setup. Explicit setup and `--check` return
32
+ a nonzero status until the saved configuration passes verification.
33
+
34
+ ## Optional shared project policy
35
+
3
36
  Both bridge directions can read the same optional policy file via
4
37
  `CODEX_BRIDGE_PROJECT_POLICY`. `bridge-projects` defaults to
5
38
  `~/.config/GptClaudeBridge/projects.json`. A shared home-directory path avoids
@@ -48,20 +81,42 @@ node scripts/bridge-projects.mjs prepare /absolute/projects/example
48
81
 
49
82
  Changes are backed up and verified. Concurrent changes abort; failed rollback
50
83
  returns `partial_needs_review` and remaining files. `configured` does not mean
51
- live communication passed. Setup does not approve tools, change session modes,
52
- create conversations or restart clients. Workspace trust follows Claude's
84
+ live communication passed. Project preparation does not approve tools, change
85
+ session modes, create conversations or restart clients. The package installer
86
+ separately initializes an internal relay executor when needed. Workspace trust
87
+ follows Claude's
53
88
  [documented project settings](https://code.claude.com/docs/en/permissions#project-allow-rules-and-workspace-trust).
54
89
 
55
90
  ## Correct Code registration
56
91
 
57
92
  Claude's user-level `codex-bridge` must run under the actual Code session. A
58
- generic shared Desktop process cannot establish that caller's ancestry. The
59
- Code migration helper previews changes by default; it is not a first-install
60
- wizard. With both clients stopped, `--apply --clients-stopped` backs up and
61
- migrates an existing supervised entry. `--check` diagnoses shared/duplicate
62
- entries and policy errors. Customized entries are left for review. Keep an
63
- external configuration manager, such as CC Switch, consistent with the selected
64
- entry so it does not restore an obsolete copy later.
93
+ generic shared Desktop process cannot establish that caller's ancestry.
94
+ Automatic setup creates or updates the supervised Code entry and safely
95
+ renames a recognized shared entry to `codex-bridge-desktop`. Conflicting or
96
+ unrecognized entries are reported without overwriting them; custom project
97
+ overrides are preserved and reported.
98
+
99
+ For selective installation, `codex-bridge-code-install --install` creates a
100
+ missing Code entry or updates a recognized one. `--install --dry-run` previews
101
+ the change. The complete `codex-bridge-setup` command also handles the other
102
+ registrations and prerequisites. Neither path copies permissions or login
103
+ credentials from another client.
104
+
105
+ The helper's existing policy migration remains an explicit operation and
106
+ previews changes by default. After initializing the desired policy and stopping
107
+ Claude and any configuration manager, run:
108
+
109
+ ```sh
110
+ codex-bridge-code-install --policy /absolute/path/projects.json
111
+ codex-bridge-code-install --policy /absolute/path/projects.json --apply --clients-stopped
112
+ codex-bridge-code-install --check
113
+ ```
114
+
115
+ Migration backs up and updates an existing supervised entry. This helper's
116
+ `--check` diagnoses the optional shared-policy arrangement, including shared or
117
+ duplicate entries; use `codex-bridge-setup --check` for the general installation
118
+ check. Keep CC Switch or another external configuration manager consistent
119
+ with the selected entry so it does not restore an obsolete copy later.
65
120
 
66
121
  Reload the affected client after changing MCP registration. Merely refreshing
67
122
  the conversation did not reload the Code process in the measured Windows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhspark/codex-mcp-bridge",
3
- "version": "1.24.1",
3
+ "version": "1.25.1",
4
4
  "description": "Connect Claude, Codex, and Antigravity through MCP, with native Desktop handoffs and bridge-owned Antigravity CLI sessions.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -29,6 +29,7 @@
29
29
  "antigravity-mcp-bridge-install": "scripts/install-antigravity-bridge.mjs",
30
30
  "codex-mcp-bridge-install": "scripts/install-claude-desktop.mjs",
31
31
  "codex-bridge-code-install": "scripts/install-claude-code.mjs",
32
+ "codex-bridge-setup": "scripts/setup.mjs",
32
33
  "bridge-projects": "scripts/bridge-projects.mjs",
33
34
  "claude-mcp-bridge-install": "scripts/install-codex-mcp.mjs",
34
35
  "codex-native-relay": "src/native-relay-launcher.mjs",
@@ -61,6 +62,8 @@
61
62
  "access": "public"
62
63
  },
63
64
  "scripts": {
65
+ "postinstall": "node scripts/setup.mjs --postinstall",
66
+ "setup": "node scripts/setup.mjs",
64
67
  "analytics": "node scripts/collect-repo-analytics.mjs",
65
68
  "analytics:publish": "node scripts/publish-repo-analytics.mjs",
66
69
  "start": "node src/codex-bridge-launcher.mjs",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "codex-mcp-bridge",
4
- "version": "1.24.1",
4
+ "version": "1.25.1",
5
5
  "description": "Connect ChatGPT to your own Codex Desktop projects and conversations.",
6
6
  "author": {
7
7
  "name": "Bui Dang Minh",
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { execFileSync } from "node:child_process";
3
3
  import fs from "node:fs";
4
- import os from "node:os";
5
4
  import path from "node:path";
6
5
  import { fileURLToPath } from "node:url";
7
6
  import { applyStdioMcpRegistration, stdioMcpRegistration } from "../src/codex-mcp-registration.mjs";
8
7
  import { isMainModule, stableInstallPath, stableNodeBin } from "../src/install-paths.mjs";
9
- import { resolveCodexBin, spawnEnv } from "../src/platform.mjs";
8
+ import { homeDir, resolveCodexBin, spawnEnv } from "../src/platform.mjs";
10
9
  import { exitForVersionRequest } from "../src/cli-version.mjs";
11
10
 
12
11
  const NAME = "antigravity-bridge";
@@ -54,12 +53,24 @@ export function validateCodexExecutable(executable, { platform = process.platfor
54
53
  return resolved;
55
54
  }
56
55
 
57
- function ownEntry(entry, expected, label) {
56
+ function ownEntry(entry, expected, label, retarget = false) {
58
57
  if (entry === undefined || entry === null) return;
59
58
  object(entry, label);
60
- if (!Array.isArray(entry.args) || entry.args.length !== 1 || typeof entry.args[0] !== "string" || path.resolve(entry.args[0]) !== path.resolve(expected)) {
59
+ const script = entry.args?.[0];
60
+ if (!Array.isArray(entry.args) || entry.args.length !== 1 || typeof script !== "string") {
61
61
  throw new Error(`${label} is already configured with a different entrypoint; it was not changed`);
62
62
  }
63
+ if (path.resolve(script) === path.resolve(expected)) return;
64
+ const source = path.dirname(script);
65
+ if (!retarget || !path.isAbsolute(script) || script.includes("\0") || path.basename(script) !== path.basename(expected)
66
+ || path.basename(source) !== "src" || path.basename(path.dirname(source)).toLowerCase() !== "codex-mcp-bridge") {
67
+ throw new Error(`${label} is already configured with a different entrypoint; it was not changed`);
68
+ }
69
+ const command = entry.command;
70
+ if (typeof command !== "string" || command.includes("\0") || !/^(?:node|node\.exe)$/i.test(path.basename(command))
71
+ || !path.isAbsolute(command) && command !== path.basename(command)) {
72
+ throw new Error(`${label} is already configured with a different launcher; it was not changed`);
73
+ }
63
74
  }
64
75
 
65
76
  function changed(original, value) {
@@ -68,28 +79,29 @@ function changed(original, value) {
68
79
  return { ...original, next: text };
69
80
  }
70
81
 
71
- export function planAntigravityInstallation({ home = os.homedir(), root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."), node = stableNodeBin(), targets = ["codex", "claude", "desktop"], remove = false, codexExisting = null } = {}) {
72
- if (!path.isAbsolute(home) || !path.isAbsolute(root) || !path.isAbsolute(node)) throw new Error("Installer paths must be absolute");
82
+ export function planAntigravityInstallation({ home = homeDir(), codeConfigDir = process.env.CLAUDE_CONFIG_DIR || home, root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."), node = stableNodeBin(), targets = ["codex", "claude", "desktop"], remove = false, setup = false, codexExisting = null } = {}) {
83
+ if (!path.isAbsolute(home) || !path.isAbsolute(codeConfigDir) || !path.isAbsolute(root) || !path.isAbsolute(node)) throw new Error("Installer paths must be absolute");
73
84
  if (!targets.length || targets.some((target) => !["codex", "claude", "desktop"].includes(target))) throw new Error("Unknown installation target");
74
85
  const entry = path.join(root, "src", "antigravity-bridge.mjs");
75
86
  const sidecarEntry = path.join(root, "src", "antigravity-sidecar.mjs");
76
87
  const outboundEntry = path.join(root, "src", "antigravity-outbound-bridge.mjs");
77
88
  const edits = [];
78
89
  const notices = [];
90
+ const retarget = setup && !remove;
79
91
  let codex = null;
80
92
  if (targets.includes("codex")) {
81
93
  if (codexExisting && codexExisting.transport?.type !== "stdio") throw new Error("The existing Antigravity MCP transport is not stdio");
82
- ownEntry(codexExisting?.transport, entry, "Codex Antigravity bridge");
94
+ ownEntry(codexExisting?.transport, entry, "Codex Antigravity bridge", retarget);
83
95
  const existingCaller = codexExisting?.transport?.env?.ANTIGRAVITY_BRIDGE_CALLER;
84
96
  if (existingCaller !== undefined && existingCaller !== "codex") throw new Error("The existing Codex bridge has a conflicting caller identity");
85
97
  codex = remove ? { remove: Boolean(codexExisting) } : stdioMcpRegistration({ name: NAME, existing: codexExisting, node, entry, envOverrides: { ANTIGRAVITY_BRIDGE_CALLER: "codex" } });
86
98
  }
87
99
  if (targets.includes("claude")) {
88
- const original = snapshot(path.join(home, ".claude.json"));
100
+ const original = snapshot(path.join(codeConfigDir, ".claude.json"));
89
101
  const value = structuredClone(original.value);
90
102
  if (value.mcpServers !== undefined) object(value.mcpServers, "Claude mcpServers");
91
103
  const existing = value.mcpServers?.[NAME];
92
- ownEntry(existing, entry, "Claude Antigravity bridge");
104
+ ownEntry(existing, entry, "Claude Antigravity bridge", retarget);
93
105
  if (existing?.type !== undefined && existing.type !== "stdio") throw new Error("The existing Claude bridge transport is not stdio");
94
106
  if (existing?.env !== undefined) object(existing.env, "Claude bridge environment");
95
107
  if (existing?.env?.ANTIGRAVITY_BRIDGE_CALLER !== undefined && existing.env.ANTIGRAVITY_BRIDGE_CALLER !== "claude") throw new Error("The existing Claude bridge has a conflicting caller identity");
@@ -107,7 +119,7 @@ export function planAntigravityInstallation({ home = os.homedir(), root = path.r
107
119
  const mcp = structuredClone(originalMcp.value);
108
120
  if (mcp.mcpServers !== undefined) object(mcp.mcpServers, "Antigravity mcpServers");
109
121
  const outbound = mcp.mcpServers?.[OUTBOUND];
110
- ownEntry(outbound, outboundEntry, "Antigravity outbound bridge");
122
+ ownEntry(outbound, outboundEntry, "Antigravity outbound bridge", retarget);
111
123
  if (outbound?.type !== undefined && outbound.type !== "stdio" || outbound?.url !== undefined || outbound?.serverUrl !== undefined || outbound?.httpUrl !== undefined) throw new Error("The existing Antigravity outbound bridge transport is not stdio");
112
124
  if (outbound?.env !== undefined) object(outbound.env, "Antigravity outbound bridge environment");
113
125
  if (Object.keys(outbound?.env ?? {}).some((name) => /^(?:CLAUDE|CODEX_|ANTIGRAVITY_BRIDGE_CALLER$)/i.test(name))) throw new Error("The existing Antigravity outbound bridge contains a foreign caller environment; review it before installation");
@@ -122,7 +134,7 @@ export function planAntigravityInstallation({ home = os.homedir(), root = path.r
122
134
  const mcpEdit = changed(originalMcp, mcp);
123
135
  if (mcpEdit) edits.push(mcpEdit);
124
136
  const originalSidecar = snapshot(path.join(configRoot, "sidecars", SIDECAR, "sidecar.json"));
125
- if (originalSidecar.text !== null) ownEntry(originalSidecar.value, sidecarEntry, "Antigravity sidecar");
137
+ if (originalSidecar.text !== null) ownEntry(originalSidecar.value, sidecarEntry, "Antigravity sidecar", retarget);
126
138
  const originalConfig = snapshot(path.join(configRoot, "config.json"));
127
139
  const config = structuredClone(originalConfig.value);
128
140
  if (config.sidecars !== undefined) object(config.sidecars, "Antigravity sidecars");
@@ -131,10 +143,12 @@ export function planAntigravityInstallation({ home = os.homedir(), root = path.r
131
143
  let definition = null;
132
144
  if (remove) { if (config.sidecars) delete config.sidecars[SIDECAR]; }
133
145
  else {
134
- definition = { ...originalSidecar.value, command: node, args: [sidecarEntry], restart_policy: originalSidecar.value.restart_policy ?? "on-failure", display_name: "Codex / Claude Antigravity Bridge" };
146
+ definition = { ...originalSidecar.value, command: node, args: [sidecarEntry], restart_policy: originalSidecar.value.restart_policy ?? "on-failure", display_name: setup ? originalSidecar.value.display_name ?? "Codex / Claude Antigravity Bridge" : "Codex / Claude Antigravity Bridge" };
135
147
  if (definition.builtin !== undefined) throw new Error("A builtin Antigravity sidecar cannot be replaced");
136
148
  config.sidecars ??= {};
137
- config.sidecars[SIDECAR] = { ...config.sidecars[SIDECAR], enabled: true };
149
+ const enabled = setup ? config.sidecars[SIDECAR]?.enabled ?? true : true;
150
+ config.sidecars[SIDECAR] = { ...config.sidecars[SIDECAR], enabled };
151
+ if (enabled === false) notices.push("The existing Antigravity bridge sidecar is disabled; automatic setup preserved that choice.");
138
152
  }
139
153
  const sidecarEdit = changed(originalSidecar, definition);
140
154
  const configEdit = changed(originalConfig, config);
@@ -179,19 +193,19 @@ export function applyJsonEdits(edits) {
179
193
  }
180
194
 
181
195
  export function installerArguments(args) {
182
- const allowed = new Set(["--codex", "--claude", "--desktop", "--all", "--remove", "--dry-run", "--help"]);
196
+ const allowed = new Set(["--codex", "--claude", "--desktop", "--all", "--remove", "--dry-run", "--setup", "--help"]);
183
197
  if (args.some((arg) => !allowed.has(arg))) throw new Error("Unknown option; use --help");
184
198
  const selected = ["codex", "claude", "desktop"].filter((target) => args.includes(`--${target}`));
185
- return { targets: args.includes("--all") || !selected.length ? ["codex", "claude", "desktop"] : selected, remove: args.includes("--remove"), dryRun: args.includes("--dry-run"), help: args.includes("--help") };
199
+ return { targets: args.includes("--all") || !selected.length ? ["codex", "claude", "desktop"] : selected, remove: args.includes("--remove"), dryRun: args.includes("--dry-run"), setup: args.includes("--setup"), help: args.includes("--help") };
186
200
  }
187
201
 
188
202
  export function runAntigravityInstaller(args = process.argv.slice(2)) {
189
203
  const options = installerArguments(args);
190
204
  if (options.help) {
191
- console.log("Usage: antigravity-mcp-bridge-install [--all|--codex|--claude|--desktop] [--remove] [--dry-run]");
205
+ console.log("Usage: antigravity-mcp-bridge-install [--all|--codex|--claude|--desktop] [--remove] [--dry-run] [--setup]");
192
206
  return;
193
207
  }
194
- const home = os.homedir();
208
+ const home = homeDir();
195
209
  const root = stableInstallPath(path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."));
196
210
  const node = stableNodeBin();
197
211
  let run;