Class Nexus\Mcp\Server\Transport\Http\Middleware\CorsMiddleware

final
readonly
implements MiddlewareInterface

Grants browser clients cross-origin access to the MCP endpoint. The middleware is additive. An allowed Origin is reflected into Access-Control-Allow-Origin, a preflight OPTIONS is answered with 204 plus the negotiated Access-Control-* headers, and every other request is forwarded and its response decorated. A disallowed or absent Origin receives no grant, so rejection stays with the DNS-rebinding gate. Every response carries the Vary keys it turns on, grant or not, so a shared cache cannot serve one origin's answer to another.

Methods