Set port dynamically in VSCode extension and read from it in gemini-cli and send initial notification (#4255)

This commit is contained in:
christine betts
2025-07-15 22:13:03 +00:00
committed by GitHub
parent bf51de1a4d
commit b61016f2a5
4 changed files with 76 additions and 27 deletions

View File

@@ -306,13 +306,20 @@ export async function loadCliConfig(
}
if (ideMode) {
const companionPort = process.env.GEMINI_CLI_IDE_SERVER_PORT;
if (!companionPort) {
throw new Error(
"Could not run in ide mode, make sure you're running in vs code integrated terminal. Try running in a fresh terminal.",
);
}
const httpUrl = `http://localhost:${companionPort}/mcp`;
mcpServers[IDE_SERVER_NAME] = new MCPServerConfig(
undefined, // command
undefined, // args
undefined, // env
undefined, // cwd
undefined, // url
'http://localhost:3000/mcp', // httpUrl
httpUrl, // httpUrl
undefined, // headers
undefined, // tcp
undefined, // timeout