@bingzi-233/ssh-mcp 1.0.0 → 1.0.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.
- package/README.md +1 -1
- package/dist/config.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ claude mcp add ssh -- node /绝对路径/ssh-mcp/dist/index.js
|
|
|
54
54
|
|
|
55
55
|
## 配置服务器
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
默认从**运行目录下的 `./servers.json`** 读取(即 Claude 启动 MCP 服务器时所在的工作目录,通常是你当前的项目根目录)。也可用环境变量 `SSH_MCP_CONFIG` 指定任意路径。参考 `servers.example.json`:
|
|
58
58
|
|
|
59
59
|
```json
|
|
60
60
|
{
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
4
|
/** 把开头的 ~ 展开成用户主目录。 */
|
|
5
5
|
export function expandHome(p) {
|
|
6
6
|
if (p === "~")
|
|
@@ -9,10 +9,10 @@ export function expandHome(p) {
|
|
|
9
9
|
return join(homedir(), p.slice(2));
|
|
10
10
|
return p;
|
|
11
11
|
}
|
|
12
|
-
/** 配置文件路径:优先环境变量 SSH_MCP_CONFIG
|
|
12
|
+
/** 配置文件路径:优先环境变量 SSH_MCP_CONFIG,否则取运行目录下的 ./servers.json。 */
|
|
13
13
|
export function configPath() {
|
|
14
14
|
const fromEnv = process.env.SSH_MCP_CONFIG;
|
|
15
|
-
return fromEnv ? expandHome(fromEnv) :
|
|
15
|
+
return fromEnv ? expandHome(fromEnv) : resolve(process.cwd(), "servers.json");
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* 每次调用都从磁盘重新读取配置——配置文件就是唯一事实来源。
|