Skip to content

Commit 6d76ce6

Browse files
Fix escaped negation in transient-check examples and table formatting
The KNOWN_OAUTH_ERROR_CODES examples carried a stray backslash before the negation operator, making the snippets invalid TypeScript when copied. The client-side context note sat mid-table between the task rows with a non-symbol left cell; it now reads as prose after the mapping table, matching how migration.md presents it.
1 parent 4ccd4be commit 6d76ce6

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

docs/migration-SKILL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ import { OAuthError, OAuthErrorCode } from '@modelcontextprotocol/client';
218218
if (error instanceof OAuthError && error.code === OAuthErrorCode.InvalidClient) { ... }
219219
```
220220

221-
The code property is `error.code` (`OAuthErrorCode | string`). Behavioral trap: v1 collapsed unrecognized response error codes into `ServerError`; v2 preserves the raw code. When rewriting `instanceof ServerError` retry/transient checks, treat unknown codes as transient to preserve v1 behavior: `\!new Set<string>(Object.values(OAuthErrorCode)).has(error.code)`.
221+
The code property is `error.code` (`OAuthErrorCode | string`). Behavioral trap: v1 collapsed unrecognized response error codes into `ServerError`; v2 preserves the raw code. When rewriting `instanceof ServerError` retry/transient checks, treat unknown codes as transient to preserve v1 behavior: `!new Set<string>(Object.values(OAuthErrorCode)).has(error.code)`.
222222

223223
**Unchanged APIs** (only import paths changed): `Client` constructor and most methods, `McpServer` constructor, `server.connect()`, `server.close()`, all client transports (`StreamableHTTPClientTransport`, `SSEClientTransport`, `StdioClientTransport`), `StdioServerTransport`, all
224224
Zod schemas, all callback return types. Note: `callTool()` and `request()` signatures changed (schema parameter removed, see section 11).
@@ -452,10 +452,11 @@ Request/notification params remain fully typed. Remove unused schema imports aft
452452
| `extra.closeSSEStream` | `ctx.http?.closeSSE` (only `ServerContext`) |
453453
| `extra.closeStandaloneSSEStream` | `ctx.http?.closeStandaloneSSE` (only `ServerContext`) |
454454
| `extra.taskStore` | `ctx.task?.store` |
455-
| (applies client-side too) | `ClientContext` = `BaseContext`; client handler mocks need `{ mcpReq: { signal, id, ... } }` |
456455
| `extra.taskId` | `ctx.task?.id` |
457456
| `extra.taskRequestedTtl` | `ctx.task?.requestedTtl` |
458457

458+
The same restructure applies client-side: `ClientContext` = `BaseContext`, so client-side handlers (elicitation, sampling, roots) receive the same `ctx` shape, and client handler mocks must provide `{ mcpReq: { signal, id, ... } }` rather than the v1 flat `extra` object.
459+
459460
`ServerContext` convenience methods (new in v2, no v1 equivalent):
460461

461462
| Method | Description | Replaces |

docs/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ const isTransient =
928928
(error.code === OAuthErrorCode.ServerError ||
929929
error.code === OAuthErrorCode.TemporarilyUnavailable ||
930930
error.code === OAuthErrorCode.TooManyRequests ||
931-
\!KNOWN_OAUTH_ERROR_CODES.has(error.code));
931+
!KNOWN_OAUTH_ERROR_CODES.has(error.code));
932932
```
933933

934934
### Experimental: `TaskCreationParams.ttl` no longer accepts `null`

0 commit comments

Comments
 (0)