MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / getDefaultEnvironment

Function getDefaultEnvironment

src/client/stdio.ts:67–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 * Returns a default environment object including only environment variables deemed safe to inherit.
66 */
67export function getDefaultEnvironment(): Record<string, string> {
68 const env: Record<string, string> = {};
69
70 for (const key of DEFAULT_INHERITED_ENV_VARS) {
71 const value = process.env[key];
72 if (value === undefined) {
73 continue;
74 }
75
76 if (value.startsWith('()')) {
77 // Skip functions, which are a security risk.
78 continue;
79 }
80
81 env[key] = value;
82 }
83
84 return env;
85}
86
87/**
88 * Client transport for stdio: this will connect to a server by spawning a process and communicating with it over stdin/stdout.

Callers 2

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…