Documentation
¶
Index ¶
- func ExtractUserToken(oauthCfg *oauth.Config) func(next http.Handler) http.Handler
- func WithMCPParse() func(http.Handler) http.Handler
- func WithPATScopes(logger *slog.Logger, scopeFetcher scopes.FetcherInterface) func(http.Handler) http.Handler
- func WithRequestConfig(next http.Handler) http.Handler
- func WithScopeChallenge(oauthCfg *oauth.Config, scopeFetcher scopes.FetcherInterface) func(http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractUserToken ¶
func WithMCPParse ¶
WithMCPParse creates a middleware that parses MCP JSON-RPC requests early in the request lifecycle and stores the parsed information in the request context. This enables:
- Registry filtering via ForMCPRequest (only register needed tools/resources/prompts)
- Avoiding duplicate JSON parsing in downstream middlewares
- Access to owner/repo for secret-scanning middleware
The middleware reads the request body, parses it, restores the body for downstream handlers, and stores the parsed MCPMethodInfo in the request context.
func WithPATScopes ¶
func WithPATScopes(logger *slog.Logger, scopeFetcher scopes.FetcherInterface) func(http.Handler) http.Handler
WithPATScopes is a middleware that fetches and stores scopes for classic Personal Access Tokens (PATs) in the request context.
func WithRequestConfig ¶
WithRequestConfig is a middleware that extracts MCP-related headers and sets them in the request context. This includes readonly mode, toolsets, tools, lockdown mode, insiders mode, and feature flags.
func WithScopeChallenge ¶
func WithScopeChallenge(oauthCfg *oauth.Config, scopeFetcher scopes.FetcherInterface) func(http.Handler) http.Handler
WithScopeChallenge creates a new middleware that determines if an OAuth request contains sufficient scopes to complete the request and returns a scope challenge if not.
Types ¶
This section is empty.