@hailer/mcp 1.0.27 → 1.0.29
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/dist/cli.js +25 -49
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -47,62 +47,38 @@ const os = __importStar(require("os"));
|
|
|
47
47
|
const readline = __importStar(require("readline"));
|
|
48
48
|
const CLAUDE_CONFIG_DIR = path.join(os.homedir(), 'Library', 'Application Support', 'Claude');
|
|
49
49
|
const CLAUDE_CONFIG_FILE = path.join(CLAUDE_CONFIG_DIR, 'claude_desktop_config.json');
|
|
50
|
+
/**
|
|
51
|
+
* Muted output stream for password input
|
|
52
|
+
*/
|
|
53
|
+
class MutedStream {
|
|
54
|
+
writable = true;
|
|
55
|
+
muted = false;
|
|
56
|
+
write() { return true; }
|
|
57
|
+
end() { }
|
|
58
|
+
on() { return this; }
|
|
59
|
+
once() { return this; }
|
|
60
|
+
emit() { return true; }
|
|
61
|
+
removeListener() { return this; }
|
|
62
|
+
}
|
|
50
63
|
/**
|
|
51
64
|
* Prompt user for input
|
|
52
65
|
*/
|
|
53
66
|
function prompt(question, isPassword = false) {
|
|
54
67
|
return new Promise((resolve) => {
|
|
55
68
|
if (isPassword) {
|
|
56
|
-
//
|
|
69
|
+
// Use muted stream to hide password - most reliable cross-terminal approach
|
|
70
|
+
const mutedOutput = new MutedStream();
|
|
71
|
+
const rl = readline.createInterface({
|
|
72
|
+
input: process.stdin,
|
|
73
|
+
output: mutedOutput,
|
|
74
|
+
terminal: true,
|
|
75
|
+
});
|
|
57
76
|
process.stdout.write(question);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
rl.question('', (answer) => {
|
|
64
|
-
rl.close();
|
|
65
|
-
resolve(answer.trim());
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
stdin.setRawMode(true);
|
|
70
|
-
stdin.resume();
|
|
71
|
-
stdin.setEncoding('utf8');
|
|
72
|
-
const onData = (key) => {
|
|
73
|
-
// Handle each character
|
|
74
|
-
for (const char of key) {
|
|
75
|
-
const code = char.charCodeAt(0);
|
|
76
|
-
if (code === 13 || code === 10) {
|
|
77
|
-
// Enter - done
|
|
78
|
-
stdin.setRawMode(false);
|
|
79
|
-
stdin.pause();
|
|
80
|
-
stdin.removeListener('data', onData);
|
|
81
|
-
process.stdout.write('\n');
|
|
82
|
-
resolve(password);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
else if (code === 3) {
|
|
86
|
-
// Ctrl+C - exit
|
|
87
|
-
stdin.setRawMode(false);
|
|
88
|
-
process.stdout.write('\n');
|
|
89
|
-
process.exit(0);
|
|
90
|
-
}
|
|
91
|
-
else if (code === 127 || code === 8) {
|
|
92
|
-
// Backspace
|
|
93
|
-
if (password.length > 0) {
|
|
94
|
-
password = password.slice(0, -1);
|
|
95
|
-
process.stdout.write('\b \b');
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else if (code >= 32) {
|
|
99
|
-
// Printable character
|
|
100
|
-
password += char;
|
|
101
|
-
process.stdout.write('*');
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
stdin.on('data', onData);
|
|
77
|
+
rl.question('', (answer) => {
|
|
78
|
+
rl.close();
|
|
79
|
+
process.stdout.write('\n');
|
|
80
|
+
resolve(answer);
|
|
81
|
+
});
|
|
106
82
|
}
|
|
107
83
|
else {
|
|
108
84
|
const rl = readline.createInterface({
|