Commit 016cfcd
committed
fix: improve main module detection for npx compatibility
The previous module detection logic failed when running via npx due to
symlink resolution differences. This caused the server to exit immediately
without starting, resulting in "MCP error -32000: Connection closed".
The fix uses realpathSync() to fully resolve both the module path and
script path before comparison, handling symlinks and path normalization
across different execution contexts (npx, node, direct execution).
Fixes the issue where:
- Connection failed after ~1s with "Connection closed" error
- Server worked in development but failed when installed via npx1 parent 85a0a26 commit 016cfcd
2 files changed
+14
-3
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
244 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
245 | 256 | | |
246 | 257 | | |
247 | 258 | | |
| |||
0 commit comments