Skip to content

fix: use shared DEFAULT_CORS_CONFIG in HTTP stream transport#151

Merged
QuantGeekDev merged 1 commit intomainfrom
fix/93-cors-header-consistency
Apr 1, 2026
Merged

fix: use shared DEFAULT_CORS_CONFIG in HTTP stream transport#151
QuantGeekDev merged 1 commit intomainfrom
fix/93-cors-header-consistency

Conversation

@QuantGeekDev
Copy link
Copy Markdown
Owner

Summary

  • Replaces hardcoded CORS fallback values in HttpStreamTransport.setCorsHeaders() with references to the shared DEFAULT_CORS_CONFIG from src/transports/sse/types.ts
  • Previously, HTTP Stream defaulted to Content-Type, Authorization, Mcp-Session-Id while SSE included Accept, x-api-key, Last-Event-ID — this mismatch caused CORS preflight failures in Chrome
  • Both transports now use identical default CORS headers

Test plan

  • 5 new tests pass in tests/transports/http/cors-consistency.test.ts
  • Test HTTP Stream transport with MCP Inspector in Chrome — no CORS errors
  • Verify custom CORS config still overrides defaults

Closes #93

🤖 Generated with Claude Code

Closes #93

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Inspector http://127.0.0.1:5173/#resources. CORS error in Chrome

1 participant