Skip to content

Commit c9573f2

Browse files
committed
Address comments from Copilot review
1 parent e98016c commit c9573f2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/http/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,13 @@ func SetCorsHeaders(h http.Handler) http.Handler {
427427
w.Header().Set("Access-Control-Max-Age", "86400")
428428
w.Header().Set("Access-Control-Expose-Headers", "Mcp-Session-Id")
429429
w.Header().Set("Access-Control-Allow-Headers", fmt.Sprintf(
430-
"Content-Type, Authorization, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID, %s, %s, %s, %s, %s, %s",
430+
"Content-Type, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID, %s, %s, %s, %s, %s, %s",
431+
headers.AuthorizationHeader,
431432
headers.MCPReadOnlyHeader,
432433
headers.MCPToolsetsHeader,
433434
headers.MCPToolsHeader,
434435
headers.MCPExcludeToolsHeader,
435436
headers.MCPFeaturesHeader,
436-
headers.AuthorizationHeader,
437437
))
438438

439439
if r.Method == http.MethodOptions {

pkg/http/handler_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,7 @@ func TestCrossOriginProtection(t *testing.T) {
783783
expectedStatusCode: http.StatusOK,
784784
},
785785
{
786-
// Mirrors RunHTTPServer's auto-bypass: nil config → create bypass.
787-
name: "server default allows cross-site request (nil triggers auto-bypass)",
786+
name: "bypass allows cross-site request (same pattern RunHTTPServer applies for nil config)",
788787
crossOriginProtection: func() *http.CrossOriginProtection {
789788
p := http.NewCrossOriginProtection()
790789
p.AddInsecureBypassPattern("/")

pkg/http/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ type ServerConfig struct {
8888
InsidersMode bool
8989

9090
// CrossOriginProtection configures the SDK's cross-origin request protection.
91-
// If nil, the SDK default (reject cross-origin POSTs) is used.
91+
// If nil and using RunHTTPServer, cross-origin requests are allowed (auto-bypass).
92+
// If nil and using the handler as a library, the SDK default (reject) applies.
9293
CrossOriginProtection *http.CrossOriginProtection
9394
}
9495

0 commit comments

Comments
 (0)