HTTP transport: explicit JSON body limit + optional CORS allowlist#1741
HTTP transport: explicit JSON body limit + optional CORS allowlist#1741TheodorNEngoy wants to merge 1 commit intoupstash:masterfrom
Conversation
|
Hey Theodor, can you please further explain the necessity and motivation of this PR? We don't return random data for response to MCP, so I can guarantee that response limit of 1 mb wouldn't be a case. Do you have any specific requirement that would need cors? If you self host the mcp server, it's already on your local so no need for cors? If you want to expose your MCP server deployment, you can just use our deployment at https://mcp.context7.com/mcp. Anything I miss? |
|
Good questions, thanks.
If you’d rather keep the transport minimal, I’m happy to split this into two PRs (body limit only, or drop CORS entirely) based on your preference. |
Changes:
express.json({ limit: "1mb" })).CONTEXT7_ALLOWED_ORIGINS(comma-separated). If unset, CORS stays permissive for compatibility.CONTEXT7_ALLOWED_ORIGINSin the developer guide.Rationale: make the HTTP mode safer-by-default for self-hosting and reduce surprises around request size.