@@ -19,9 +19,9 @@ import (
1919type InventoryFactoryFunc func (r * http.Request ) (* inventory.Inventory , error )
2020type GitHubMCPServerFactoryFunc func (r * http.Request , deps github.ToolDependencies , inventory * inventory.Inventory , cfg * github.MCPServerConfig ) (* mcp.Server , error )
2121
22- type HTTPMcpHandler struct {
22+ type Handler struct {
2323 ctx context.Context
24- config * HTTPServerConfig
24+ config * ServerConfig
2525 deps github.ToolDependencies
2626 logger * slog.Logger
2727 t translations.TranslationHelperFunc
@@ -30,40 +30,40 @@ type HTTPMcpHandler struct {
3030 oauthCfg * oauth.Config
3131}
3232
33- type HTTPMcpHandlerOptions struct {
33+ type HandlerOptions struct {
3434 GitHubMcpServerFactory GitHubMCPServerFactoryFunc
3535 InventoryFactory InventoryFactoryFunc
3636 OAuthConfig * oauth.Config
3737}
3838
39- type HTTPMcpHandlerOption func (* HTTPMcpHandlerOptions )
39+ type HandlerOption func (* HandlerOptions )
4040
41- func WithGitHubMCPServerFactory (f GitHubMCPServerFactoryFunc ) HTTPMcpHandlerOption {
42- return func (o * HTTPMcpHandlerOptions ) {
41+ func WithGitHubMCPServerFactory (f GitHubMCPServerFactoryFunc ) HandlerOption {
42+ return func (o * HandlerOptions ) {
4343 o .GitHubMcpServerFactory = f
4444 }
4545}
4646
47- func WithInventoryFactory (f InventoryFactoryFunc ) HTTPMcpHandlerOption {
48- return func (o * HTTPMcpHandlerOptions ) {
47+ func WithInventoryFactory (f InventoryFactoryFunc ) HandlerOption {
48+ return func (o * HandlerOptions ) {
4949 o .InventoryFactory = f
5050 }
5151}
5252
53- func WithOAuthConfig (cfg * oauth.Config ) HTTPMcpHandlerOption {
54- return func (o * HTTPMcpHandlerOptions ) {
53+ func WithOAuthConfig (cfg * oauth.Config ) HandlerOption {
54+ return func (o * HandlerOptions ) {
5555 o .OAuthConfig = cfg
5656 }
5757}
5858
5959func NewHTTPMcpHandler (
6060 ctx context.Context ,
61- cfg * HTTPServerConfig ,
61+ cfg * ServerConfig ,
6262 deps github.ToolDependencies ,
6363 t translations.TranslationHelperFunc ,
6464 logger * slog.Logger ,
65- options ... HTTPMcpHandlerOption ) * HTTPMcpHandler {
66- opts := & HTTPMcpHandlerOptions {}
65+ options ... HandlerOption ) * Handler {
66+ opts := & HandlerOptions {}
6767 for _ , o := range options {
6868 o (opts )
6969 }
@@ -78,7 +78,7 @@ func NewHTTPMcpHandler(
7878 inventoryFactory = DefaultInventoryFactory (cfg , t , nil )
7979 }
8080
81- return & HTTPMcpHandler {
81+ return & Handler {
8282 ctx : ctx ,
8383 config : cfg ,
8484 deps : deps ,
@@ -92,7 +92,7 @@ func NewHTTPMcpHandler(
9292
9393// RegisterRoutes registers the routes for the MCP server
9494// URL-based values take precedence over header-based values
95- func (h * HTTPMcpHandler ) RegisterRoutes (r chi.Router ) {
95+ func (h * Handler ) RegisterRoutes (r chi.Router ) {
9696 r .Use (middleware .WithRequestConfig )
9797
9898 r .Mount ("/" , h )
@@ -119,7 +119,7 @@ func withToolset(next http.Handler) http.Handler {
119119 })
120120}
121121
122- func (h * HTTPMcpHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
122+ func (h * Handler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
123123 inventory , err := h .inventoryFactoryFunc (r )
124124 if err != nil {
125125 w .WriteHeader (http .StatusInternalServerError )
@@ -157,7 +157,7 @@ func DefaultGitHubMCPServerFactory(r *http.Request, deps github.ToolDependencies
157157 }, deps , inventory )
158158}
159159
160- func DefaultInventoryFactory (cfg * HTTPServerConfig , t translations.TranslationHelperFunc , staticChecker inventory.FeatureFlagChecker ) InventoryFactoryFunc {
160+ func DefaultInventoryFactory (cfg * ServerConfig , t translations.TranslationHelperFunc , staticChecker inventory.FeatureFlagChecker ) InventoryFactoryFunc {
161161 return func (r * http.Request ) (* inventory.Inventory , error ) {
162162 b := github .NewInventory (t ).WithDeprecatedAliases (github .DeprecatedToolAliases )
163163
0 commit comments