diff --git a/.changeset/export-inmemory-transport.md b/.changeset/export-inmemory-transport.md new file mode 100644 index 000000000..cc1d8f730 --- /dev/null +++ b/.changeset/export-inmemory-transport.md @@ -0,0 +1,6 @@ +--- +'@modelcontextprotocol/server': patch +'@modelcontextprotocol/client': patch +--- + +Export `InMemoryTransport` for in-process testing. diff --git a/packages/core/src/exports/public/index.ts b/packages/core/src/exports/public/index.ts index 2dc1e13a8..942bd2368 100644 --- a/packages/core/src/exports/public/index.ts +++ b/packages/core/src/exports/public/index.ts @@ -70,6 +70,7 @@ export { deserializeMessage, ReadBuffer, serializeMessage } from '../../shared/s // Transport types (NOT normalizeHeaders) export type { FetchLike, Transport, TransportSendOptions } from '../../shared/transport.js'; export { createFetchWithInit } from '../../shared/transport.js'; +export { InMemoryTransport } from '../../util/inMemory.js'; // URI Template export type { Variables } from '../../shared/uriTemplate.js'; diff --git a/packages/core/src/util/inMemory.ts b/packages/core/src/util/inMemory.ts index 256363c13..4e7993209 100644 --- a/packages/core/src/util/inMemory.ts +++ b/packages/core/src/util/inMemory.ts @@ -9,6 +9,9 @@ interface QueuedMessage { /** * In-memory transport for creating clients and servers that talk to each other within the same process. + * + * Intended for testing and development. For production in-process connections, use + * `StreamableHTTPClientTransport` against a local server URL. */ export class InMemoryTransport implements Transport { private _otherTransport?: InMemoryTransport;