Skip to content

Commit d45c414

Browse files
committed
move middleware in RegisterRoutes
1 parent 9320ca0 commit d45c414

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/http/handler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ func NewHTTPMcpHandler(cfg *HTTPServerConfig,
7676
}
7777
}
7878

79+
// RegisterRoutes registers the routes for the MCP server
7980
func (h *HTTPMcpHandler) RegisterRoutes(r chi.Router) {
80-
r.Mount("/", h)
81+
r.Use(middleware.WithRequestConfig)
8182

83+
r.Mount("/", h)
8284
// Mount readonly and toolset routes
8385
r.With(withToolset).Mount("/x/{toolset}", h)
8486
r.With(withReadonly, withToolset).Mount("/x/{toolset}/readonly", h)

pkg/http/server.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"time"
1313

1414
"github.com/github/github-mcp-server/pkg/github"
15-
"github.com/github/github-mcp-server/pkg/http/middleware"
1615
"github.com/github/github-mcp-server/pkg/lockdown"
1716
"github.com/github/github-mcp-server/pkg/translations"
1817
"github.com/github/github-mcp-server/pkg/utils"
@@ -99,7 +98,6 @@ func RunHTTPServer(cfg HTTPServerConfig) error {
9998
r := chi.NewRouter()
10099

101100
handler := NewHTTPMcpHandler(&cfg, deps, t, logger)
102-
r.Use(middleware.WithRequestConfig)
103101
handler.RegisterRoutes(r)
104102

105103
addr := fmt.Sprintf(":%d", cfg.Port)

0 commit comments

Comments
 (0)