v1

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

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

View Source
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

func LoggingMiddleware(next http.Handler) http.Handler

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

func Router

func Router(svc service.RegistryService) http.Handler

Router creates a new router for the registry API

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

type ServerResponse

type ServerResponse 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"`
}

ServerResponse represents a server in API responses

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL