api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package api provides the REST API server for MCP Registry access.

Package api provides common API types and responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs HTTP requests

func NewInternalServer added in v1.1.0

func NewInternalServer(svc service.RegistryService) *chi.Mux

NewInternalServer creates a minimal HTTP router for internal operational endpoints (health, readiness, version). These endpoints are intended to run on a separate port so that Kubernetes probes hit a dedicated server that carries no authentication or application middleware.

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 HealthResponse added in v0.4.1

type HealthResponse struct {
	Status string `json:"status" example:"healthy"`
}

HealthResponse represents the health check response

type ReadinessResponse added in v0.4.1

type ReadinessResponse struct {
	Status string `json:"status" example:"ready"`
}

ReadinessResponse represents the readiness check response

type ServerOption

type ServerOption func(*serverConfig)

ServerOption configures the registry API server

func WithAuthConfig added in v1.2.0

func WithAuthConfig(authCfg *config.AuthConfig) ServerOption

WithAuthConfig sets the authentication configuration used by the v1 router. Both role-based access control (Authz) and publish-time claim enforcement (Mode) are derived from it.

func WithAuthInfoHandler added in v0.3.0

func WithAuthInfoHandler(handler http.Handler) ServerOption

WithAuthInfoHandler sets the auth info handler to be mounted at /.well-known/oauth-protected-resource

func WithMiddlewares

func WithMiddlewares(mw ...func(http.Handler) http.Handler) ServerOption

WithMiddlewares adds middleware to the server

type VersionResponse added in v0.4.1

type VersionResponse struct {
	Version   string `json:"version" example:"v0.1.0"`
	Commit    string `json:"commit" example:"abc123def"`
	BuildDate string `json:"build_date" example:"2025-01-15T10:30:00Z"`
	GoVersion string `json:"go_version" example:"go1.21.5"`
	Platform  string `json:"platform" example:"linux/amd64"`
}

VersionResponse represents the version information response

Directories

Path Synopsis
Package common provides shared HTTP utility functions for API handlers.
Package common provides shared HTTP utility functions for API handlers.
registry
v01
Package v01 provides registry API v0.1 endpoints for MCP server discovery.
Package v01 provides registry API v0.1 endpoints for MCP server discovery.
Package v1 provides API v1 endpoints for managing sources, registries, and entries.
Package v1 provides API v1 endpoints for managing sources, registries, and entries.
x
skills
Package skills provides API types and handlers for the dev.toolhive/skills extension endpoints (THV-0029).
Package skills provides API types and handlers for the dev.toolhive/skills extension endpoints (THV-0029).

Jump to

Keyboard shortcuts

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