MCPcopy
hub / github.com/codeaashu/claude-code / parseEnvVars

Function parseEnvVars

src/utils/envUtils.ts:72–90  ·  view source on GitHub ↗
(
  rawEnvArgs: string[] | undefined,
)

Source from the content-addressed store, hash-verified

70 * @returns Object with key-value pairs
71 */
72export function parseEnvVars(
73 rawEnvArgs: string[] | undefined,
74): Record<string, string> {
75 const parsedEnv: Record<string, string> = {}
76
77 // Parse individual env vars
78 if (rawEnvArgs) {
79 for (const envStr of rawEnvArgs) {
80 const [key, ...valueParts] = envStr.split('=')
81 if (!key || valueParts.length === 0) {
82 throw new Error(
83 `Invalid environment variable format: ${envStr}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`,
84 )
85 }
86 parsedEnv[key] = valueParts.join('=')
87 }
88 }
89 return parsedEnv
90}
91
92/**
93 * Get the AWS region with fallback to default

Callers 1

registerMcpAddCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected