feat(compat): export InMemoryTransport from public API surface (#1834)

Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com>
This commit is contained in:
Felix Weinberger 2026-04-27 13:24:05 +01:00 • committed by GitHub
commit 42cb6b2b72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -469,22 +469,20 @@ const client = new Client(
);
```
### `InMemoryTransport` removed from public API
### `InMemoryTransport` moved
`InMemoryTransport` has been removed from the public API surface. It was previously used for in-process client-server connections and testing.
For **testing**, import it directly from the internal core package:
`InMemoryTransport` is now exported from `@modelcontextprotocol/client` and `@modelcontextprotocol/server` (both re-export it). It is still intended for in-process client-server connections and testing.
```typescript
// v1
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
// v2 (testing only — @modelcontextprotocol/core is internal, not for production use)
import { InMemoryTransport } from '@modelcontextprotocol/core';
// v2
import { InMemoryTransport } from '@modelcontextprotocol/server';
// or
import { InMemoryTransport } from '@modelcontextprotocol/client';
```
For **production in-process connections**, use `StreamableHTTPClientTransport` with a local server URL, or connect client and server via paired streams.
### Removed type aliases and deprecated exports
The following deprecated type aliases have been removed from `@modelcontextprotocol/core`: