MCPcopy Index your code
hub / github.com/modelcontextprotocol/registry / IsValidURL

Function IsValidURL

internal/validators/utils.go:78–97  ·  view source on GitHub ↗

IsValidURL checks if a URL is in valid format (basic structure validation)

(rawURL string)

Source from the content-addressed store, hash-verified

76
77// IsValidURL checks if a URL is in valid format (basic structure validation)
78func IsValidURL(rawURL string) bool {
79 // Replace template variables with placeholders for parsing
80 testURL := replaceTemplateVariables(rawURL)
81
82 // Parse the URL
83 u, err := url.Parse(testURL)
84 if err != nil {
85 return false
86 }
87
88 // Check if scheme is present (http or https)
89 if u.Scheme != "http" && u.Scheme != "https" {
90 return false
91 }
92
93 if u.Host == "" {
94 return false
95 }
96 return true
97}
98
99// IsValidSubfolderPath checks if a subfolder path is valid
100func IsValidSubfolderPath(path string) bool {

Callers 2

IsValidRemoteURLFunction · 0.85
IsValidTemplatedURLFunction · 0.85

Calls 1

replaceTemplateVariablesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…