subforge-mcp 1.1.0 → 1.1.1
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 +6 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
2
|
+
import { readFileSync, realpathSync } from "node:fs";
|
|
3
3
|
import { promises as fs } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -676,8 +676,11 @@ server.registerTool("delegate_task", {
|
|
|
676
676
|
}, delegateTaskHandler);
|
|
677
677
|
// Only start the stdio transport when this file is run directly (e.g. `node
|
|
678
678
|
// dist/index.js` or via the `subforge-mcp` bin), not when it's imported as a
|
|
679
|
-
// module by the test suite.
|
|
680
|
-
|
|
679
|
+
// module by the test suite. Comparing realpaths (rather than the raw argv[1])
|
|
680
|
+
// matters because npm/pnpm always invoke the bin through a symlink, which
|
|
681
|
+
// import.meta.url resolves through but process.argv[1] does not — a naive
|
|
682
|
+
// string comparison would never match for a globally-installed package.
|
|
683
|
+
const isEntryPoint = process.argv[1] !== undefined && import.meta.url === `file://${realpathSync(process.argv[1])}`;
|
|
681
684
|
if (isEntryPoint) {
|
|
682
685
|
const transport = new StdioServerTransport();
|
|
683
686
|
await server.connect(transport);
|