collectMCPScriptsSecrets collects all secrets from mcp-scripts configuration
(mcpScripts *MCPScriptsConfig)
| 12 | |
| 13 | // collectMCPScriptsSecrets collects all secrets from mcp-scripts configuration |
| 14 | func collectMCPScriptsSecrets(mcpScripts *MCPScriptsConfig) map[string]string { |
| 15 | secrets := make(map[string]string) |
| 16 | |
| 17 | if mcpScripts == nil { |
| 18 | mcpScriptsRendererLog.Print("No mcp-scripts configuration provided for secret collection") |
| 19 | return secrets |
| 20 | } |
| 21 | |
| 22 | mcpScriptsRendererLog.Printf("Collecting secrets from %d mcp-scripts tools", len(mcpScripts.Tools)) |
| 23 | |
| 24 | // Sort tool names for consistent behavior when same env var appears in multiple tools |
| 25 | toolNames := sliceutil.SortedKeys(mcpScripts.Tools) |
| 26 | |
| 27 | for _, toolName := range toolNames { |
| 28 | toolConfig := mcpScripts.Tools[toolName] |
| 29 | // Sort env var names for consistent order within each tool |
| 30 | envNames := sliceutil.SortedKeys(toolConfig.Env) |
| 31 | |
| 32 | for _, envName := range envNames { |
| 33 | secrets[envName] = toolConfig.Env[envName] |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | mcpScriptsRendererLog.Printf("Collected %d secrets from mcp-scripts configuration", len(secrets)) |
| 38 | return secrets |
| 39 | } |
| 40 | |
| 41 | // renderMCPScriptsMCPConfigWithOptions generates the MCP Scripts server configuration with engine-specific options |
| 42 | // Always uses HTTP transport mode |