mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
[ide-mode] Wire up env variables to sandbox (#5804)
This commit is contained in:
@@ -324,7 +324,7 @@ export class IdeClient {
|
||||
version: '1.0.0',
|
||||
});
|
||||
transport = new StreamableHTTPClientTransport(
|
||||
new URL(`http://localhost:${port}/mcp`),
|
||||
new URL(`http://${getIdeServerHost()}:${port}/mcp`),
|
||||
);
|
||||
await this.client.connect(transport);
|
||||
this.registerClientHandlers();
|
||||
@@ -345,3 +345,12 @@ export class IdeClient {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getIdeServerHost() {
|
||||
const isInContainer =
|
||||
fs.existsSync('/.dockerenv') ||
|
||||
fs.existsSync('/run/.containerenv') ||
|
||||
!!process.env.SANDBOX ||
|
||||
!!process.env.container;
|
||||
return isInContainer ? 'host.docker.internal' : 'localhost';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user