Documentation
¶
Overview ¶
Package api provides HTTP routing configuration for the MCP server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module("api", fx.Provide(NewAllowedOrigins), fx.Provide(fx.Annotate( NewRouter, fx.ResultTags(`name:"mcp"`), )), )
Module provides the HTTP router with the MCP handler mounted at /mcp.
Functions ¶
func NewRouter ¶
func NewRouter(params RouterParams) http.Handler
NewRouter constructs an HTTP router that mounts the MCP handler at /mcp with the full middleware stack applied, and registers OAuth endpoints.
Types ¶
type AllowedOrigins ¶
type AllowedOrigins []string
AllowedOrigins is the parsed and validated list of full origin URLs allowed for CORS.
func NewAllowedOrigins ¶
func NewAllowedOrigins(raw RawAllowedOrigins) (AllowedOrigins, error)
NewAllowedOrigins parses and validates a RawAllowedOrigins value into an AllowedOrigins list. It splits by comma, trims whitespace, drops empty entries, and validates each entry is a full origin URL with scheme and host (e.g., http://localhost:3000).
type RawAllowedOrigins ¶
type RawAllowedOrigins string
RawAllowedOrigins is the raw comma-separated flag value for allowed CORS origins, injected from main.go via DI.
type RouterParams ¶
type RouterParams struct {
fx.In
MCPHandler http.Handler `name:"mcp-raw"`
Origins AllowedOrigins
AuthHandler *rest.Handler
AuthorizationServerMetadata *appauth.AuthorizationServerMetadata
ProtectedResourceMetadata *oauthex.ProtectedResourceMetadata
TokenVerifier auth.TokenVerifier
Issuer appauth.Issuer
}
RouterParams holds the DI-injected dependencies for the HTTP router.