Skip to content

Commit 599b267

Browse files
docs(compat): add @deprecated to OAuth subclass type aliases; fix changeset collision-symbol reference
1 parent 96c1476 commit 599b267

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.changeset/error-compat-aliases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
'@modelcontextprotocol/server': patch
44
---
55

6-
Add v1-compat `@deprecated` error aliases: `McpError`/`ErrorCode` (alias `ProtocolError`/`ProtocolErrorCode`, with `ConnectionClosed`/`RequestTimeout` from `SdkErrorCode`), `OAuthError.errorCode` getter (alias `.code`), `JSONRPCError`/`isJSONRPCError`, 16 of the 17 v1 OAuth error subclasses (`InvalidTokenError`, `ServerError`, … — `InvalidRequestError` is omitted from the public surface to avoid colliding with the JSON-RPC `InvalidRequest` type) as thin wrappers around `OAuthError` + `OAuthErrorCode`, and `StreamableHTTPError` as an `SdkError` subclass that the StreamableHTTP client transport now throws (so `instanceof StreamableHTTPError` matches; `.status` carries the HTTP status code).
6+
Add v1-compat `@deprecated` error aliases: `McpError`/`ErrorCode` (alias `ProtocolError`/`ProtocolErrorCode`, with `ConnectionClosed`/`RequestTimeout` from `SdkErrorCode`), `OAuthError.errorCode` getter (alias `.code`), `JSONRPCError`/`isJSONRPCError`, 16 of the 17 v1 OAuth error subclasses (`InvalidTokenError`, `ServerError`, … — `InvalidRequestError` is omitted from the public surface to avoid colliding with the `InvalidRequestError` interface in `types.ts`) as thin wrappers around `OAuthError` + `OAuthErrorCode`, and `StreamableHTTPError` as an `SdkError` subclass that the StreamableHTTP client transport now throws (so `instanceof StreamableHTTPError` matches; `.status` carries the HTTP status code).

packages/core/src/errors/oauthErrorsCompat.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,54 +31,71 @@ function sub(code: OAuthErrorCode, name: string): OAuthErrorSubclass {
3131

3232
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidRequest`. */
3333
export const InvalidRequestError = sub(OAuthErrorCode.InvalidRequest, 'InvalidRequestError');
34+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidRequest`. */
3435
export type InvalidRequestError = InstanceType<typeof InvalidRequestError>;
3536
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidClient`. */
3637
export const InvalidClientError = sub(OAuthErrorCode.InvalidClient, 'InvalidClientError');
38+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidClient`. */
3739
export type InvalidClientError = InstanceType<typeof InvalidClientError>;
3840
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidGrant`. */
3941
export const InvalidGrantError = sub(OAuthErrorCode.InvalidGrant, 'InvalidGrantError');
42+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidGrant`. */
4043
export type InvalidGrantError = InstanceType<typeof InvalidGrantError>;
4144
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnauthorizedClient`. */
4245
export const UnauthorizedClientError = sub(OAuthErrorCode.UnauthorizedClient, 'UnauthorizedClientError');
46+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnauthorizedClient`. */
4347
export type UnauthorizedClientError = InstanceType<typeof UnauthorizedClientError>;
4448
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedGrantType`. */
4549
export const UnsupportedGrantTypeError = sub(OAuthErrorCode.UnsupportedGrantType, 'UnsupportedGrantTypeError');
50+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedGrantType`. */
4651
export type UnsupportedGrantTypeError = InstanceType<typeof UnsupportedGrantTypeError>;
4752
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidScope`. */
4853
export const InvalidScopeError = sub(OAuthErrorCode.InvalidScope, 'InvalidScopeError');
54+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidScope`. */
4955
export type InvalidScopeError = InstanceType<typeof InvalidScopeError>;
5056
/** @deprecated Use `OAuthError` with `OAuthErrorCode.AccessDenied`. */
5157
export const AccessDeniedError = sub(OAuthErrorCode.AccessDenied, 'AccessDeniedError');
58+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.AccessDenied`. */
5259
export type AccessDeniedError = InstanceType<typeof AccessDeniedError>;
5360
/** @deprecated Use `OAuthError` with `OAuthErrorCode.ServerError`. */
5461
export const ServerError = sub(OAuthErrorCode.ServerError, 'ServerError');
62+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.ServerError`. */
5563
export type ServerError = InstanceType<typeof ServerError>;
5664
/** @deprecated Use `OAuthError` with `OAuthErrorCode.TemporarilyUnavailable`. */
5765
export const TemporarilyUnavailableError = sub(OAuthErrorCode.TemporarilyUnavailable, 'TemporarilyUnavailableError');
66+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.TemporarilyUnavailable`. */
5867
export type TemporarilyUnavailableError = InstanceType<typeof TemporarilyUnavailableError>;
5968
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedResponseType`. */
6069
export const UnsupportedResponseTypeError = sub(OAuthErrorCode.UnsupportedResponseType, 'UnsupportedResponseTypeError');
70+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedResponseType`. */
6171
export type UnsupportedResponseTypeError = InstanceType<typeof UnsupportedResponseTypeError>;
6272
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedTokenType`. */
6373
export const UnsupportedTokenTypeError = sub(OAuthErrorCode.UnsupportedTokenType, 'UnsupportedTokenTypeError');
74+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.UnsupportedTokenType`. */
6475
export type UnsupportedTokenTypeError = InstanceType<typeof UnsupportedTokenTypeError>;
6576
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidToken`. */
6677
export const InvalidTokenError = sub(OAuthErrorCode.InvalidToken, 'InvalidTokenError');
78+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidToken`. */
6779
export type InvalidTokenError = InstanceType<typeof InvalidTokenError>;
6880
/** @deprecated Use `OAuthError` with `OAuthErrorCode.MethodNotAllowed`. */
6981
export const MethodNotAllowedError = sub(OAuthErrorCode.MethodNotAllowed, 'MethodNotAllowedError');
82+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.MethodNotAllowed`. */
7083
export type MethodNotAllowedError = InstanceType<typeof MethodNotAllowedError>;
7184
/** @deprecated Use `OAuthError` with `OAuthErrorCode.TooManyRequests`. */
7285
export const TooManyRequestsError = sub(OAuthErrorCode.TooManyRequests, 'TooManyRequestsError');
86+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.TooManyRequests`. */
7387
export type TooManyRequestsError = InstanceType<typeof TooManyRequestsError>;
7488
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidClientMetadata`. */
7589
export const InvalidClientMetadataError = sub(OAuthErrorCode.InvalidClientMetadata, 'InvalidClientMetadataError');
90+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidClientMetadata`. */
7691
export type InvalidClientMetadataError = InstanceType<typeof InvalidClientMetadataError>;
7792
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InsufficientScope`. */
7893
export const InsufficientScopeError = sub(OAuthErrorCode.InsufficientScope, 'InsufficientScopeError');
94+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InsufficientScope`. */
7995
export type InsufficientScopeError = InstanceType<typeof InsufficientScopeError>;
8096
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidTarget`. */
8197
export const InvalidTargetError = sub(OAuthErrorCode.InvalidTarget, 'InvalidTargetError');
98+
/** @deprecated Use `OAuthError` with `OAuthErrorCode.InvalidTarget`. */
8299
export type InvalidTargetError = InstanceType<typeof InvalidTargetError>;
83100

84101
/**

0 commit comments

Comments
 (0)