Skip to content

Commit bbaa877

Browse files
committed
Fix linter issues
1 parent 97e8f35 commit bbaa877

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

cmd/github-mcp-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ var (
9797
Long: `Start an HTTP server that listens for MCP requests over HTTP.`,
9898
RunE: func(_ *cobra.Command, _ []string) error {
9999
ttl := viper.GetDuration("repo-access-cache-ttl")
100-
httpConfig := ghhttp.HTTPServerConfig{
100+
httpConfig := ghhttp.ServerConfig{
101101
Version: version,
102102
Host: viper.GetString("host"),
103103
Port: viper.GetInt("port"),

pkg/github/server_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ func (s stubDeps) GetRawClient(ctx context.Context) (*raw.Client, error) {
5252
return nil, nil
5353
}
5454

55-
func (s stubDeps) GetRepoAccessCache(ctx context.Context) (*lockdown.RepoAccessCache, error) {
55+
func (s stubDeps) GetRepoAccessCache(_ context.Context) (*lockdown.RepoAccessCache, error) {
5656
return s.repoAccessCache, nil
5757
}
5858
func (s stubDeps) GetT() translations.TranslationHelperFunc { return s.t }
59-
func (s stubDeps) GetFlags(ctx context.Context) FeatureFlags { return s.flags }
59+
func (s stubDeps) GetFlags(_ context.Context) FeatureFlags { return s.flags }
6060
func (s stubDeps) GetContentWindowSize() int { return s.contentWindowSize }
6161
func (s stubDeps) IsFeatureEnabled(_ context.Context, _ string) bool { return false }
6262

pkg/http/handler.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,43 @@ import (
1818
type InventoryFactoryFunc func(r *http.Request) (*inventory.Inventory, error)
1919
type GitHubMCPServerFactoryFunc func(r *http.Request, deps github.ToolDependencies, inventory *inventory.Inventory, cfg *github.MCPServerConfig) (*mcp.Server, error)
2020

21-
type HTTPMcpHandler struct {
21+
type Handler struct {
2222
ctx context.Context
23-
config *HTTPServerConfig
23+
config *ServerConfig
2424
deps github.ToolDependencies
2525
logger *slog.Logger
2626
t translations.TranslationHelperFunc
2727
githubMcpServerFactory GitHubMCPServerFactoryFunc
2828
inventoryFactoryFunc InventoryFactoryFunc
2929
}
3030

31-
type HTTPMcpHandlerOptions struct {
31+
type HandlerOptions struct {
3232
GitHubMcpServerFactory GitHubMCPServerFactoryFunc
3333
InventoryFactory InventoryFactoryFunc
3434
}
3535

36-
type HTTPMcpHandlerOption func(*HTTPMcpHandlerOptions)
36+
type HandlerOption func(*HandlerOptions)
3737

38-
func WithGitHubMCPServerFactory(f GitHubMCPServerFactoryFunc) HTTPMcpHandlerOption {
39-
return func(o *HTTPMcpHandlerOptions) {
38+
func WithGitHubMCPServerFactory(f GitHubMCPServerFactoryFunc) HandlerOption {
39+
return func(o *HandlerOptions) {
4040
o.GitHubMcpServerFactory = f
4141
}
4242
}
4343

44-
func WithInventoryFactory(f InventoryFactoryFunc) HTTPMcpHandlerOption {
45-
return func(o *HTTPMcpHandlerOptions) {
44+
func WithInventoryFactory(f InventoryFactoryFunc) HandlerOption {
45+
return func(o *HandlerOptions) {
4646
o.InventoryFactory = f
4747
}
4848
}
4949

5050
func NewHTTPMcpHandler(
5151
ctx context.Context,
52-
cfg *HTTPServerConfig,
52+
cfg *ServerConfig,
5353
deps github.ToolDependencies,
5454
t translations.TranslationHelperFunc,
5555
logger *slog.Logger,
56-
options ...HTTPMcpHandlerOption) *HTTPMcpHandler {
57-
opts := &HTTPMcpHandlerOptions{}
56+
options ...HandlerOption) *Handler {
57+
opts := &HandlerOptions{}
5858
for _, o := range options {
5959
o(opts)
6060
}
@@ -69,7 +69,7 @@ func NewHTTPMcpHandler(
6969
inventoryFactory = DefaultInventoryFactory(cfg, t, nil)
7070
}
7171

72-
return &HTTPMcpHandler{
72+
return &Handler{
7373
ctx: ctx,
7474
config: cfg,
7575
deps: deps,
@@ -82,7 +82,7 @@ func NewHTTPMcpHandler(
8282

8383
// RegisterRoutes registers the routes for the MCP server
8484
// URL-based values take precedence over header-based values
85-
func (h *HTTPMcpHandler) RegisterRoutes(r chi.Router) {
85+
func (h *Handler) RegisterRoutes(r chi.Router) {
8686
r.Use(middleware.WithRequestConfig)
8787

8888
r.Mount("/", h)
@@ -109,7 +109,7 @@ func withToolset(next http.Handler) http.Handler {
109109
})
110110
}
111111

112-
func (h *HTTPMcpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
112+
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
113113
inventory, err := h.inventoryFactoryFunc(r)
114114
if err != nil {
115115
w.WriteHeader(http.StatusInternalServerError)
@@ -128,7 +128,7 @@ func (h *HTTPMcpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
128128
w.WriteHeader(http.StatusInternalServerError)
129129
}
130130

131-
mcpHandler := mcp.NewStreamableHTTPHandler(func(r *http.Request) *mcp.Server {
131+
mcpHandler := mcp.NewStreamableHTTPHandler(func(_ *http.Request) *mcp.Server {
132132
return ghServer
133133
}, &mcp.StreamableHTTPOptions{
134134
Stateless: true,
@@ -141,7 +141,7 @@ func DefaultGitHubMCPServerFactory(r *http.Request, deps github.ToolDependencies
141141
return github.NewMCPServer(r.Context(), cfg, deps, inventory)
142142
}
143143

144-
func DefaultInventoryFactory(cfg *HTTPServerConfig, t translations.TranslationHelperFunc, staticChecker inventory.FeatureFlagChecker) InventoryFactoryFunc {
144+
func DefaultInventoryFactory(_ *ServerConfig, t translations.TranslationHelperFunc, staticChecker inventory.FeatureFlagChecker) InventoryFactoryFunc {
145145
return func(r *http.Request) (*inventory.Inventory, error) {
146146
b := github.NewInventory(t).WithDeprecatedAliases(github.DeprecatedToolAliases)
147147

pkg/http/handler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func TestHTTPHandlerRoutes(t *testing.T) {
252252
// Create handler with our factories
253253
handler := NewHTTPMcpHandler(
254254
context.Background(),
255-
&HTTPServerConfig{Version: "test"},
255+
&ServerConfig{Version: "test"},
256256
nil, // deps not needed for this test
257257
translations.NullTranslationHelper,
258258
slog.Default(),

pkg/http/middleware/token.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var (
2424
errMissingAuthorizationHeader = fmt.Errorf("%w: missing required Authorization header", mark.ErrBadRequest)
2525
errBadAuthorizationHeader = fmt.Errorf("%w: Authorization header is badly formatted", mark.ErrBadRequest)
2626
errUnsupportedAuthorizationHeader = fmt.Errorf("%w: unsupported Authorization header", mark.ErrBadRequest)
27-
errMissingTokenInfoHeader = fmt.Errorf("%w: missing required token info header", mark.ErrBadRequest)
2827
)
2928

3029
var supportedThirdPartyTokenPrefixes = []string{

pkg/http/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/go-chi/chi/v5"
1919
)
2020

21-
type HTTPServerConfig struct {
21+
type ServerConfig struct {
2222
// Version of the server
2323
Version string
2424

@@ -48,7 +48,7 @@ type HTTPServerConfig struct {
4848
RepoAccessCacheTTL *time.Duration
4949
}
5050

51-
func RunHTTPServer(cfg HTTPServerConfig) error {
51+
func RunHTTPServer(cfg ServerConfig) error {
5252
// Create app context
5353
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
5454
defer stop()

0 commit comments

Comments
 (0)