mcp-ssh-manager 3.2.1 → 3.2.2
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/cli/lib/config.sh +34 -11
- package/package.json +3 -2
- package/src/index.js +6 -4
package/cli/lib/config.sh
CHANGED
|
@@ -5,20 +5,39 @@
|
|
|
5
5
|
export SSH_MANAGER_HOME="${SSH_MANAGER_HOME:-$HOME/.ssh-manager}"
|
|
6
6
|
export SSH_MANAGER_CONFIG="$SSH_MANAGER_HOME/config.json"
|
|
7
7
|
|
|
8
|
-
# Resolve .env path
|
|
8
|
+
# Resolve .env path with fallback chain (consistent with src/index.js):
|
|
9
|
+
# 1. SSH_MANAGER_ENV env var (explicit override)
|
|
10
|
+
# 2. ~/.ssh-manager/.env (user config directory — preferred for global installs)
|
|
11
|
+
# 3. $PWD/.env (current working directory)
|
|
12
|
+
# 4. ~/.env (home directory)
|
|
13
|
+
# 5. <project-root>/.env (backward compat for local/dev installs)
|
|
9
14
|
if [ -z "$SSH_MANAGER_ENV" ]; then
|
|
10
|
-
if [ -
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
if [ -f "$SSH_MANAGER_HOME/.env" ]; then
|
|
16
|
+
SSH_MANAGER_ENV="$SSH_MANAGER_HOME/.env"
|
|
17
|
+
elif [ -f "$PWD/.env" ]; then
|
|
18
|
+
SSH_MANAGER_ENV="$PWD/.env"
|
|
19
|
+
elif [ -f "$HOME/.env" ]; then
|
|
20
|
+
SSH_MANAGER_ENV="$HOME/.env"
|
|
13
21
|
else
|
|
14
|
-
#
|
|
15
|
-
if [ -
|
|
16
|
-
|
|
22
|
+
# Resolve project root from script location (works for local installs)
|
|
23
|
+
if [ -n "$SCRIPT_DIR" ]; then
|
|
24
|
+
_PROJECT_ENV="$(dirname "$SCRIPT_DIR")/.env"
|
|
17
25
|
else
|
|
18
|
-
|
|
26
|
+
if [ -L "$0" ]; then
|
|
27
|
+
_REAL_PATH="$(readlink -f "$0" 2>/dev/null || readlink "$0")"
|
|
28
|
+
else
|
|
29
|
+
_REAL_PATH="$0"
|
|
30
|
+
fi
|
|
31
|
+
_REAL_DIR="$(cd "$(dirname "$_REAL_PATH")" && pwd)"
|
|
32
|
+
_PROJECT_ENV="$(dirname "$(dirname "$_REAL_DIR")")/.env"
|
|
19
33
|
fi
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
if [ -f "$_PROJECT_ENV" ]; then
|
|
35
|
+
SSH_MANAGER_ENV="$_PROJECT_ENV"
|
|
36
|
+
else
|
|
37
|
+
# Default to user config directory (will be created on first server add)
|
|
38
|
+
SSH_MANAGER_ENV="$SSH_MANAGER_HOME/.env"
|
|
39
|
+
fi
|
|
40
|
+
unset _PROJECT_ENV _REAL_PATH _REAL_DIR
|
|
22
41
|
fi
|
|
23
42
|
export SSH_MANAGER_ENV
|
|
24
43
|
fi
|
|
@@ -154,9 +173,13 @@ add_server_to_env() {
|
|
|
154
173
|
return 1
|
|
155
174
|
fi
|
|
156
175
|
|
|
176
|
+
# Ensure parent directory and .env file exist
|
|
177
|
+
mkdir -p "$(dirname "$SSH_MANAGER_ENV")"
|
|
178
|
+
touch "$SSH_MANAGER_ENV"
|
|
179
|
+
|
|
157
180
|
# Backup .env file
|
|
158
181
|
cp "$SSH_MANAGER_ENV" "$SSH_MANAGER_ENV.bak"
|
|
159
|
-
|
|
182
|
+
|
|
160
183
|
# Add server configuration
|
|
161
184
|
{
|
|
162
185
|
echo ""
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-ssh-manager",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "MCP SSH Manager: Model Context Protocol server for SSH remote server management. Control SSH connections from Claude Code and OpenAI Codex - execute commands, transfer files, database operations, backups, health monitoring, and DevOps automation. NEW: Tool activation system reduces context usage by 92%",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mcp-ssh-manager": "src/index.js"
|
|
7
|
+
"mcp-ssh-manager": "src/index.js",
|
|
8
|
+
"ssh-manager": "cli/ssh-manager"
|
|
8
9
|
},
|
|
9
10
|
"type": "module",
|
|
10
11
|
"scripts": {
|
package/src/index.js
CHANGED
|
@@ -166,14 +166,17 @@ const __dirname = path.dirname(__filename);
|
|
|
166
166
|
|
|
167
167
|
// Resolve .env file path with fallback chain:
|
|
168
168
|
// 1. SSH_ENV_PATH env var (explicit override)
|
|
169
|
-
// 2.
|
|
170
|
-
// 3.
|
|
171
|
-
// 4.
|
|
169
|
+
// 2. ~/.ssh-manager/.env (user config dir — where ssh-manager CLI writes)
|
|
170
|
+
// 3. process.cwd()/.env (standard working directory)
|
|
171
|
+
// 4. ~/.env (home directory)
|
|
172
|
+
// 5. __dirname/../.env (backward compat for local installs)
|
|
172
173
|
function resolveEnvFilePath() {
|
|
173
174
|
if (process.env.SSH_ENV_PATH) {
|
|
174
175
|
return process.env.SSH_ENV_PATH;
|
|
175
176
|
}
|
|
177
|
+
const sshManagerHome = process.env.SSH_MANAGER_HOME || path.join(os.homedir(), '.ssh-manager');
|
|
176
178
|
const candidates = [
|
|
179
|
+
path.join(sshManagerHome, '.env'),
|
|
177
180
|
path.join(process.cwd(), '.env'),
|
|
178
181
|
path.join(os.homedir(), '.env'),
|
|
179
182
|
path.join(__dirname, '..', '.env'),
|
|
@@ -183,7 +186,6 @@ function resolveEnvFilePath() {
|
|
|
183
186
|
return candidate;
|
|
184
187
|
}
|
|
185
188
|
}
|
|
186
|
-
// Default to cwd (consistent with config-loader.js)
|
|
187
189
|
return path.join(process.cwd(), '.env');
|
|
188
190
|
}
|
|
189
191
|
|