@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.
- package/bin/cortex-mcp.mjs +15 -19
- package/package.json +1 -1
package/bin/cortex-mcp.mjs
CHANGED
|
@@ -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.
|
|
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
|
|
46
|
-
// process
|
|
47
|
-
// and
|
|
48
|
-
//
|
|
45
|
+
// The network-using subcommands do their work, release the global fetch (undici) sockets, then
|
|
46
|
+
// let the process exit NATURALLY — no 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
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (cmd === 'doctor') {
|
|
57
|
+
} else if (cmd === 'doctor') {
|
|
58
58
|
const { runDoctor } = await import('../lib/doctor.mjs')
|
|
59
|
-
|
|
59
|
+
process.exitCode = await runDoctor()
|
|
60
60
|
const { closeFetch } = await import('../lib/diagnose.mjs')
|
|
61
61
|
await closeFetch()
|
|
62
|
-
|
|
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
|
-
|
|
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)
|