Class: MCPAuthError
Base class for all mcp-auth errors.
These errors cover configuration and authorization server discovery failures. Token
verification failures are intentionally NOT represented here — MCPAuth#verifyAccessToken
throws the MCP SDK's OAuthError instead, because the SDK bearer-auth helpers only map
OAuthError to proper 401 challenge responses (anything else becomes a 500).
Extends
Error
Extended by
Constructors
Constructor
new MCPAuthError(code: string, message: string): MCPAuthError;
Parameters
code
string
The error code in snake_case format.
message
string
A human-readable description of the error.
Returns
MCPAuthError
Overrides
Error.constructor
Properties
cause?
optional cause: unknown;
Inherited from
Error.cause
code
readonly code: string;
The error code in snake_case format.
message
message: string;
Inherited from
Error.message
name
name: string = 'MCPAuthError';
Overrides
Error.name
stack?
optional stack: string;
Inherited from
Error.stack
prepareStackTrace()?
static optional prepareStackTrace: (err: Error, stackTraces: CallSite[]) => any;
Optional override for formatting stack traces
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
stackTraceLimit
static stackTraceLimit: number;
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
static captureStackTrace(targetObject: object, constructorOpt?: Function): void;
Create .stack property on a target object
Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
Error.captureStackTrace