Documentation
¶
Overview ¶
Package v1 provides the REST API handlers for MCP Registry access.
Package v1 provides the REST API server for MCP Registry access.
Index ¶
- Constants
- func HealthRouter(svc service.RegistryService) http.Handler
- func LoggingMiddleware(next http.Handler) http.Handler
- func NewServer(svc service.RegistryService, opts ...ServerOption) *chi.Mux
- func Router(svc service.RegistryService) http.Handler
- type EnvVarDetail
- type ErrorResponse
- type ListServersResponse
- type RegistryInfoResponse
- type Routes
- type ServerDetailResponse
- type ServerOption
- type ServerSummaryResponse
Constants ¶
const ( // FormatToolhive is the toolhive format for registry responses FormatToolhive = "toolhive" // FormatUpstream is the upstream MCP registry format FormatUpstream = "upstream" )
Variables ¶
This section is empty.
Functions ¶
func HealthRouter ¶
func HealthRouter(svc service.RegistryService) http.Handler
HealthRouter creates a router for health check endpoints
func LoggingMiddleware ¶
LoggingMiddleware logs HTTP requests
func NewServer ¶
func NewServer(svc service.RegistryService, opts ...ServerOption) *chi.Mux
NewServer creates and configures the HTTP router with the given service and options
Types ¶
type EnvVarDetail ¶
type EnvVarDetail struct {
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
Default string `json:"default,omitempty"`
Secret bool `json:"secret,omitempty"`
}
EnvVarDetail represents detailed environment variable information
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents a standardized error response
type ListServersResponse ¶
type ListServersResponse struct {
Servers []ServerSummaryResponse `json:"servers"`
Total int `json:"total"`
}
ListServersResponse represents the servers list response
type RegistryInfoResponse ¶
type RegistryInfoResponse struct {
Version string `json:"version"`
LastUpdated string `json:"last_updated"`
Source string `json:"source"`
TotalServers int `json:"total_servers"`
}
RegistryInfoResponse represents the registry information response
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
Routes defines the routes for the registry API with dependency injection
func NewRoutes ¶
func NewRoutes(svc service.RegistryService) *Routes
NewRoutes creates a new Routes instance with the provided service
type ServerDetailResponse ¶
type ServerDetailResponse struct {
Name string `json:"name"`
Description string `json:"description"`
Tier string `json:"tier"`
Status string `json:"status"`
Transport string `json:"transport"`
Tools []string `json:"tools"`
EnvVars []EnvVarDetail `json:"env_vars,omitempty"`
Permissions map[string]interface{} `json:"permissions,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
RepositoryURL string `json:"repository_url,omitempty"`
Tags []string `json:"tags,omitempty"`
Args []string `json:"args,omitempty"`
Volumes map[string]interface{} `json:"volumes,omitempty"`
Image string `json:"image,omitempty"`
}
ServerDetailResponse represents a server in detail API responses (full view)
func NewServerDetailResponseForTesting ¶
func NewServerDetailResponseForTesting(server registry.ServerMetadata) ServerDetailResponse
NewServerDetailResponseForTesting creates a ServerDetailResponse for testing
type ServerOption ¶
type ServerOption func(*serverConfig)
ServerOption configures the registry API server
func WithMiddlewares ¶
func WithMiddlewares(mw ...func(http.Handler) http.Handler) ServerOption
WithMiddlewares adds middleware to the server
type ServerSummaryResponse ¶
type ServerSummaryResponse struct {
Name string `json:"name"`
Description string `json:"description"`
Tier string `json:"tier"`
Status string `json:"status"`
Transport string `json:"transport"`
ToolsCount int `json:"tools_count"`
}
ServerSummaryResponse represents a server in list API responses (summary view)
func NewServerSummaryResponseForTesting ¶
func NewServerSummaryResponseForTesting(server registry.ServerMetadata) ServerSummaryResponse
NewServerSummaryResponseForTesting creates a ServerSummaryResponse for testing