mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 10:34:35 -07:00
fix(mcp): Ensure that stdio MCP server execution has the GEMINI_CLI=1 env variable populated. (#18832)
This commit is contained in:
@@ -32,6 +32,18 @@ const { Terminal } = pkg;
|
||||
|
||||
const MAX_CHILD_PROCESS_BUFFER_SIZE = 16 * 1024 * 1024; // 16MB
|
||||
|
||||
/**
|
||||
* An environment variable that is set for shell executions. This can be used
|
||||
* by downstream executables and scripts to identify that they were executed
|
||||
* from within Gemini CLI.
|
||||
*/
|
||||
export const GEMINI_CLI_IDENTIFICATION_ENV_VAR = 'GEMINI_CLI';
|
||||
|
||||
/**
|
||||
* The value of {@link GEMINI_CLI_IDENTIFICATION_ENV_VAR}
|
||||
*/
|
||||
export const GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE = '1';
|
||||
|
||||
// We want to allow shell outputs that are close to the context window in size.
|
||||
// 300,000 lines is roughly equivalent to a large context window, ensuring
|
||||
// we capture significant output from long-running commands.
|
||||
@@ -302,7 +314,8 @@ export class ShellExecutionService {
|
||||
detached: !isWindows,
|
||||
env: {
|
||||
...sanitizeEnvironment(process.env, sanitizationConfig),
|
||||
GEMINI_CLI: '1',
|
||||
[GEMINI_CLI_IDENTIFICATION_ENV_VAR]:
|
||||
GEMINI_CLI_IDENTIFICATION_ENV_VAR_VALUE,
|
||||
TERM: 'xterm-256color',
|
||||
PAGER: 'cat',
|
||||
GIT_PAGER: 'cat',
|
||||
|
||||
Reference in New Issue
Block a user