|
1 | 1 | import fs from 'node:fs/promises' |
| 2 | +import { platform } from 'node:os' |
2 | 3 | import { MCPConfigLinterService } from './services/mcp-config-linter-service.ts' |
3 | 4 | import { MCPServerManagerService } from './services/mcp-server-manager-service.ts' |
4 | 5 |
|
@@ -39,22 +40,40 @@ interface MCPFileGroupsResult { |
39 | 40 | type MCPFilePathGroupsRecord = Record<string, MCPFileGroups> |
40 | 41 | type MCPFileGroupsResultRecord = Record<string, MCPFileGroupsResult> |
41 | 42 |
|
| 43 | +const osSpecificPaths: { [key: string]: MCPFilePath[] } = { |
| 44 | + claude: [], |
| 45 | + cursor: [] |
| 46 | +} |
| 47 | + |
| 48 | +if (platform() === 'win32') { |
| 49 | + osSpecificPaths['claude'] = [ |
| 50 | + { filePath: `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`, type: 'global' } |
| 51 | + ] |
| 52 | + osSpecificPaths['cursor'] = [ |
| 53 | + { filePath: `${process.env.HOME}\\.cursor\\mcp.json`, type: 'global' }, |
| 54 | + { filePath: '.cursor\\mcp.json', type: 'local' } |
| 55 | + ] |
| 56 | +} else { |
| 57 | + osSpecificPaths['claude'] = [ |
| 58 | + { filePath: '~/Library/Application Support/Claude/claude_desktop_config.json', type: 'global' } |
| 59 | + ] |
| 60 | + osSpecificPaths['cursor'] = [ |
| 61 | + { filePath: '~/.cursor/mcp.json', type: 'global' }, |
| 62 | + { filePath: '.cursor/mcp.json', type: 'local' } |
| 63 | + ] |
| 64 | +} |
| 65 | + |
42 | 66 | export class MCPFiles { |
43 | 67 | private mcpFilePathGroups: MCPFilePathGroupsRecord = { |
44 | 68 | claude: { |
45 | 69 | name: 'claude-desktop', |
46 | 70 | friendlyName: 'Claude Desktop', |
47 | | - paths: [ |
48 | | - { filePath: '~/Library/Application Support/Claude/claude_desktop_config.json', type: 'global' }, |
49 | | - ] |
| 71 | + paths: osSpecificPaths['claude'] |
50 | 72 | }, |
51 | 73 | cursor: { |
52 | 74 | name: 'cursor', |
53 | 75 | friendlyName: 'Cursor', |
54 | | - paths: [ |
55 | | - { filePath: '~/.cursor/mcp.json', type: 'global' }, |
56 | | - { filePath: '.cursor/mcp.json', type: 'local' }, |
57 | | - ] |
| 76 | + paths: osSpecificPaths['cursor'] |
58 | 77 | } |
59 | 78 | } |
60 | 79 |
|
|
0 commit comments