@znmin/claude-remote-cli 0.3.2 → 0.4.0

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.
package/README.md CHANGED
@@ -25,10 +25,10 @@ npm install -g git+https://github.com/znmin/claude-remote-cli.git
25
25
  也可以从已下载的分发包安装:
26
26
 
27
27
  ```bash
28
- npm install -g ./znmin-claude-remote-cli-0.3.2.tgz
28
+ npm install -g ./znmin-claude-remote-cli-0.4.0.tgz
29
29
  ```
30
30
 
31
- 若系统 npm 全局目录不可写,可使用 `npm install -g --prefix "$HOME/.local" ./znmin-claude-remote-cli-0.3.2.tgz`,并确保 `~/.local/bin` 在 PATH 中;卸载时也使用相同的 `--prefix`。
31
+ 若系统 npm 全局目录不可写,可使用 `npm install -g --prefix "$HOME/.local" ./znmin-claude-remote-cli-0.4.0.tgz`,并确保 `~/.local/bin` 在 PATH 中;卸载时也使用相同的 `--prefix`。
32
32
 
33
33
  npm 中不带作用域的 `claude-remote-cli` 属于其他项目。本项目使用独立的 `@znmin/claude-remote-cli` 作用域包名;请安装完整包名,或使用上述 GitHub 地址及本项目分发的 `.tgz` 文件。
34
34
 
@@ -179,6 +179,45 @@ Linux 上仍需安装 Playwright 所需的系统共享库,有窗口模式还
179
179
 
180
180
  这是工具路由约束,不是对 Claude Code 主进程的系统隔离。认证、会话和日志仍在服务器,管理员管理策略继续生效。文件内容、命令结果和截图会经过服务器交给模型,不整体同步不代表数据不离开本机。
181
181
 
182
+ ### 项目 MCP 与内网 MCP(0.4.0)
183
+
184
+ 本地模式下,项目或用户自己配置的 MCP 由本机启动或从本机连接,再通过同一条 SSH 反向隧道提供给服务器上的 Claude。因此服务器不需要访问内网,也不需要安装这些 MCP 的依赖:
185
+
186
+ ```
187
+ 服务器 Claude ──> 127.0.0.1:隧道端口 ──SSH -R──> 本机网关 ─┬─ /mcp 内置本地工具
188
+ ├─ /mcp/jira 本机连接内网 http://10.x.x.x/mcp
189
+ └─ /mcp/db 本机启动的 stdio 程序
190
+ ```
191
+
192
+ 配置来源与 Claude Code 相同,同名时优先级为 local > project > user:
193
+
194
+ | 范围 | 存储位置 | 生效范围 |
195
+ | --- | --- | --- |
196
+ | `local`(默认) | `~/.config/claude-remote/mcp.json`,按项目目录区分 | 仅当前项目,仅本机 |
197
+ | `project` | 项目根目录 `.mcp.json`,可提交到仓库 | 当前项目 |
198
+ | `user` | `~/.config/claude-remote/mcp.json` | 本机所有项目 |
199
+
200
+ ```bash
201
+ # stdio:命令在本机运行,工作目录为项目根目录,继承本机终端环境
202
+ claude-remote mcp add db -e DB_URL='${DB_URL}' -- npx -y some-db-mcp
203
+ # HTTP/SSE:从本机连接内网地址
204
+ claude-remote mcp add -t http -s project -H 'Authorization: Bearer ${JIRA_TOKEN}' jira https://jira.corp.local/mcp
205
+ claude-remote mcp add-json -s user docs '{"type":"sse","url":"http://10.0.0.8/sse"}'
206
+ claude-remote mcp list
207
+ claude-remote mcp get jira
208
+ claude-remote mcp remove jira
209
+ claude-remote mcp reset-project-choices # 重新询问是否启用 .mcp.json 中的 MCP
210
+ ```
211
+
212
+ 默认模式为 `local` 时,`claude mcp …` 等同于 `claude-remote mcp …`;服务器模式下 `claude mcp` 仍管理服务器上的配置。
213
+
214
+ - **服务名称不变**:服务器上看到的工具名仍是 `mcp__jira__search` 这种形式,项目文档和权限规则无需修改。MCP 的 tools、resources 和 prompts 都会转发。
215
+ - **凭据不离开本机**:`${VAR}` 和 `${VAR:-默认值}` 在本机启动时用本机环境变量展开。内网地址、请求头和环境变量只在本机网关中使用,服务器上的临时配置只包含 `127.0.0.1` 隧道地址和本次会话的随机令牌。
216
+ - **项目配置需要确认**:`.mcp.json` 可以在本机运行任意命令,首次启动时会逐个显示命令或 URL,询问是否启用。选择按项目记住,配置内容变化后重新询问。非交互运行时,未确认的 MCP 会被跳过并给出提示。通过 `claude-remote mcp add -s project` 添加的条目视为本机已确认。
217
+ - **连接失败不影响启动**:每个 MCP 最多等待 30 秒,失败时打印原因(stdio 程序会附带最后几行错误输出),本次会话不提供该 MCP。stdio 程序的错误输出不会显示在终端上,避免打乱远程界面,`CLAUDE_REMOTE_DEBUG=1` 时才显示。stdio 程序在会话中意外退出时,下次调用会自动重启。退出时停止所有 MCP 程序(Windows 上包括 `npx` 等通过 `cmd.exe` 启动的整个进程树)。
218
+ - **结果大小有上限**:与内置工具相同,单次结果超过约 4 万字符时会截断较长的文本,图片等二进制内容保持不变。为此不向服务器提供工具的 `outputSchema`。单次调用最长 3 分钟,MCP 发送进度通知时会重新计时。
219
+ - **暂不支持**:需要 OAuth 登录或 `headersHelper` 的 MCP,以及 `ws` 类型;请改用固定请求头(可引用本机环境变量)。MCP 在会话中发送的列表变更通知不会转发,修改配置后请重新启动 `claude`。服务器模式(`remote`)仍由服务器自己读取同步过去的 `.mcp.json`。
220
+
182
221
  ## 同步管理(仅服务器模式)
