@theronap/cortex-mcp 0.4.1 → 0.4.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.
Files changed (2) hide show
  1. package/bin/cortex-mcp.mjs +15 -19
  2. package/package.json +1 -1
@@ -16,7 +16,7 @@
16
16
  * Get your token from the Cortex console → Connect your AI.
17
17
  */
18
18
 
19
- const VERSION = '0.4.1'
19
+ const VERSION = '0.4.2'
20
20
  const cmd = process.argv[2]
21
21
  const rest = process.argv.slice(3)
22
22
 
@@ -42,34 +42,30 @@ if (cmd === '--help' || cmd === '-h' || cmd === 'help') {
42
42
  process.exit(0)
43
43
  }
44
44
 
45
- // The network-using subcommands close the global fetch (undici) connections before exit so the
46
- // process tears down cleanly without it, process.exit() can race a lingering keep-alive socket
47
- // and trip a libuv assertion on Windows (src\win\async.c). The MCP server never exits, so it's
48
- // unaffected and doesn't need this.
45
+ // The network-using subcommands do their work, release the global fetch (undici) sockets, then
46
+ // let the process exit NATURALLYno process.exit(). Forcing exit on Windows tears libuv down
47
+ // abruptly and, if a threadpool/pipe handle is mid-flight (DNS, the stdout flush), trips an
48
+ // assertion (`!(handle->flags & UV_HANDLE_CLOSING)`, src\win\async.c) AFTER the real output.
49
+ // A graceful drain lets libuv finish those handles first, so the assertion never fires. The MCP
50
+ // server (default branch) runs forever and never reaches an exit path. if/else so the CLI
51
+ // commands don't fall through into the server.
49
52
  if (cmd === 'setup') {
50
53
  const { runSetup } = await import('../lib/setup.mjs')
51
54
  await runSetup(rest)
52
55
  const { closeFetch } = await import('../lib/diagnose.mjs')
53
56
  await closeFetch()
54
- process.exit(0)
55
- }
56
-
57
- if (cmd === 'doctor') {
57
+ } else if (cmd === 'doctor') {
58
58
  const { runDoctor } = await import('../lib/doctor.mjs')
59
- const code = await runDoctor()
59
+ process.exitCode = await runDoctor()
60
60
  const { closeFetch } = await import('../lib/diagnose.mjs')
61
61
  await closeFetch()
62
- process.exit(code)
63
- }
64
-
65
- if (cmd === 'capture') {
62
+ } else if (cmd === 'capture') {
66
63
  const { runCapture } = await import('../lib/capture.mjs')
67
64
  await runCapture()
68
65
  const { closeFetch } = await import('../lib/diagnose.mjs')
69
66
  await closeFetch()
70
- process.exit(0)
67
+ } else {
68
+ // Default: run the MCP server (stays alive; never exits).
69
+ const { runServer } = await import('../lib/server.mjs')
70
+ await runServer(VERSION)
71
71
  }
72
-
73
- // Default: run the MCP server.
74
- const { runServer } = await import('../lib/server.mjs')
75
- await runServer(VERSION)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {