MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseStdioEnv

Function parseStdioEnv

packages/plugins/mcp/src/react/stdio-fields.ts:32–44  ·  view source on GitHub ↗
(raw: string)

Source from the content-addressed store, hash-verified

30 * comments, and lines without a key are dropped; an empty value is kept
31 * (declaring a variable as empty is meaningful to a subprocess). */
32export function parseStdioEnv(raw: string): Record<string, string> {
33 const env: Record<string, string> = {};
34 for (const line of raw.split("\n")) {
35 const trimmed = line.trim();
36 if (trimmed === "" || trimmed.startsWith("#")) continue;
37 const separator = trimmed.indexOf("=");
38 if (separator <= 0) continue;
39 const key = trimmed.slice(0, separator).trim();
40 if (key === "") continue;
41 env[key] = trimmed.slice(separator + 1).trim();
42 }
43 return env;
44}
45
46/** Render the stored env map back into the KEY=value block. */
47export function formatStdioEnv(env: Readonly<Record<string, string>> | undefined): string {

Callers 2

StdioEditFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected