Help us shape the future of Go! Take the 2026 Go Developer Survey

middleware

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractUserToken

func ExtractUserToken(oauthCfg *oauth.Config) func(next http.Handler) http.Handler

func WithMCPParse

func WithMCPParse() func(http.Handler) http.Handler

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

func WithRequestConfig(next http.Handler) http.Handler

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.

Jump to

Keyboard shortcuts

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