# MCP TypeScript SDK v2.2.0 Enhances OAuth, List Calls

> The Model Context Protocol TypeScript SDK v2.2.0 has been released, updating key client and server packages. This update introduces a mandatory expectedIssuer parameter for machine-to-machine OAuth providers and enhances list call behavior.

- Published: 2026-10-05
- Updated: 2026-10-24
- Category: Agents
- Type: news
- Tags: Api, Bun, Deno, Model Context Protocol, Node Js, Oauth, Sdk, typescript
- Sources: 2
- Canonical: https://rajatxautomatedcontent.vercel.app/articles/mcp-typescript-sdk-v2-2-0

---

The Model Context Protocol (MCP) TypeScript SDK has released version 2.2.0, bringing updates to several core packages including `@modelcontextprotocol/client` and `@modelcontextprotocol/server` [S1]. This release focuses on bolstering security for machine-to-machine OAuth communications and improving data retrieval efficiency for list operations [S1].

Developers using the SDK, which implements the 2026-07-28 MCP specification [S2] and runs on Node.js, Bun, and Deno environments [S2], should review the changes, particularly regarding OAuth provider configuration [S1]. For a deeper understanding of the protocol itself, refer to /articles/what-is-the-model-context-protocol.

## What Changed in v2.2.0

### OAuth `expectedIssuer` Requirement

Version 2.2.0 introduces a significant change for machine-to-machine OAuth providers [S1]. Developers must now explicitly pass the `expectedIssuer` parameter when constructing `ClientCredentialsProvider`, `PrivateKeyJwtProvider`, `StaticPrivateKeyJwtProvider`, or `CrossAppAccessProvider` [S1]. Failing to provide `expectedIssuer` is now deprecated and will log a warning [S1]. The `expectedIssuer` value should correspond to the `issuer` of the authorization server where the credentials were registered [S1].

Additionally, the `fetchToken()` function now performs validation to ensure the client information belongs to the correct authorization server [S1]. If a provider's client information is bound to a different authorization server, `fetchToken()` will proactively throw an `AuthorizationServerMismatchError` before initiating any requests [S1]. This enhances security by preventing tokens from being used with unintended issuers.

Hostnames ending in `.localhost` are now correctly recognized as loopback addresses for OAuth token endpoints, facilitating multi-tenant local setups based on hostnames [S1]. The `OAuthTokensSchema` and `OAuthClientInformationSchema` have also been updated to support an optional `issuer` field, allowing providers to retain this information when reading from storage [S1].

### Enhanced List Call Behavior

List calls within the SDK, such as `listTools()`, `listPrompts()`, `listResources()`, and `listResourceTemplates()`, now retrieve the entire list by default when called without a cursor [S1]. The SDK achieves this by automatically following `nextCursor` until the server no longer provides one [S1]. The `listMaxPages` option remains available to cap this full list retrieval process [S1].

### Bug Fixes and Stability Improvements

Several issues have been addressed in this release:

*   **CommonJS Type-Checking**: CommonJS TypeScript projects can now correctly type-check again [S1]. The `jose` types used by the DPoP API are inlined into declaration files, resolving a regression introduced in version 2.1.0 [S1].
*   **`Client.listen()` Stability**: The `Client.listen()` method has been improved to prevent rejections from escaping as process-level unhandled rejections [S1]. It also no longer hangs if a send operation fails to settle [S1].
*   **`createMcpHandler` Stack Overflow**: A stack overflow issue in `createMcpHandler` has been fixed, which previously occurred when the factory returned the same server instance for multiple requests [S1]. Developers are still required to return a fresh instance per request [S1].
*   **Codemod Improvements**: The `v1-to-v2` codemod now preserves a file's leading comment block and directives when rewriting imports [S1].

## Why It Matters for Developers

The `expectedIssuer` requirement for machine-to-machine OAuth providers [S1] and the `fetchToken()` validation [S1] ensure that tokens are issued and validated against the correct authorization server [S1]. This explicit validation helps prevent potential misuse or misconfiguration.

For developers working with lists, the enhanced default behavior of list calls simplifies data retrieval. Instead of manually iterating through paginated results, developers can now often get a complete list with a single call [S1], reducing boilerplate code. The fix for CommonJS TypeScript projects is crucial for maintaining type safety and development workflow for users of that module system [S1]. For more on structured outputs and type safety in TypeScript SDKs, see /articles/structured-outputs-typescript-ai-sdk-zod.

