@atlisp/mcp 1.1.2 → 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlisp/mcp",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "MCP Server for @lisp on CAD",
5
5
  "type": "module",
6
6
  "bin": {
package/src/atlisp-mcp.js CHANGED
@@ -7,7 +7,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  const require = createRequire(import.meta.url);
8
8
  const { version } = require(path.join(__dirname, '..', 'package.json'));
9
9
 
10
- if (process.argv[1]?.endsWith('atlisp-mcp.js')) {
10
+ const isMcpScript = process.argv[1]?.includes('atlisp-mcp');
11
+ if (isMcpScript) {
11
12
  const args = process.argv.slice(2);
12
13
  for (let i = 0; i < args.length; i++) {
13
14
  if (args[i] === '--version' || args[i] === '-v') {
@@ -34,6 +35,17 @@ Examples:
34
35
  atlisp-mcp --transport stdio # Same as --stdio
35
36
  `);
36
37
  process.exit(0);
38
+ } else if (args[i] === '--transport' && args[i + 1]) {
39
+ process.env.TRANSPORT = args[i + 1];
40
+ i++;
41
+ } else if (args[i] === '--stdio') {
42
+ process.env.TRANSPORT = 'stdio';
43
+ } else if (args[i] === '--port' && args[i + 1]) {
44
+ process.env.PORT = args[i + 1];
45
+ i++;
46
+ } else if (args[i] === '--host' && args[i + 1]) {
47
+ process.env.HOST = args[i + 1];
48
+ i++;
37
49
  }
38
50
  }
39
51
  }
package/src/config.js CHANGED
@@ -1,7 +1,29 @@
1
+ function parseArgs() {
2
+ const args = process.argv.slice(2);
3
+ const result = { transport: 'http', port: '8110', host: '0.0.0.0' };
4
+ for (let i = 0; i < args.length; i++) {
5
+ if (args[i] === '--transport' && args[i + 1]) {
6
+ result.transport = args[i + 1];
7
+ i++;
8
+ } else if (args[i] === '--stdio') {
9
+ result.transport = 'stdio';
10
+ } else if (args[i] === '--port' && args[i + 1]) {
11
+ result.port = args[i + 1];
12
+ i++;
13
+ } else if (args[i] === '--host' && args[i + 1]) {
14
+ result.host = args[i + 1];
15
+ i++;
16
+ }
17
+ }
18
+ return result;
19
+ }
20
+
21
+ const cliArgs = parseArgs();
22
+
1
23
  const config = {
2
- port: parseInt(process.env.PORT || '8110', 10),
3
- host: process.env.HOST || '0.0.0.0',
4
- transport: process.env.TRANSPORT || 'http',
24
+ port: parseInt(process.env.PORT || cliArgs.port, 10),
25
+ host: process.env.HOST || cliArgs.host,
26
+ transport: process.env.TRANSPORT || cliArgs.transport,
5
27
  apiKey: process.env.MCP_API_KEY || '',
6
28
  enableSse: process.env.ENABLE_SSE !== 'false',
7
29
  messageTimeout: parseInt(process.env.MESSAGE_TIMEOUT || '60000', 10),