File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js" ;
13
13
import express from "express" ;
14
14
import mcpProxy from "./mcpProxy.js" ;
15
+ import { findActualExecutable } from "spawn-rx" ;
15
16
16
17
// Polyfill EventSource for an SSE client in Node.js
17
18
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -37,14 +38,17 @@ const createTransport = async (query: express.Request["query"]) => {
37
38
38
39
if ( transportType === "stdio" ) {
39
40
const command = query . command as string ;
40
- const args = ( query . args as string ) . split ( / \s + / ) ;
41
+ const origArgs = ( query . args as string ) . split ( / \s + / ) ;
41
42
const env = query . env ? JSON . parse ( query . env as string ) : undefined ;
42
43
44
+ const { cmd, args } = findActualExecutable ( command , origArgs ) ;
45
+
43
46
console . log (
44
- `Stdio transport: command=${ command } , args=${ args } , env=${ JSON . stringify ( env ) } ` ,
47
+ `Stdio transport: command=${ cmd } , args=${ args } , env=${ JSON . stringify ( env ) } ` ,
45
48
) ;
49
+
46
50
const transport = new StdioClientTransport ( {
47
- command,
51
+ command : cmd ,
48
52
args,
49
53
env,
50
54
stderr : "pipe" ,
You can’t perform that action at this time.
0 commit comments