project-graph-mcp 2.4.0 → 2.4.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/package.json +1 -1
- package/src/network/server.js +1 -1
package/package.json
CHANGED
package/src/network/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ctx server.ctx
|
|
3
|
-
import e from"node:path";import t from"node:fs";let _v="0.0.0";try{const _d=e.dirname(new URL(import.meta.url).pathname);_v=JSON.parse(t.readFileSync(e.join(_d,"..","..","package.json"),"utf8")).version}catch{}if(process.argv[1]&&(process.argv[1].endsWith("server.js")||process.argv[1].endsWith("project-graph-mcp"))){const[,,o,...r]=process.argv;if("serve"===o){const t=r[0]||".";console.log("\n [redirect] UI has moved to 'agent-portal'.");console.log(" Running: npx agent-portal\n");const{spawn:s}=await import("child_process");s("npx",["agent-portal"],{stdio:"inherit",cwd:e.resolve(t)})}else if(o){const{runCLI:e}=await import("../cli/cli.js");e(o,r)}else if(process.env.PROJECT_GRAPH_BACKEND){const{startStdioServer:e}=await import("../mcp/mcp-server.js");console.error("Starting Project Graph MCP (stdio, direct)..."),e()}else{const{setRoots:e,getWorkspaceRoot:o}=await import("../core/workspace.js"),{ensureBackend:r,startStdioProxy:s}=await import("./backend-lifecycle.js"),{createInterface:i}=await import("node:readline"),n=t.createWriteStream("/tmp/pg-init-debug.log",{flags:"a"});n.write(`\n=== NEW SESSION ${(new Date).toISOString()} ===\n`);
|
|
3
|
+
import e from"node:path";import t from"node:fs";let _v="0.0.0";try{const _d=e.dirname(new URL(import.meta.url).pathname);_v=JSON.parse(t.readFileSync(e.join(_d,"..","..","package.json"),"utf8")).version}catch{}if(process.argv[1]&&(process.argv[1].endsWith("server.js")||process.argv[1].endsWith("project-graph-mcp"))){const[,,o,...r]=process.argv;if("serve"===o){const t=r[0]||".";console.log("\n [redirect] UI has moved to 'mcp-agent-portal'.");console.log(" Running: npx mcp-agent-portal\n");const{spawn:s}=await import("child_process");s("npx",["mcp-agent-portal"],{stdio:"inherit",cwd:e.resolve(t)})}else if(o){const{runCLI:e}=await import("../cli/cli.js");e(o,r)}else if(process.env.PROJECT_GRAPH_BACKEND){const{startStdioServer:e}=await import("../mcp/mcp-server.js");console.error("Starting Project Graph MCP (stdio, direct)..."),e()}else{const{setRoots:e,getWorkspaceRoot:o}=await import("../core/workspace.js"),{ensureBackend:r,startStdioProxy:s}=await import("./backend-lifecycle.js"),{createInterface:i}=await import("node:readline"),n=t.createWriteStream("/tmp/pg-init-debug.log",{flags:"a"});n.write(`\n=== NEW SESSION ${(new Date).toISOString()} ===\n`);
|
|
4
4
|
const c=i({input:process.stdin,terminal:!1}),a=[];
|
|
5
5
|
let l=!1,p=null,d=null;
|
|
6
6
|
const startProxy=async e=>{if(!l){l=!0,c.removeAllListeners("line"),c.close(),n.write(`RESOLVED: ${e}\n`),n.end();try{const t=await r(e);console.error(`[project-graph] Connected to backend on port ${t} (project: ${e})`),s(t,a)}catch(e){console.error(`[project-graph] Singleton failed (${e.message}), falling back to direct stdio`);const{startStdioServer:t}=await import("../mcp/mcp-server.js");t(a)}}};c.on("line",t=>{try{const r=JSON.parse(t);if(n.write(`IN: ${r.method||`response:${r.id}`}\n`),"initialize"===r.method){d=r.id,r.params?.roots?.length>0&&(e(r.params.roots),n.write("ROOTS from initialize.params\n"));
|