Documentation
¶
Overview ¶
Package validators provides validation functions for MCP Registry Server entities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidServerName ¶
IsValidServerName checks if a server name is valid according to the MCP Registry specification. Returns true if valid, false otherwise. This is a convenience wrapper around ValidateServerName for boolean checks.
func ValidateServerName ¶
ValidateServerName validates a server name according to the MCP Registry specification. The name must be in reverse-DNS format: namespace/name Returns the validated name (trimmed) and an error if validation fails.
Format requirements: - Must contain exactly one '/' separator - Namespace (before /): [a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9] - Name (after /): [a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9] - Total length: 3-200 characters
Examples of valid names:
- com.toolhive.k8s.default/weather-service (K8s auto-discovered)
- com.example/server (manually published)
- org.stacklok.toolhive/my-server (manually published)
- com.example/test_server (manually published - underscores allowed in name part)
Examples of invalid names:
- my-server (missing slash)
- com.example//server (multiple slashes)
- .example/server (namespace starts with dot)
- com.example/server- (name ends with dash)
Types ¶
This section is empty.