@torqon/mcp 0.1.0 → 0.1.2

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/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ // If --client flag is passed, run installer instead of MCP server
3
+ if (process.argv.some(a => a.startsWith('--client'))) {
4
+ await import('./install.js');
5
+ process.exit(0);
6
+ }
2
7
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
8
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
9
  import { z } from 'zod';
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
3
+ import { join } from 'path';
4
+ import { homedir, platform } from 'os';
5
+ const TORQON_API_URL = process.env.TORQON_API_URL ?? 'https://torqon-production.up.railway.app';
6
+ function getConfigPath(client) {
7
+ const home = homedir();
8
+ const os = platform();
9
+ if (client === 'claude') {
10
+ if (os === 'win32') {
11
+ const windowsStorePath = `${process.env.LOCALAPPDATA}\\Packages\\Claude_pzs8sxrjxfjjc\\LocalCache\\Roaming\\Claude\\claude_desktop_config.json`;
12
+ if (existsSync(windowsStorePath))
13
+ return windowsStorePath;
14
+ return `${process.env.APPDATA}\\Claude\\claude_desktop_config.json`;
15
+ }
16
+ if (os === 'darwin')
17
+ return join(home, 'Library/Application Support/Claude/claude_desktop_config.json');
18
+ return join(home, '.config/Claude/claude_desktop_config.json');
19
+ }
20
+ if (client === 'cursor') {
21
+ if (os === 'win32')
22
+ return `${process.env.APPDATA}\\Cursor\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`;
23
+ if (os === 'darwin')
24
+ return join(home, 'Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json');
25
+ return join(home, '.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json');
26
+ }
27
+ if (client === 'windsurf') {
28
+ if (os === 'win32')
29
+ return `${process.env.APPDATA}\\Windsurf\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json`;
30
+ if (os === 'darwin')
31
+ return join(home, 'Library/Application Support/Windsurf/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json');
32
+ return join(home, '.config/Windsurf/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json');
33
+ }
34
+ throw new Error(`Unknown client: ${client}. Supported: claude, cursor, windsurf`);
35
+ }
36
+ function install(client, apiUrl) {
37
+ console.log(`\nšŸ”§ Installing Torqon MCP for ${client}...\n`);
38
+ const configPath = getConfigPath(client);
39
+ const configDir = configPath.substring(0, configPath.lastIndexOf('\\') || configPath.lastIndexOf('/'));
40
+ if (!existsSync(configDir)) {
41
+ mkdirSync(configDir, { recursive: true });
42
+ }
43
+ let config = {};
44
+ if (existsSync(configPath)) {
45
+ try {
46
+ config = JSON.parse(readFileSync(configPath, 'utf8'));
47
+ }
48
+ catch {
49
+ console.warn('āš ļø Existing config could not be parsed. Starting fresh.');
50
+ }
51
+ }
52
+ if (!config.mcpServers)
53
+ config.mcpServers = {};
54
+ config.mcpServers.torqon = {
55
+ command: 'npx',
56
+ args: ['-y', '@torqon/mcp'],
57
+ env: {
58
+ TORQON_API_URL: apiUrl,
59
+ },
60
+ };
61
+ writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
62
+ console.log(`āœ… Torqon MCP installed for ${client}`);
63
+ console.log(`šŸ“ Config updated: ${configPath}`);
64
+ console.log(`🌐 API URL: ${apiUrl}`);
65
+ console.log(`\nšŸ‘‰ Restart ${client} to activate Torqon.\n`);
66
+ }
67
+ // Parse args
68
+ const args = process.argv.slice(2);
69
+ const clientArg = args.find(a => a.startsWith('--client='))?.split('=')[1] ?? 'claude';
70
+ const apiArg = args.find(a => a.startsWith('--api-url='))?.split('=')[1] ?? TORQON_API_URL;
71
+ export default function run() {
72
+ install(clientArg, apiArg);
73
+ }
74
+ install(clientArg, apiArg);
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@torqon/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "torqon-mcp": "dist/index.js"
7
+ "torqon-mcp": "dist/index.js",
8
+ "torqon-install": "dist/install.js"
8
9
  },
9
10
  "files": [
10
11
  "dist"
@@ -23,4 +24,4 @@
23
24
  "tsx": "^4.0.0",
24
25
  "typescript": "^5.0.0"
25
26
  }
26
- }
27
+ }