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 ErrorResponse
- type ListServersResponse
- type RegistryInfoResponse
- type Routes
- type ServerOption
- type ServerResponse
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 ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse represents a standardized error response
type ListServersResponse ¶
type ListServersResponse struct {
Servers []ServerResponse `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 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