{"modulePath":"github.com/Ret2Hell/i18n-mcp","version":"v0.18.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package httpserver\n\nPackage httpserver serves MCP over Streamable HTTP.\n\n## Functions\n\n```go\nfunc DevStaticTokenVerifier(cfg AuthConfig) (auth.TokenVerifier, error)\n```\nDevStaticTokenVerifier constructs a verifier using a token from an environment variable. It is intended only for tests and local development.\n\n```go\nfunc NewHandler(cfg Config, provider ServerProvider, logger *slog.Logger) (http.Handler, error)\n```\nNewHandler constructs the production MCP HTTP handler without starting a server. It includes origin protection, optional authentication, and the health endpoint.\n\n```go\nfunc ProtectMCPHandler(handler http.Handler, cfg AuthConfig, verifier auth.TokenVerifier) http.Handler\n```\nProtectMCPHandler requires a valid bearer token when authentication is enabled.\n\n```go\nfunc ProtectedResourceHandler(cfg AuthConfig) http.Handler\n```\nProtectedResourceHandler serves RFC 9728 protected resource metadata.\n\n```go\nfunc Run(ctx context.Context, cfg Config, provider ServerProvider, logger *slog.Logger) error\n```\nRun serves MCP and health endpoints until ctx is canceled or serving fails.\n\n## Types\n\n```go\ntype AuthConfig struct {\n\tRequired             bool     `json:\"required\"`\n\tResourceURL          string   `json:\"resourceUrl,omitempty\"`\n\tResourceName         string   `json:\"resourceName,omitempty\"`\n\tMetadataPath         string   `json:\"metadataPath,omitempty\"`\n\tMetadataURL          string   `json:\"metadataUrl,omitempty\"`\n\tRequiredScopes       []string `json:\"requiredScopes,omitzero\"`\n\tAuthorizationServers []string `json:\"authorizationServers,omitzero\"`\n\tDevStaticTokenEnv    string   `json:\"-\"`\n}\n```\nAuthConfig configures bearer authentication and protected resource metadata.\n\n```go\nfunc DefaultAuthConfig() AuthConfig\n```\nDefaultAuthConfig returns the default HTTP authentication configuration.\n\n```go\nfunc (c AuthConfig) Validate(addr string) error\n```\nValidate checks that the authentication configuration is safe for addr.\n\n```go\ntype Config struct {\n\tAddr           string\n\tMCPPath        string\n\tJSONResponse   bool\n\tTrustedOrigins []string\n\tAuth           AuthConfig\n}\n```\nConfig configures the Streamable HTTP server.\n\n```go\ntype ServerProvider interface {\n\tServerForRequest(req *http.Request) *mcp.Server\n}\n```\nServerProvider returns the MCP server used to handle HTTP requests.\n\n```go\ntype TokenVerifierFactory func(AuthConfig) (auth.TokenVerifier, error)\n```\nTokenVerifierFactory constructs a token verifier from HTTP auth configuration.\n\n","path":"github.com/Ret2Hell/i18n-mcp/internal/httpserver","name":"httpserver","synopsis":"Package httpserver serves MCP over Streamable HTTP.","isRedistributable":true}
