@meldocio/mcp-stdio-proxy 1.0.12 → 1.0.14

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.
Files changed (3) hide show
  1. package/README.md +62 -0
  2. package/bin/cli.js +283 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,6 +15,48 @@ This is a bridge between Claude Desktop and Meldoc. After setup, Claude will be
15
15
 
16
16
  ## Quick Setup
17
17
 
18
+ ### Automatic Installation (Recommended) ✨
19
+
20
+ The easiest way to set up Meldoc MCP is using the automatic installer:
21
+
22
+ ```bash
23
+ npx @meldocio/mcp-stdio-proxy@latest install
24
+ ```
25
+
26
+ This command will:
27
+ - ✅ Automatically find your Claude Desktop configuration file
28
+ - ✅ Add Meldoc MCP configuration (preserving existing MCP servers)
29
+ - ✅ Create the config file and directory if needed
30
+ - ✅ Check if already installed (won't duplicate if already configured)
31
+ - ✅ Show you the next steps
32
+
33
+ After running `install`, you just need to:
34
+ 1. Restart Claude Desktop
35
+ 2. Run `npx @meldocio/mcp-stdio-proxy@latest auth login`
36
+
37
+ Done! 🎉
38
+
39
+ ### Uninstalling
40
+
41
+ To remove Meldoc MCP from Claude Desktop:
42
+
43
+ ```bash
44
+ npx @meldocio/mcp-stdio-proxy@latest uninstall
45
+ ```
46
+
47
+ This will:
48
+ - ✅ Remove Meldoc MCP configuration from Claude Desktop
49
+ - ✅ Preserve other MCP servers
50
+ - ✅ Clean up empty `mcpServers` object if needed
51
+
52
+ After running `uninstall`, restart Claude Desktop for changes to take effect.
53
+
54
+ ---
55
+
56
+ ### Manual Installation
57
+
58
+ If you prefer to configure manually, follow these steps:
59
+
18
60
  ### Step 1: Find Claude Desktop configuration file
19
61
 
20
62
  Open the configuration file depending on your operating system:
@@ -186,6 +228,16 @@ When you ask Claude to do something with your documentation:
186
228
 
187
229
  ## Working Commands
188
230
 
231
+ ### Installation commands
232
+
233
+ ```bash
234
+ # Automatically configure Claude Desktop for Meldoc MCP
235
+ npx @meldocio/mcp-stdio-proxy@latest install
236
+
237
+ # Remove Meldoc MCP configuration from Claude Desktop
238
+ npx @meldocio/mcp-stdio-proxy@latest uninstall
239
+ ```
240
+
189
241
  ### Authentication commands
190
242
 
191
243
  ```bash
@@ -214,6 +266,16 @@ npx @meldocio/mcp-stdio-proxy@latest config set-workspace workspace-name
214
266
  npx @meldocio/mcp-stdio-proxy@latest config get-workspace
215
267
  ```
216
268
 
269
+ ### Installation
270
+
271
+ ```bash
272
+ # Automatically configure Claude Desktop
273
+ npx @meldocio/mcp-stdio-proxy@latest install
274
+
275
+ # Remove configuration
276
+ npx @meldocio/mcp-stdio-proxy@latest uninstall
277
+ ```
278
+
217
279
  ### Help
218
280
 
219
281
  ```bash
package/bin/cli.js CHANGED
@@ -10,6 +10,9 @@ const axios = require('axios');
10
10
  const https = require('https');
11
11
  const chalk = require('chalk');
12
12
  const logger = require('../lib/logger');
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+ const os = require('os');
13
16
 
14
17
  const API_URL = getApiUrl();
15
18
  const APP_URL = getAppUrl();
@@ -195,6 +198,267 @@ async function handleConfigListWorkspaces() {
195
198
  }
196
199
  }
197
200
 
201
+ /**
202
+ * Get Claude Desktop config file path based on OS
203
+ */
204
+ function getClaudeDesktopConfigPath() {
205
+ const platform = os.platform();
206
+ const homeDir = os.homedir();
207
+
208
+ if (platform === 'darwin') {
209
+ // macOS
210
+ return path.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
211
+ } else if (platform === 'win32') {
212
+ // Windows
213
+ const appData = process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming');
214
+ return path.join(appData, 'Claude', 'claude_desktop_config.json');
215
+ } else {
216
+ // Linux and others
217
+ return path.join(homeDir, '.config', 'Claude', 'claude_desktop_config.json');
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Get expected Meldoc MCP configuration
223
+ */
224
+ function getExpectedMeldocConfig() {
225
+ return {
226
+ command: 'npx',
227
+ args: ['-y', '@meldocio/mcp-stdio-proxy@latest']
228
+ };
229
+ }
230
+
231
+ /**
232
+ * Check if two configurations are equal (deep comparison)
233
+ */
234
+ function configsEqual(config1, config2) {
235
+ if (!config1 || !config2) return false;
236
+ if (config1.command !== config2.command) return false;
237
+ if (!Array.isArray(config1.args) || !Array.isArray(config2.args)) return false;
238
+ if (config1.args.length !== config2.args.length) return false;
239
+ return config1.args.every((arg, i) => arg === config2.args[i]);
240
+ }
241
+
242
+ /**
243
+ * Handle install command - automatically configure Claude Desktop
244
+ */
245
+ function handleInstall() {
246
+ try {
247
+ logger.section('🚀 Installing Meldoc MCP for Claude Desktop');
248
+ console.log();
249
+
250
+ const configPath = getClaudeDesktopConfigPath();
251
+ const configDir = path.dirname(configPath);
252
+ const expectedConfig = getExpectedMeldocConfig();
253
+
254
+ logger.info(`Config file location: ${logger.highlight(configPath)}`);
255
+ console.log();
256
+
257
+ // Read existing config or create new one
258
+ let config = {};
259
+ let configExists = false;
260
+
261
+ if (fs.existsSync(configPath)) {
262
+ try {
263
+ const content = fs.readFileSync(configPath, 'utf8');
264
+ config = JSON.parse(content);
265
+ configExists = true;
266
+ logger.info('Found existing Claude Desktop configuration');
267
+ } catch (error) {
268
+ logger.warn(`Failed to parse existing config: ${error.message}`);
269
+ logger.info('Will create a new configuration file');
270
+ }
271
+ } else {
272
+ logger.info('Configuration file does not exist, will create it');
273
+ }
274
+
275
+ // Ensure mcpServers object exists
276
+ if (!config.mcpServers) {
277
+ config.mcpServers = {};
278
+ }
279
+
280
+ // Check if meldoc is already configured
281
+ if (config.mcpServers.meldoc) {
282
+ const existingConfig = config.mcpServers.meldoc;
283
+ const isEqual = configsEqual(existingConfig, expectedConfig);
284
+
285
+ if (isEqual) {
286
+ logger.success('Meldoc MCP is already configured correctly!');
287
+ console.log();
288
+ logger.info('Current configuration:');
289
+ console.log(' ' + logger.highlight(JSON.stringify(existingConfig, null, 2)));
290
+ console.log();
291
+ logger.info('No changes needed. Next steps:');
292
+ console.log(' 1. Restart Claude Desktop (if you haven\'t already)');
293
+ console.log(' 2. Run: ' + logger.highlight('npx @meldocio/mcp-stdio-proxy auth login'));
294
+ console.log();
295
+ process.exit(0);
296
+ } else {
297
+ logger.warn('Meldoc MCP is already configured, but with different settings');
298
+ console.log();
299
+ logger.info('Current configuration:');
300
+ console.log(' ' + logger.highlight(JSON.stringify(existingConfig, null, 2)));
301
+ console.log();
302
+ logger.info('Expected configuration:');
303
+ console.log(' ' + logger.highlight(JSON.stringify(expectedConfig, null, 2)));
304
+ console.log();
305
+ logger.info('To update the configuration, run:');
306
+ console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy uninstall'));
307
+ console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy install'));
308
+ console.log();
309
+ process.exit(0);
310
+ }
311
+ }
312
+
313
+ // Add meldoc configuration
314
+ config.mcpServers.meldoc = expectedConfig;
315
+
316
+ // Create directory if it doesn't exist
317
+ if (!fs.existsSync(configDir)) {
318
+ logger.info(`Creating directory: ${configDir}`);
319
+ fs.mkdirSync(configDir, { recursive: true });
320
+ }
321
+
322
+ // Write config file
323
+ const configContent = JSON.stringify(config, null, 2);
324
+ fs.writeFileSync(configPath, configContent, 'utf8');
325
+
326
+ logger.success('Configuration added successfully!');
327
+ console.log();
328
+
329
+ // Show what was added
330
+ logger.info('Added MCP server configuration:');
331
+ console.log(' ' + logger.highlight(JSON.stringify(config.mcpServers.meldoc, null, 2)));
332
+ console.log();
333
+
334
+ // Count other MCP servers
335
+ const otherServers = Object.keys(config.mcpServers).filter(key => key !== 'meldoc');
336
+ if (otherServers.length > 0) {
337
+ logger.info(`Found ${otherServers.length} other MCP server(s): ${otherServers.join(', ')}`);
338
+ console.log();
339
+ }
340
+
341
+ // Next steps
342
+ logger.section('✅ Installation Complete!');
343
+ console.log();
344
+ logger.info('Next steps:');
345
+ console.log();
346
+ console.log(' 1. ' + logger.label('Restart Claude Desktop'));
347
+ console.log(' Completely close and reopen Claude Desktop for changes to take effect.');
348
+ console.log();
349
+ console.log(' 2. ' + logger.label('Authenticate with Meldoc'));
350
+ console.log(' Run: ' + logger.highlight('npx @meldocio/mcp-stdio-proxy auth login'));
351
+ console.log();
352
+ console.log(' 3. ' + logger.label('Start using Claude with Meldoc!'));
353
+ console.log(' Ask Claude to read, search, or update your documentation.');
354
+ console.log();
355
+
356
+ process.exit(0);
357
+ } catch (error) {
358
+ logger.error(`Installation failed: ${error.message}`);
359
+ console.log();
360
+ logger.info('You can manually configure Claude Desktop by:');
361
+ console.log(' 1. Opening the config file: ' + logger.highlight(getClaudeDesktopConfigPath()));
362
+ console.log(' 2. Adding this configuration:');
363
+ console.log(' ' + logger.highlight(JSON.stringify({
364
+ mcpServers: {
365
+ meldoc: getExpectedMeldocConfig()
366
+ }
367
+ }, null, 2)));
368
+ console.log();
369
+ process.exit(1);
370
+ }
371
+ }
372
+
373
+ /**
374
+ * Handle uninstall command - remove Meldoc MCP configuration from Claude Desktop
375
+ */
376
+ function handleUninstall() {
377
+ try {
378
+ logger.section('🗑️ Uninstalling Meldoc MCP from Claude Desktop');
379
+ console.log();
380
+
381
+ const configPath = getClaudeDesktopConfigPath();
382
+
383
+ logger.info(`Config file location: ${logger.highlight(configPath)}`);
384
+ console.log();
385
+
386
+ // Check if config file exists
387
+ if (!fs.existsSync(configPath)) {
388
+ logger.warn('Claude Desktop configuration file not found');
389
+ logger.info('Meldoc MCP is not configured (nothing to remove)');
390
+ console.log();
391
+ process.exit(0);
392
+ }
393
+
394
+ // Read existing config
395
+ let config = {};
396
+ try {
397
+ const content = fs.readFileSync(configPath, 'utf8');
398
+ config = JSON.parse(content);
399
+ } catch (error) {
400
+ logger.error(`Failed to read config file: ${error.message}`);
401
+ process.exit(1);
402
+ }
403
+
404
+ // Check if meldoc is configured
405
+ if (!config.mcpServers || !config.mcpServers.meldoc) {
406
+ logger.warn('Meldoc MCP is not configured in Claude Desktop');
407
+ logger.info('Nothing to remove');
408
+ console.log();
409
+ process.exit(0);
410
+ }
411
+
412
+ // Show what will be removed
413
+ logger.info('Current Meldoc configuration:');
414
+ console.log(' ' + logger.highlight(JSON.stringify(config.mcpServers.meldoc, null, 2)));
415
+ console.log();
416
+
417
+ // Remove meldoc configuration
418
+ delete config.mcpServers.meldoc;
419
+
420
+ // If mcpServers is now empty, remove it too
421
+ if (Object.keys(config.mcpServers).length === 0) {
422
+ delete config.mcpServers;
423
+ }
424
+
425
+ // Write config file back
426
+ const configContent = JSON.stringify(config, null, 2);
427
+ fs.writeFileSync(configPath, configContent, 'utf8');
428
+
429
+ logger.success('Meldoc MCP configuration removed successfully!');
430
+ console.log();
431
+
432
+ // Count remaining MCP servers
433
+ if (config.mcpServers && Object.keys(config.mcpServers).length > 0) {
434
+ const remainingServers = Object.keys(config.mcpServers);
435
+ logger.info(`Remaining MCP server(s): ${remainingServers.join(', ')}`);
436
+ console.log();
437
+ } else {
438
+ logger.info('No other MCP servers configured');
439
+ console.log();
440
+ }
441
+
442
+ // Next steps
443
+ logger.section('✅ Uninstallation Complete!');
444
+ console.log();
445
+ logger.info('Next steps:');
446
+ console.log(' 1. Restart Claude Desktop for changes to take effect');
447
+ console.log(' 2. To reinstall, run: ' + logger.highlight('npx @meldocio/mcp-stdio-proxy install'));
448
+ console.log();
449
+
450
+ process.exit(0);
451
+ } catch (error) {
452
+ logger.error(`Uninstallation failed: ${error.message}`);
453
+ console.log();
454
+ logger.info('You can manually remove Meldoc MCP by:');
455
+ console.log(' 1. Opening the config file: ' + logger.highlight(getClaudeDesktopConfigPath()));
456
+ console.log(' 2. Removing the "meldoc" entry from "mcpServers" object');
457
+ console.log();
458
+ process.exit(1);
459
+ }
460
+ }
461
+
198
462
  /**
199
463
  * Handle help command
200
464
  */
@@ -229,11 +493,21 @@ function handleHelp() {
229
493
  console.log(' List all available workspaces');
230
494
  console.log();
231
495
 
496
+ console.log(' ' + logger.highlight('install'));
497
+ console.log(' Automatically configure Claude Desktop for Meldoc MCP');
498
+ console.log();
499
+
500
+ console.log(' ' + logger.highlight('uninstall'));
501
+ console.log(' Remove Meldoc MCP configuration from Claude Desktop');
502
+ console.log();
503
+
232
504
  console.log(' ' + logger.highlight('help'));
233
505
  console.log(' Show this help message');
234
506
  console.log();
235
507
 
236
508
  console.log(logger.label('Examples:'));
509
+ console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy install'));
510
+ console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy uninstall'));
237
511
  console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy auth login'));
238
512
  console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy config set-workspace my-workspace'));
239
513
  console.log(' ' + logger.highlight('npx @meldocio/mcp-stdio-proxy config list-workspaces'));
@@ -255,6 +529,8 @@ function showUsageHints() {
255
529
  console.log(' ' + logger.highlight('config set-workspace') + ' - Set workspace alias');
256
530
  console.log(' ' + logger.highlight('config get-workspace') + ' - Get current workspace');
257
531
  console.log(' ' + logger.highlight('config list-workspaces') + ' - List workspaces');
532
+ console.log(' ' + logger.highlight('install') + ' - Configure Claude Desktop');
533
+ console.log(' ' + logger.highlight('uninstall') + ' - Remove configuration');
258
534
  console.log(' ' + logger.highlight('help') + ' - Show detailed help');
259
535
  console.log();
260
536
  console.log(logger.label('For more information, run:'));
@@ -280,6 +556,10 @@ async function main() {
280
556
 
281
557
  if (command === 'help' || command === '--help' || command === '-h') {
282
558
  handleHelp();
559
+ } else if (command === 'install') {
560
+ handleInstall();
561
+ } else if (command === 'uninstall') {
562
+ handleUninstall();
283
563
  } else if (command === 'auth') {
284
564
  if (subcommand === 'login') {
285
565
  await handleAuthLogin();
@@ -326,5 +606,7 @@ module.exports = {
326
606
  handleAuthLogout,
327
607
  handleConfigSetWorkspace,
328
608
  handleConfigGetWorkspace,
329
- handleConfigListWorkspaces
609
+ handleConfigListWorkspaces,
610
+ handleInstall,
611
+ handleUninstall
330
612
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meldocio/mcp-stdio-proxy",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "MCP stdio proxy for meldoc - connects Claude Desktop to meldoc MCP API",
5
5
  "bin": {
6
6
  "meldoc-mcp": "bin/meldoc-mcp-proxy.js"