MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / resolveMcpConfigEnv

Function resolveMcpConfigEnv

sdk/src/agents/load-mcp-config.ts:81–87  ·  view source on GitHub ↗

* Resolves all MCP server env references in a config. * Mutates the mcpServers object to replace $VAR_NAME references with resolved values. * * @param config - The MCP file config to process * @throws Error if any referenced environment variable is missing

(config: MCPFileConfig)

Source from the content-addressed store, hash-verified

79 * @throws Error if any referenced environment variable is missing
80 */
81function resolveMcpConfigEnv(config: MCPFileConfig): void {
82 for (const [serverName, serverConfig] of Object.entries(config.mcpServers)) {
83 if ('command' in serverConfig && serverConfig.env) {
84 serverConfig.env = resolveMcpEnv(serverConfig.env, serverName)
85 }
86 }
87}
88
89const MCP_CONFIG_FILE_NAME = 'mcp.json'
90

Callers 2

loadMCPConfigFunction · 0.85
loadMCPConfigSyncFunction · 0.85

Calls 1

resolveMcpEnvFunction · 0.70

Tested by

no test coverage detected