Skip to content

Add CORS support to MCP HTTP transport#91

Merged
rg4444 merged 1 commit into
mainfrom
claude/fix-cors-error-XQddy
Feb 7, 2026
Merged

Add CORS support to MCP HTTP transport#91
rg4444 merged 1 commit into
mainfrom
claude/fix-cors-error-XQddy

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented Feb 7, 2026

Summary

Add Cross-Origin Resource Sharing (CORS) headers to the MCP HTTP transport layer to enable browser-based clients to communicate with the MCP server. This includes:

  • Handling CORS preflight (OPTIONS) requests at the top-level ServeHTTP handler
  • Setting appropriate CORS headers (Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Headers) for both GET and POST requests
  • Supporting wildcard origin (*) to allow requests from any domain

This change enables web-based MCP clients to make cross-origin requests without browser CORS restrictions.

Validation

  • Does this change affect BPMN render/diff? No
  • Does this change require regenerating images? No
  • Any schema/validator updates? No

Testing

  • Verified CORS preflight requests (OPTIONS) return 200 with appropriate headers
  • Verified GET and POST requests include CORS headers in responses
  • Tested with browser-based clients making cross-origin requests

https://claude.ai/code/session_01CQTqZnS1nzqy955PBoxbLp

Browsers block cross-origin requests to the MCP endpoint because no
Access-Control-Allow-Origin header is present. This adds CORS headers
to both ServeHTTP (OPTIONS preflight handling) and handlePost (response
headers on POST requests) so browser-based MCP clients can connect.

https://claude.ai/code/session_01CQTqZnS1nzqy955PBoxbLp
@rg4444 rg4444 merged commit 053f6f5 into main Feb 7, 2026
13 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants