MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / cors_middleware

Function cors_middleware

src/mcp/server/auth/routes.py:51–61  ·  view source on GitHub ↗
(
    handler: Callable[[Request], Response | Awaitable[Response]],
    allow_methods: list[str],
)

Source from the content-addressed store, hash-verified

49
50
51def cors_middleware(
52 handler: Callable[[Request], Response | Awaitable[Response]],
53 allow_methods: list[str],
54) -> ASGIApp:
55 cors_app = CORSMiddleware(
56 app=request_response(handler),
57 allow_origins="*",
58 allow_methods=allow_methods,
59 allow_headers=[MCP_PROTOCOL_VERSION_HEADER],
60 )
61 return cors_app
62
63
64def create_auth_routes(

Callers 3

create_auth_routesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected