feat(mcp log): print mcp stderr to opencode log file (#9982)
Co-authored-by: chuxuan.liang <chuxuan.liang@bytedance.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
@@ -409,7 +409,7 @@ export namespace MCP {
|
|||||||
const [cmd, ...args] = mcp.command
|
const [cmd, ...args] = mcp.command
|
||||||
const cwd = Instance.directory
|
const cwd = Instance.directory
|
||||||
const transport = new StdioClientTransport({
|
const transport = new StdioClientTransport({
|
||||||
stderr: "ignore",
|
stderr: "pipe",
|
||||||
command: cmd,
|
command: cmd,
|
||||||
args,
|
args,
|
||||||
cwd,
|
cwd,
|
||||||
@@ -419,6 +419,9 @@ export namespace MCP {
|
|||||||
...mcp.environment,
|
...mcp.environment,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
transport.stderr?.on("data", (chunk: Buffer) => {
|
||||||
|
log.info(`mcp stderr: ${chunk.toString()}`, { key })
|
||||||
|
})
|
||||||
|
|
||||||
const connectTimeout = mcp.timeout ?? DEFAULT_TIMEOUT
|
const connectTimeout = mcp.timeout ?? DEFAULT_TIMEOUT
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user