This is the documentation for the v2 beta — looking for the v1 documentation?
Skip to content

MCP TypeScript SDK (V2) / @modelcontextprotocol/server-legacy / auth/middleware/allowedMethods

auth/middleware/allowedMethods

Functions

allowedMethods()

allowedMethods(allowedMethods): RequestHandler

Defined in: packages/server-legacy/src/auth/middleware/allowedMethods.ts:11

Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response.

Parameters

allowedMethods

string[]

Array of allowed HTTP methods for this endpoint (e.g., ['GET', 'POST'])

Returns

RequestHandler

Express middleware that returns a 405 error if method not in allowed list