scanwarp 0.3.2 → 0.3.3

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.
@@ -11,28 +11,63 @@ const chalk_1 = __importDefault(require("chalk"));
11
11
  const inquirer_1 = __importDefault(require("inquirer"));
12
12
  async function setupMCP(serverUrl) {
13
13
  const homeDir = os_1.default.homedir();
14
- const cursorConfigPath = path_1.default.join(homeDir, '.cursor', 'mcp.json');
15
- const claudeConfigPath = path_1.default.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
14
+ // Detect operating system and set config paths
15
+ const platform = os_1.default.platform();
16
+ let cursorConfigPath;
17
+ let claudeConfigPath;
18
+ let claudeCodeConfigPath;
19
+ if (platform === 'darwin') {
20
+ // macOS
21
+ cursorConfigPath = path_1.default.join(homeDir, '.cursor', 'mcp.json');
22
+ claudeConfigPath = path_1.default.join(homeDir, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
23
+ claudeCodeConfigPath = path_1.default.join(homeDir, '.config', 'claude-code', 'mcp.json');
24
+ }
25
+ else if (platform === 'win32') {
26
+ // Windows
27
+ cursorConfigPath = path_1.default.join(homeDir, '.cursor', 'mcp.json');
28
+ claudeConfigPath = path_1.default.join(homeDir, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json');
29
+ claudeCodeConfigPath = path_1.default.join(homeDir, '.config', 'claude-code', 'mcp.json');
30
+ }
31
+ else {
32
+ // Linux
33
+ cursorConfigPath = path_1.default.join(homeDir, '.cursor', 'mcp.json');
34
+ claudeConfigPath = path_1.default.join(homeDir, '.config', 'Claude', 'claude_desktop_config.json');
35
+ claudeCodeConfigPath = path_1.default.join(homeDir, '.config', 'claude-code', 'mcp.json');
36
+ }
16
37
  let configPath = null;
17
- // Detect which config exists
38
+ let toolName = '';
39
+ // Detect which config exists (or create default)
18
40
  if (fs_1.default.existsSync(cursorConfigPath)) {
19
41
  configPath = cursorConfigPath;
42
+ toolName = 'Cursor';
20
43
  console.log(chalk_1.default.green('✓ Detected Cursor'));
21
44
  }
45
+ else if (fs_1.default.existsSync(claudeCodeConfigPath)) {
46
+ configPath = claudeCodeConfigPath;
47
+ toolName = 'Claude Code';
48
+ console.log(chalk_1.default.green('✓ Detected Claude Code'));
49
+ }
22
50
  else if (fs_1.default.existsSync(claudeConfigPath)) {
23
51
  configPath = claudeConfigPath;
52
+ toolName = 'Claude Desktop';
24
53
  console.log(chalk_1.default.green('✓ Detected Claude Desktop'));
25
54
  }
26
55
  if (!configPath) {
27
- console.log(chalk_1.default.yellow('⚠ MCP config file not found'));
28
- printManualInstructions(serverUrl);
29
- return;
56
+ // No config found - try to create one for Claude Code (most common for CLI users)
57
+ configPath = claudeCodeConfigPath;
58
+ toolName = 'Claude Code';
59
+ console.log(chalk_1.default.yellow('⚠ No MCP config found, creating default for Claude Code'));
60
+ // Ensure directory exists
61
+ const configDir = path_1.default.dirname(configPath);
62
+ if (!fs_1.default.existsSync(configDir)) {
63
+ fs_1.default.mkdirSync(configDir, { recursive: true });
64
+ }
30
65
  }
31
66
  const { addMcp } = await inquirer_1.default.prompt([
32
67
  {
33
68
  type: 'confirm',
34
69
  name: 'addMcp',
35
- message: 'Add ScanWarp MCP server to your configuration?',
70
+ message: `Add ScanWarp MCP server to ${toolName}?`,
36
71
  default: true,
37
72
  },
38
73
  ]);
@@ -51,18 +86,16 @@ async function setupMCP(serverUrl) {
51
86
  if (!config.mcpServers) {
52
87
  config.mcpServers = {};
53
88
  }
89
+ // Use npx to run the published package - works anywhere
54
90
  config.mcpServers.scanwarp = {
55
- command: 'node',
56
- args: [path_1.default.resolve(process.cwd(), 'packages/mcp/dist/index.js')],
57
- env: {
58
- SCANWARP_SERVER_URL: serverUrl,
59
- },
91
+ command: 'npx',
92
+ args: ['-y', 'scanwarp', 'mcp', '--server', serverUrl],
60
93
  };
61
94
  // Write config
62
95
  fs_1.default.writeFileSync(configPath, JSON.stringify(config, null, 2));
63
- console.log(chalk_1.default.green('✓ MCP server added to configuration'));
96
+ console.log(chalk_1.default.green(`✓ MCP server added to ${toolName} configuration`));
64
97
  console.log(chalk_1.default.gray(` Config: ${configPath}\n`));
65
- console.log(chalk_1.default.yellow(' Restart your editor to load the MCP server\n'));
98
+ console.log(chalk_1.default.yellow(` Restart ${toolName} to load the MCP server\n`));
66
99
  }
67
100
  catch (error) {
68
101
  console.log(chalk_1.default.red('✗ Failed to update MCP config'));
@@ -76,12 +109,13 @@ function printManualInstructions(serverUrl) {
76
109
  console.log(chalk_1.default.cyan(' {'));
77
110
  console.log(chalk_1.default.cyan(' "mcpServers": {'));
78
111
  console.log(chalk_1.default.cyan(' "scanwarp": {'));
79
- console.log(chalk_1.default.cyan(' "command": "node",'));
80
- console.log(chalk_1.default.cyan(' "args": ["path/to/packages/mcp/dist/index.js"],'));
81
- console.log(chalk_1.default.cyan(' "env": {'));
82
- console.log(chalk_1.default.cyan(` "SCANWARP_SERVER_URL": "${serverUrl}"`));
83
- console.log(chalk_1.default.cyan(' }'));
112
+ console.log(chalk_1.default.cyan(' "command": "npx",'));
113
+ console.log(chalk_1.default.cyan(` "args": ["-y", "scanwarp", "mcp", "--server", "${serverUrl}"]`));
84
114
  console.log(chalk_1.default.cyan(' }'));
85
115
  console.log(chalk_1.default.cyan(' }'));
86
116
  console.log(chalk_1.default.cyan(' }\n'));
117
+ console.log(chalk_1.default.gray(' Config file locations:'));
118
+ console.log(chalk_1.default.gray(' • Cursor: ~/.cursor/mcp.json'));
119
+ console.log(chalk_1.default.gray(' • Claude Code: ~/.config/claude-code/mcp.json'));
120
+ console.log(chalk_1.default.gray(' • Claude Desktop (macOS): ~/Library/Application Support/Claude/claude_desktop_config.json\n'));
87
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scanwarp",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Production monitoring built for developers who ship fast. Auto-diagnoses issues with Claude AI.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {