@hailer/mcp 1.0.25 → 1.0.27

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.d.ts CHANGED
@@ -1,3 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import './app';
2
+ /**
3
+ * Hailer MCP CLI
4
+ *
5
+ * Commands:
6
+ * setup - Interactive setup for Claude Desktop
7
+ * (none) - Start MCP server (auto-detects stdio/http mode)
8
+ */
9
+ export {};
3
10
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -1,5 +1,281 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ /**
4
+ * Hailer MCP CLI
5
+ *
6
+ * Commands:
7
+ * setup - Interactive setup for Claude Desktop
8
+ * (none) - Start MCP server (auto-detects stdio/http mode)
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
3
43
  Object.defineProperty(exports, "__esModule", { value: true });
4
- require("./app");
44
+ const fs = __importStar(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ const os = __importStar(require("os"));
47
+ const readline = __importStar(require("readline"));
48
+ const CLAUDE_CONFIG_DIR = path.join(os.homedir(), 'Library', 'Application Support', 'Claude');
49
+ const CLAUDE_CONFIG_FILE = path.join(CLAUDE_CONFIG_DIR, 'claude_desktop_config.json');
50
+ /**
51
+ * Prompt user for input
52
+ */
53
+ function prompt(question, isPassword = false) {
54
+ return new Promise((resolve) => {
55
+ if (isPassword) {
56
+ // For password input, use raw mode to hide characters
57
+ process.stdout.write(question);
58
+ let password = '';
59
+ const stdin = process.stdin;
60
+ if (!stdin.isTTY) {
61
+ // Not a TTY, fall back to simple readline (won't hide password)
62
+ const rl = readline.createInterface({ input: stdin, output: process.stdout });
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);
106
+ }
107
+ else {
108
+ const rl = readline.createInterface({
109
+ input: process.stdin,
110
+ output: process.stdout,
111
+ });
112
+ rl.question(question, (answer) => {
113
+ rl.close();
114
+ resolve(answer.trim());
115
+ });
116
+ }
117
+ });
118
+ }
119
+ /**
120
+ * Find Node.js executable path
121
+ */
122
+ function findNodePath() {
123
+ // Use current Node.js path (the one running this script)
124
+ return process.execPath;
125
+ }
126
+ /**
127
+ * Find the hailer-mcp package location
128
+ */
129
+ function findPackagePath() {
130
+ // When installed globally via npm, __dirname will be in the package
131
+ // When running from source, we're in src/
132
+ const distPath = path.resolve(__dirname, '..', 'dist', 'app.js');
133
+ const srcPath = path.resolve(__dirname, 'app.js');
134
+ if (fs.existsSync(distPath)) {
135
+ return distPath;
136
+ }
137
+ if (fs.existsSync(srcPath)) {
138
+ return srcPath;
139
+ }
140
+ // For global npm install, find in node_modules
141
+ try {
142
+ const globalPath = require.resolve('@hailer/mcp/dist/app.js');
143
+ return globalPath;
144
+ }
145
+ catch {
146
+ // Fallback to current directory
147
+ return path.resolve(process.cwd(), 'dist', 'app.js');
148
+ }
149
+ }
150
+ /**
151
+ * Setup command - configure Claude Desktop
152
+ */
153
+ async function runSetup() {
154
+ console.log('\nšŸ”§ Hailer MCP Setup for Claude Desktop\n');
155
+ console.log('This will configure Claude Desktop to use Hailer MCP tools.\n');
156
+ // Check if macOS
157
+ if (process.platform !== 'darwin') {
158
+ console.log('āš ļø This setup is designed for macOS. For other platforms, please configure manually.');
159
+ console.log(' See: https://github.com/hailer/hailer-mcp#claude-desktop-setup\n');
160
+ }
161
+ // Get credentials
162
+ const email = await prompt('Hailer email: ');
163
+ if (!email) {
164
+ console.log('āŒ Email is required');
165
+ process.exit(1);
166
+ }
167
+ const password = await prompt('Hailer password: ', true);
168
+ if (!password) {
169
+ console.log('āŒ Password is required');
170
+ process.exit(1);
171
+ }
172
+ // Get API URL (optional)
173
+ const apiUrlInput = await prompt('Hailer API URL (press Enter for default https://api.hailer.com): ');
174
+ const apiUrl = apiUrlInput || 'https://api.hailer.com';
175
+ // Find paths
176
+ const nodePath = findNodePath();
177
+ const appPath = findPackagePath();
178
+ console.log('\nšŸ“ Detected paths:');
179
+ console.log(` Node.js: ${nodePath}`);
180
+ console.log(` Hailer MCP: ${appPath}`);
181
+ // Check if app.js exists
182
+ if (!fs.existsSync(appPath)) {
183
+ console.log(`\nāŒ Could not find app.js at ${appPath}`);
184
+ console.log(' Please run "npm run build" first if using from source.');
185
+ process.exit(1);
186
+ }
187
+ // Create config
188
+ const hailerConfig = {
189
+ command: nodePath,
190
+ args: [appPath],
191
+ env: {
192
+ MCP_CLIENT_API_KEY: 'claude-desktop',
193
+ HAILER_EMAIL: email,
194
+ HAILER_PASSWORD: password,
195
+ HAILER_API_URL: apiUrl,
196
+ },
197
+ };
198
+ // Read existing config or create new
199
+ let config = { mcpServers: {} };
200
+ if (fs.existsSync(CLAUDE_CONFIG_FILE)) {
201
+ try {
202
+ const existingContent = fs.readFileSync(CLAUDE_CONFIG_FILE, 'utf-8');
203
+ config = JSON.parse(existingContent);
204
+ if (!config.mcpServers) {
205
+ config.mcpServers = {};
206
+ }
207
+ console.log('\nšŸ“„ Found existing Claude Desktop config');
208
+ }
209
+ catch (error) {
210
+ console.log('\nāš ļø Could not parse existing config, creating new one');
211
+ }
212
+ }
213
+ // Check if hailer already configured
214
+ if (config.mcpServers.hailer) {
215
+ const overwrite = await prompt('\nāš ļø Hailer MCP is already configured. Overwrite? (y/N): ');
216
+ if (overwrite.toLowerCase() !== 'y') {
217
+ console.log('Setup cancelled.');
218
+ process.exit(0);
219
+ }
220
+ }
221
+ // Add hailer config
222
+ config.mcpServers.hailer = hailerConfig;
223
+ // Ensure directory exists
224
+ if (!fs.existsSync(CLAUDE_CONFIG_DIR)) {
225
+ fs.mkdirSync(CLAUDE_CONFIG_DIR, { recursive: true });
226
+ console.log(`\nšŸ“ Created directory: ${CLAUDE_CONFIG_DIR}`);
227
+ }
228
+ // Write config
229
+ fs.writeFileSync(CLAUDE_CONFIG_FILE, JSON.stringify(config, null, 2));
230
+ console.log('\nāœ… Configuration saved!');
231
+ console.log(` File: ${CLAUDE_CONFIG_FILE}`);
232
+ console.log('\nšŸš€ Next steps:');
233
+ console.log(' 1. Quit Claude Desktop completely (Cmd+Q)');
234
+ console.log(' 2. Reopen Claude Desktop');
235
+ console.log(' 3. Look for "hailer" in the MCP tools list');
236
+ console.log('\nšŸ’” Tip: Use a dedicated bot account, not your personal account.\n');
237
+ }
238
+ /**
239
+ * Main entry point
240
+ */
241
+ async function main() {
242
+ const args = process.argv.slice(2);
243
+ const command = args[0];
244
+ switch (command) {
245
+ case 'setup':
246
+ await runSetup();
247
+ break;
248
+ case 'help':
249
+ case '--help':
250
+ case '-h':
251
+ console.log(`
252
+ Hailer MCP - Model Context Protocol server for Hailer
253
+
254
+ Usage:
255
+ hailer-mcp Start MCP server (auto-detects stdio/http mode)
256
+ hailer-mcp setup Interactive setup for Claude Desktop
257
+ hailer-mcp help Show this help message
258
+
259
+ Environment variables:
260
+ MCP_CLIENT_API_KEY Client identifier (required for stdio mode)
261
+ HAILER_EMAIL Hailer account email
262
+ HAILER_PASSWORD Hailer account password
263
+ HAILER_API_URL API URL (default: https://api.hailer.com)
264
+ MCP_TRANSPORT Force transport: 'stdio' or 'http'
265
+ ENABLE_NUCLEAR_TOOLS Enable destructive operations (default: false)
266
+
267
+ For more information, see:
268
+ https://github.com/hailer/hailer-mcp
269
+ `);
270
+ break;
271
+ default:
272
+ // Start the server (default behavior)
273
+ await Promise.resolve().then(() => __importStar(require('./app')));
274
+ break;
275
+ }
276
+ }
277
+ main().catch((error) => {
278
+ console.error('Error:', error.message);
279
+ process.exit(1);
280
+ });
5
281
  //# sourceMappingURL=cli.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/mcp",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "config": {
5
5
  "docker": {
6
6
  "registry": "registry.gitlab.com/hailer-repos/hailer-mcp"