feat: add CORS support for HTTP transport mode#78
Open
heroyin wants to merge 1 commit intoapache:masterfrom
Open
feat: add CORS support for HTTP transport mode#78heroyin wants to merge 1 commit intoapache:masterfrom
heroyin wants to merge 1 commit intoapache:masterfrom
Conversation
Add CORS middleware to both main.py (DorisServer) and multiworker_app.py to allow cross-origin requests from browser-based MCP clients. Handles preflight OPTIONS requests and injects CORS headers into all responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
main.py(DorisServer HTTP mode) andmultiworker_app.pyto enable cross-origin requests from browser-based MCP clientsAccess-Control-Allow-Origin,Access-Control-Allow-Credentials,Access-Control-Expose-Headers) into all responses via a customsend_with_corswrapperMotivation
Browser-based MCP clients (e.g., web dashboards, Dify integration) cannot directly communicate with the Doris MCP Server due to CORS restrictions. This change enables cross-origin access for the HTTP transport mode, making it possible to use the server from any web origin.
Changes
doris_mcp_server/main.py: Added CORSMiddleware to the Starlette app, OPTIONS preflight handling, and CORS header injection via send wrapperdoris_mcp_server/multiworker_app.py: Added CORSMiddleware to the multi-worker basic_appTest plan
🤖 Generated with Claude Code