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

Function parseMCPHTTPTypeConfig

pkg/parser/mcp.go:631–662  ·  view source on GitHub ↗
(mcpConfig map[string]any, toolName string, config *RegistryMCPServerConfig)

Source from the content-addressed store, hash-verified

629}
630
631func parseMCPHTTPTypeConfig(mcpConfig map[string]any, toolName string, config *RegistryMCPServerConfig) error {
632 url, hasURL := mcpConfig["url"]
633 if !hasURL {
634 return fmt.Errorf(
635 "http MCP tool '%s' missing required 'url' field. HTTP MCP servers must specify a URL endpoint. "+
636 "Example:\n"+
637 "mcp-servers:\n"+
638 " %s:\n"+
639 " type: http\n"+
640 " url: \"https://api.example.com/mcp\"\n"+
641 " headers:\n"+
642 " Authorization: \"${{ secrets.API_KEY }}\"",
643 toolName, toolName,
644 )
645 }
646 urlStr, ok := url.(string)
647 if !ok {
648 return fmt.Errorf(
649 "url field must be a string, got %T. Example:\n"+
650 "mcp-servers:\n"+
651 " %s:\n"+
652 " type: http\n"+
653 " url: \"https://api.example.com/mcp\"\n"+
654 " headers:\n"+
655 " Authorization: \"${{ secrets.API_KEY }}\"",
656 url, toolName)
657 }
658 mcpLog.Printf("Tool %s uses HTTP transport with URL: %s", toolName, urlStr)
659 config.URL = urlStr
660 copyStringMapFromAny(mcpConfig["headers"], config.Headers)
661 return nil
662}

Callers 1

ParseMCPConfigFunction · 0.85

Calls 3

copyStringMapFromAnyFunction · 0.85
ErrorfMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected