Documentation
¶
Overview ¶
Package v1 contains the V1 API for ToolHive.
Index ¶
- Constants
- func ClientRouter(manager client.Manager, workloadManager workloads.Manager, ...) http.Handler
- func DiscoveryRouter() http.Handler
- func GroupsRouter(groupManager groups.Manager, workloadManager workloads.Manager, ...) http.Handler
- func HealthcheckRouter(containerRuntime rt.Runtime, nonce string) http.Handler
- func RegistryRouter(serveMode bool) http.Handler
- func SecretsRouter() http.Handler
- func SkillsRouter(skillService skills.SkillService) http.Handler
- func VersionRouter() http.Handler
- func WorkloadRouter(workloadManager workloads.Manager, containerRuntime runtime.Runtime, ...) http.Handler
- type ClientRoutes
- type DiscoveryRoutes
- type GroupsRoutes
- type RegistryRoutes
- type RegistryType
- type SecretsRoutes
- type SkillsRoutes
- type UpdateRegistryAuthRequest
- type UpdateRegistryRequest
- type UpdateRegistryResponse
- type WorkloadRoutes
- type WorkloadService
- func (s *WorkloadService) BuildFullRunConfig(ctx context.Context, req *createRequest, existingPort int) (*runner.RunConfig, error)
- func (s *WorkloadService) CreateWorkloadFromRequest(ctx context.Context, req *createRequest) (*runner.RunConfig, error)
- func (s *WorkloadService) GetWorkloadNamesFromRequest(ctx context.Context, req bulkOperationRequest) ([]string, error)
- func (s *WorkloadService) UpdateWorkloadFromRequest(ctx context.Context, name string, req *createRequest, existingPort int) (*runner.RunConfig, error)
Constants ¶
const RegistryAuthRequiredCode = "registry_auth_required"
RegistryAuthRequiredCode is the machine-readable error code returned in the structured JSON 503 response when registry authentication is missing. Desktop clients (Studio) match on this value to display the correct UI.
RegistryUnavailableCode is the machine-readable error code returned in the structured JSON 503 response when the upstream registry is unreachable.
Variables ¶
This section is empty.
Functions ¶
func ClientRouter ¶ added in v0.0.43
func ClientRouter( manager client.Manager, workloadManager workloads.Manager, groupManager groups.Manager, ) http.Handler
ClientRouter creates a new router for the client API.
func DiscoveryRouter ¶ added in v0.0.41
DiscoveryRouter creates a new router for the client discovery API.
func GroupsRouter ¶ added in v0.2.2
func GroupsRouter(groupManager groups.Manager, workloadManager workloads.Manager, clientManager client.Manager) http.Handler
GroupsRouter creates a new GroupsRoutes instance.
func HealthcheckRouter ¶
HealthcheckRouter sets up healthcheck route. The nonce parameter, when non-empty, is returned via the X-Toolhive-Nonce header so clients can verify they are talking to the expected server instance.
func RegistryRouter ¶ added in v0.0.40
RegistryRouter creates a new router for the registry API. When serveMode is true, the registry provider uses non-interactive auth, ensuring browser-based OAuth flows are never triggered from API requests.
func SecretsRouter ¶ added in v0.0.48
SecretsRouter creates a new router for the secrets API.
func SkillsRouter ¶ added in v0.9.2
func SkillsRouter(skillService skills.SkillService) http.Handler
SkillsRouter creates a new router for skill management endpoints.
Types ¶
type ClientRoutes ¶ added in v0.0.43
type ClientRoutes struct {
// contains filtered or unexported fields
}
ClientRoutes defines the routes for the client API.
type DiscoveryRoutes ¶ added in v0.0.41
type DiscoveryRoutes struct{}
DiscoveryRoutes defines the routes for the client discovery API.
type GroupsRoutes ¶ added in v0.2.2
type GroupsRoutes struct {
// contains filtered or unexported fields
}
GroupsRoutes defines the routes for group management.
type RegistryRoutes ¶ added in v0.0.40
type RegistryRoutes struct {
// contains filtered or unexported fields
}
RegistryRoutes defines the routes for the registry API.
func NewRegistryRoutes ¶ added in v0.2.16
func NewRegistryRoutes() *RegistryRoutes
NewRegistryRoutes creates a new RegistryRoutes with the default config provider
func NewRegistryRoutesForServe ¶ added in v0.12.5
func NewRegistryRoutesForServe() *RegistryRoutes
NewRegistryRoutesForServe creates RegistryRoutes configured for serve mode. In serve mode, the registry provider uses non-interactive auth (no browser OAuth).
func NewRegistryRoutesWithProvider ¶ added in v0.2.16
func NewRegistryRoutesWithProvider(provider config.Provider) *RegistryRoutes
NewRegistryRoutesWithProvider creates a new RegistryRoutes with a custom config provider This is useful for testing
type RegistryType ¶ added in v0.2.5
type RegistryType string
RegistryType represents the type of registry
const ( // RegistryTypeFile represents a local file registry RegistryTypeFile RegistryType = "file" // RegistryTypeURL represents a remote URL registry RegistryTypeURL RegistryType = "url" // RegistryTypeAPI represents an MCP Registry API endpoint RegistryTypeAPI RegistryType = "api" // RegistryTypeDefault represents a built-in registry RegistryTypeDefault RegistryType = "default" )
type SecretsRoutes ¶ added in v0.0.48
type SecretsRoutes struct {
// contains filtered or unexported fields
}
SecretsRoutes defines the routes for the secrets API.
func NewSecretsRoutes ¶ added in v0.2.16
func NewSecretsRoutes() *SecretsRoutes
NewSecretsRoutes creates a new SecretsRoutes with the default config provider
func NewSecretsRoutesWithProvider ¶ added in v0.2.16
func NewSecretsRoutesWithProvider(provider config.Provider) *SecretsRoutes
NewSecretsRoutesWithProvider creates a new SecretsRoutes with a custom config provider
type SkillsRoutes ¶ added in v0.9.2
type SkillsRoutes struct {
// contains filtered or unexported fields
}
SkillsRoutes defines the routes for skill management.
type UpdateRegistryAuthRequest ¶ added in v0.12.5
type UpdateRegistryAuthRequest struct {
// OIDC issuer URL
Issuer string `json:"issuer"`
// OAuth client ID
ClientID string `json:"client_id"`
// OAuth audience (optional)
Audience string `json:"audience,omitempty"`
// OAuth scopes (optional)
Scopes []string `json:"scopes,omitempty"`
}
UpdateRegistryAuthRequest contains OAuth configuration fields for registry auth.
type UpdateRegistryRequest ¶ added in v0.2.4
type UpdateRegistryRequest struct {
// Registry URL (for remote registries)
URL *string `json:"url,omitempty"`
// MCP Registry API URL
APIURL *string `json:"api_url,omitempty"`
// Local registry file path
LocalPath *string `json:"local_path,omitempty"`
// Allow private IP addresses for registry URL or API URL
AllowPrivateIP *bool `json:"allow_private_ip,omitempty"`
// OAuth authentication configuration (optional)
Auth *UpdateRegistryAuthRequest `json:"auth,omitempty"`
}
UpdateRegistryRequest represents the request for updating a registry
@Description Request containing registry configuration updates
type UpdateRegistryResponse ¶ added in v0.2.4
type UpdateRegistryResponse struct {
// Registry type after update
Type string `json:"type"`
}
UpdateRegistryResponse represents the response for updating a registry
@Description Response containing update result
type WorkloadRoutes ¶ added in v0.0.43
type WorkloadRoutes struct {
// contains filtered or unexported fields
}
WorkloadRoutes defines the routes for workload management.
type WorkloadService ¶ added in v0.2.17
type WorkloadService struct {
// contains filtered or unexported fields
}
WorkloadService handles business logic for workload operations
func NewWorkloadService ¶ added in v0.2.17
func NewWorkloadService( workloadManager workloads.Manager, groupManager groups.Manager, containerRuntime runtime.Runtime, debugMode bool, ) *WorkloadService
NewWorkloadService creates a new WorkloadService instance
func (*WorkloadService) BuildFullRunConfig ¶ added in v0.3.0
func (s *WorkloadService) BuildFullRunConfig( ctx context.Context, req *createRequest, existingPort int, ) (*runner.RunConfig, error)
BuildFullRunConfig builds a complete RunConfig
func (*WorkloadService) CreateWorkloadFromRequest ¶ added in v0.2.17
func (s *WorkloadService) CreateWorkloadFromRequest(ctx context.Context, req *createRequest) (*runner.RunConfig, error)
CreateWorkloadFromRequest creates a workload from a request
func (*WorkloadService) GetWorkloadNamesFromRequest ¶ added in v0.2.17
func (s *WorkloadService) GetWorkloadNamesFromRequest(ctx context.Context, req bulkOperationRequest) ([]string, error)
GetWorkloadNamesFromRequest gets workload names from either the names field or group
func (*WorkloadService) UpdateWorkloadFromRequest ¶ added in v0.3.0
func (s *WorkloadService) UpdateWorkloadFromRequest(ctx context.Context, name string, req *createRequest, existingPort int) (*runner.RunConfig, error)
UpdateWorkloadFromRequest updates a workload from a request