183
222
 
184
223
  ```bash
@@ -257,7 +296,7 @@ npm run test:windows # Windows 上运行的客户端测试(CI 在 windows-la
257
296
  CLAUDE_REMOTE_INTEGRATION=1 CLAUDE_REMOTE_BROWSER_TEST=1 npm test
258
297
 
259
298
  npm pack
260
- npm install -g ./znmin-claude-remote-cli-0.3.2.tgz
299
+ npm install -g ./znmin-claude-remote-cli-0.4.0.tgz
261
300
 
262
301
  # 确定包名、版本和使用条款后,使用有发布权限的 npm 账号发布
263
302
  npm login
@@ -1,16 +1,16 @@
1
- # Third-party components
2
-
3
- The npm package contains the JavaScript CLI source and depends on `proper-lockfile` (MIT), the official `@modelcontextprotocol/sdk` (MIT), `zod` (MIT), `playwright` (Apache-2.0), and their npm-managed dependencies. Their license files are included in their respective npm packages.
4
-
5
- Playwright downloads its matching Chromium/browser components on first local-mode preparation. These components remain subject to their upstream licenses. A separate local browser context is used; this wrapper does not include the user's browser profile.
6
-
7
- Mutagen binaries are **not bundled in this npm package**. At setup/first use, the tool can reuse an existing Mutagen 0.18.1 installation, or download the matching v0.18.1 archive from the official release repository. SHA-256 values are pinned in `src/installer.js` from the official release's `SHA256SUMS` file.
8
-
9
- - Mutagen project: https://github.com/mutagen-io/mutagen
10
- - Pinned release: https://github.com/mutagen-io/mutagen/releases/tag/v0.18.1
11
- - Release checksums: https://github.com/mutagen-io/mutagen/releases/download/v0.18.1/SHA256SUMS
12
- - Upstream license: https://github.com/mutagen-io/mutagen/blob/v0.18.1/LICENSE
13
-
14
- The upstream license states that, from v0.17 onward, official release builds include SSPL-licensed code by default; other source is generally MIT or as indicated upstream. Mutagen and the automatically deployed remote agents remain subject to the upstream terms independently of this JavaScript wrapper.
15
-
16
- Claude Code is a separate product installed and authenticated on the user's server. This project does not bundle Claude Code and is not affiliated with or endorsed by Anthropic.
1
+ # Third-party components
2
+
3
+ The npm package contains the JavaScript CLI source and depends on `proper-lockfile` (MIT), the official `@modelcontextprotocol/sdk` (MIT), `zod` (MIT), `playwright` (Apache-2.0), and their npm-managed dependencies. Their license files are included in their respective npm packages.
4
+
5
+ Playwright downloads its matching Chromium/browser components on first local-mode preparation. These components remain subject to their upstream licenses. A separate local browser context is used; this wrapper does not include the user's browser profile.
6
+
7
+ Mutagen binaries are **not bundled in this npm package**. At setup/first use, the tool can reuse an existing Mutagen 0.18.1 installation, or download the matching v0.18.1 archive from the official release repository. SHA-256 values are pinned in `src/installer.js` from the official release's `SHA256SUMS` file.
8
+
9
+ - Mutagen project: https://github.com/mutagen-io/mutagen
10
+ - Pinned release: https://github.com/mutagen-io/mutagen/releases/tag/v0.18.1
11
+ - Release checksums: https://github.com/mutagen-io/mutagen/releases/download/v0.18.1/SHA256SUMS
12
+ - Upstream license: https://github.com/mutagen-io/mutagen/blob/v0.18.1/LICENSE
13
+
14
+ The upstream license states that, from v0.17 onward, official release builds include SSPL-licensed code by default; other source is generally MIT or as indicated upstream. Mutagen and the automatically deployed remote agents remain subject to the upstream terms independently of this JavaScript wrapper.
15
+
16
+ Claude Code is a separate product installed and authenticated on the user's server. This project does not bundle Claude Code and is not affiliated with or endorsed by Anthropic.
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
- import { entry } from '../src/cli.js';
3
- await entry(false);
1
+ #!/usr/bin/env node
2
+ import { entry } from '../src/cli.js';
3
+ await entry(false);
package/bin/claude.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
- import { entry } from '../src/cli.js';
3
- await entry(true);
1
+ #!/usr/bin/env node
2
+ import { entry } from '../src/cli.js';
3
+ await entry(true);
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
- {
2
- "name": "@znmin/claude-remote-cli",
3
- "version": "0.3.2",
4
- "description": "Run Claude Code on an SSH server from macOS, Linux or Windows with local filesystem, terminal and browser tools, or remote bidirectional sync",
5
- "type": "module",
6
- "license": "UNLICENSED",
7
- "engines": {
8
- "node": ">=20.11"
9
- },
10
- "os": [
11
- "darwin",
12
- "linux",
13
- "win32"
14
- ],
15
- "cpu": [
16
- "x64",
17
- "arm64"
18
- ],
19
- "bin": {
20
- "claude": "bin/claude.js",
21
- "claude-remote": "bin/claude-remote.js"
22
- },
23
- "files": [
24
- "bin/",
25
- "src/",
26
- "scripts/postinstall.js",
27
- "README.md",
28
- "THIRD_PARTY_NOTICES.md"
29
- ],
30
- "scripts": {
31
- "postinstall": "node scripts/postinstall.js",
32
- "lint": "eslint .",
33
- "test": "node --test test/*.test.js",
34
- "test:windows": "node --test test/windows.test.js test/local-tools.test.js test/browser-choice.test.js",
35
- "prepublishOnly": "npm run lint && npm test"
36
- },
37
- "keywords": [
38
- "claude",
39
- "ssh",
40
- "remote",
41
- "cli",
42
- "sync"
43
- ],
44
- "publishConfig": {
45
- "access": "public",
46
- "registry": "https://registry.npmjs.org/"
47
- },
48
- "dependencies": {
49
- "@modelcontextprotocol/sdk": "1.32.2",
50
- "playwright": "1.64.1",
51
- "proper-lockfile": "4.1.2",
52
- "zod": "4.6.7"
53
- },
54
- "repository": {
55
- "type": "git",
56
- "url": "git+https://github.com/znmin/claude-remote-cli.git"
57
- },
58
- "homepage": "https://github.com/znmin/claude-remote-cli#readme",
59
- "bugs": {
60
- "url": "https://github.com/znmin/claude-remote-cli/issues"
61
- },
62
- "devDependencies": {
63
- "@eslint/js": "9.39.5",
64
- "eslint": "9.39.5",
65
- "globals": "17.14.0"
66
- }
67
- }
1
+ {
2
+ "name": "@znmin/claude-remote-cli",
3
+ "version": "0.4.0",
4
+ "description": "Run Claude Code on an SSH server from macOS, Linux or Windows with local filesystem, terminal and browser tools, or remote bidirectional sync",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=20.11"
9
+ },
10
+ "os": [
11
+ "darwin",
12
+ "linux",
13
+ "win32"
14
+ ],
15
+ "cpu": [
16
+ "x64",
17
+ "arm64"
18
+ ],
19
+ "bin": {
20
+ "claude": "bin/claude.js",
21
+ "claude-remote": "bin/claude-remote.js"
22
+ },
23
+ "files": [
24
+ "bin/",
25
+ "src/",
26
+ "scripts/postinstall.js",
27
+ "README.md",
28
+ "THIRD_PARTY_NOTICES.md"
29
+ ],
30
+ "scripts": {
31
+ "postinstall": "node scripts/postinstall.js",
32
+ "lint": "eslint .",
33
+ "test": "node --test test/*.test.js",
34
+ "test:windows": "node --test test/windows.test.js test/local-tools.test.js test/browser-choice.test.js test/mcp-proxy.test.js",
35
+ "prepublishOnly": "npm run lint && npm test"
36
+ },
37
+ "keywords": [
38
+ "claude",
39
+ "ssh",
40
+ "remote",
41
+ "cli",
42
+ "sync"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "registry": "https://registry.npmjs.org/"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "1.32.2",
50
+ "playwright": "1.64.1",
51
+ "proper-lockfile": "4.1.2",
52
+ "zod": "4.6.7"
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/znmin/claude-remote-cli.git"
57
+ },
58
+ "homepage": "https://github.com/znmin/claude-remote-cli#readme",
59
+ "bugs": {
60
+ "url": "https://github.com/znmin/claude-remote-cli/issues"
61
+ },
62
+ "devDependencies": {
63
+ "@eslint/js": "9.39.5",
64
+ "eslint": "9.39.5",
65
+ "globals": "17.14.0"
66
+ }
67
+ }
@@ -1,11 +1,11 @@
1
- import { ensureMutagen } from '../src/installer.js';
2
-
3
- if (process.env.CLAUDE_REMOTE_PREPARE_SYNC === '1' && process.env.CLAUDE_REMOTE_SKIP_DOWNLOAD !== '1') {
4
- try {
5
- await ensureMutagen();
6
- } catch (error) {
7
- // Offline installation and npm --ignore-scripts remain supported: retry at first use.
8
- console.warn(`CLI 已安装,同步工具准备未完成:${error.message}\n首次连接时会重试。`);
9
- }
10
- }
11
- console.log('安装完成,运行 claude 开始。');
1
+ import { ensureMutagen } from '../src/installer.js';
2
+
3
+ if (process.env.CLAUDE_REMOTE_PREPARE_SYNC === '1' && process.env.CLAUDE_REMOTE_SKIP_DOWNLOAD !== '1') {
4
+ try {
5
+ await ensureMutagen();
6
+ } catch (error) {
7
+ // Offline installation and npm --ignore-scripts remain supported: retry at first use.
8
+ console.warn(`CLI 已安装,同步工具准备未完成:${error.message}\n首次连接时会重试。`);
9
+ }
10
+ }
11
+ console.log('安装完成,运行 claude 开始。');