## How to Try It

To upgrade to MCP TypeScript SDK v2.2.0, update the relevant `@modelcontextprotocol` packages to version 2.2.0 [S1]. Packages such as `@modelcontextprotocol/node`, `express`, `hono`, and `fastify` remain unchanged [S1].

Install the client or server packages using your preferred package manager [S2]:

```bash
npm install @modelcontextprotocol/server
# or
bun add @modelcontextprotocol/server
# or
deno add npm:@modelcontextprotocol/server
```

```bash
npm install @modelcontextprotocol/client
# or
bun add @modelcontextprotocol/client
# or
deno add npm:@modelcontextprotocol/client
```

Optional middleware packages for specific runtimes or frameworks can be installed as needed [S2]:

```bash
# Node.js HTTP (IncomingMessage/ServerResponse) Streamable HTTP transport:
npm install @modelcontextprotocol/node

# Express integration:
npm install @modelcontextprotocol/express express

# Fastify integration:
npm install @modelcontextprotocol/fastify fastify

# Hono integration:
npm install @modelcontextprotocol/hono hono
```

Here is a minimal example of an MCP server exposing a 'greet' tool over stdio [S2]:

```typescript
import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';

const server = new McpServer({ name: 'greeting-server', version: '1.0.0' });

server.registerTool(
 'greet',
 {
 description: 'Greet someone by name',
 inputSchema: z.object({ name: z.string() })
 },
 async ({ name }) => ({
 content: [{ type: 'text', text: `Hello, ${name}!` }]
 })
);

async function main() {
 const transport = new StdioServerTransport();
 await server.connect(transport);
}

main();
```

## Limitations and Open Questions

While this release introduces several improvements, some aspects remain for further clarification or future development:

*   It is currently unknown if there are any breaking changes for existing v2.x users beyond the `expectedIssuer` deprecation.
*   The specific performance implications of the `fetchToken()` authorization server mismatch check have not been detailed.
*   The exact behavior or error message when `listMaxPages` caps a list call is not specified in the release notes.
*   Specific migration steps or considerations for developers upgrading from v2.1.0 to v2.2.0, especially regarding the `jose` types fix, are not explicitly provided.
*   The specific use cases or benefits of the `CrossAppAccessProvider` mentioned in the `expectedIssuer` deprecation are not elaborated upon.
*   The recommended approach for handling the `AuthorizationServerMismatchError` in client applications is not explicitly outlined.
*   The full implications for CommonJS projects affected by the `jose` types regression in 2.1.0, and the precise steps they should take to upgrade, are not detailed beyond the fix itself.

## FAQ

**Which packages were updated in MCP TypeScript SDK v2.2.0?**

In MCP TypeScript SDK v2.2.0, the @modelcontextprotocol/client, @modelcontextprotocol/server, @modelcontextprotocol/core, @modelcontextprotocol/server-legacy, and @modelcontextprotocol/codemod packages were all updated to version 2.2.0.

**What is the new requirement for machine-to-machine OAuth providers in v2.2.0?**

Machine-to-machine OAuth providers such as ClientCredentialsProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider, or CrossAppAccessProvider now require the expectedIssuer parameter to be passed during construction. Constructing these providers without it is deprecated and will log a warning.

**How do list calls behave differently in v2.2.0?**

When called without a cursor, list calls like listTools(), listPrompts(), listResources(), and listResourceTemplates() now automatically follow nextCursor until the entire list is retrieved. The listMaxPages option can still cap this retrieval.

## Sources

- [S1] typescript-sdk 2.2.0 — Model Context Protocol. <https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/v2.2.0> (retrieved 2026-10-04, trust: official)
- [S2] modelcontextprotocol/typescript-sdk: The official TypeScript SDK for Model Context Protocol servers and clients — Model Context Protocol. <https://github.com/modelcontextprotocol/typescript-sdk> (retrieved 2026-10-04, trust: official)

---

Source: AI Dev Hub — https://rajatxautomatedcontent.vercel.app/articles/mcp-typescript-sdk-v2-2-0
