MCPcopy Create free account
hub / github.com/github/gh-aw / loadWorkflowMCPConfigs

Function loadWorkflowMCPConfigs

pkg/cli/mcp_workflow_loader.go:24–47  ·  view source on GitHub ↗

loadWorkflowMCPConfigs loads a workflow file and extracts MCP configurations. This is a shared helper used by multiple MCP commands to avoid code duplication. Parameters: - workflowPath: absolute path to the workflow file - serverFilter: optional server name to filter by (empty string for no filter

(workflowPath string, serverFilter string)

Source from the content-addressed store, hash-verified

22// - []parser.RegistryMCPServerConfig: list of MCP server configurations
23// - error: any error that occurred during loading or parsing
24func loadWorkflowMCPConfigs(workflowPath string, serverFilter string) (*parser.FrontmatterResult, []parser.RegistryMCPServerConfig, error) {
25 mcpWorkflowLoaderLog.Printf("Loading MCP configs: path=%s, server_filter=%q", workflowPath, serverFilter)
26
27 // Read the workflow file
28 content, err := os.ReadFile(workflowPath)
29 if err != nil {
30 return nil, nil, fmt.Errorf("failed to read workflow file: %w", err)
31 }
32
33 // Parse the frontmatter
34 workflowData, err := parser.ExtractFrontmatterFromContent(string(content))
35 if err != nil {
36 return nil, nil, fmt.Errorf("failed to parse workflow file: %w", err)
37 }
38
39 // Extract MCP configurations
40 mcpConfigs, err := parser.ExtractMCPConfigurations(workflowData.Frontmatter, serverFilter)
41 if err != nil {
42 return nil, nil, fmt.Errorf("failed to extract MCP configurations: %w", err)
43 }
44
45 mcpWorkflowLoaderLog.Printf("Loaded %d MCP configurations from workflow", len(mcpConfigs))
46 return workflowData, mcpConfigs, nil
47}

Callers 3

ListToolsForMCPFunction · 0.85
ListWorkflowMCPFunction · 0.85

Calls 4

ExtractMCPConfigurationsFunction · 0.92
PrintfMethod · 0.45
ErrorfMethod · 0.45

Tested by 1