MCPcopy
hub / github.com/github/github-mcp-server / RegisterMiddleware

Method RegisterMiddleware

pkg/http/handler.go:128–139  ·  view source on GitHub ↗
(r chi.Router)

Source from the content-addressed store, hash-verified

126}
127
128func (h *Handler) RegisterMiddleware(r chi.Router) {
129 r.Use(
130 middleware.ExtractUserToken(h.oauthCfg),
131 middleware.WithRequestConfig,
132 middleware.WithMCPParse(),
133 middleware.WithPATScopes(h.logger, h.scopeFetcher),
134 )
135
136 if h.config.ScopeChallenge {
137 r.Use(middleware.WithScopeChallenge(h.oauthCfg, h.scopeFetcher))
138 }
139}
140
141// RegisterRoutes registers the routes for the MCP server
142// URL-based values take precedence over header-based values

Callers 5

RunHTTPServerFunction · 0.80
TestHTTPHandlerRoutesFunction · 0.80
TestContentTypeHandlingFunction · 0.80

Calls 4

ExtractUserTokenFunction · 0.92
WithMCPParseFunction · 0.92
WithPATScopesFunction · 0.92
WithScopeChallengeFunction · 0.92

Tested by 4

TestHTTPHandlerRoutesFunction · 0.64
TestContentTypeHandlingFunction · 0.64