Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/stdio-subpath-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelcontextprotocol/client': minor
'@modelcontextprotocol/server': minor
---

Move stdio transports to a `./stdio` subpath export. Import `StdioClientTransport`, `getDefaultEnvironment`, `DEFAULT_INHERITED_ENV_VARS`, and `StdioServerParameters` from `@modelcontextprotocol/client/stdio`, and `StdioServerTransport` from `@modelcontextprotocol/server/stdio`. The package root entries no longer pull in `node:child_process`, `node:stream`, or `cross-spawn`, fixing bundling for browser and Cloudflare Workers targets. Node.js, Bun, and Deno consumers update the import path; runtime behavior is unchanged.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The changeset prose says "The package root entries no longer pull in node:child_process, node:stream, or cross-spawn", but for @modelcontextprotocol/server this is inaccurate — the server root never pulled these in (server stdio has only a type-only node:stream import, no node:child_process, and no cross-spawn dependency). This is the same wording inaccuracy already corrected in three sibling locations (server src/stdio.ts, src/index.ts, barrelClean.test.ts) by c2b85db and 86a6331, but the changeset was missed and will be copied verbatim into the server package's CHANGELOG.md. Consider scoping the node-deps sentence to the client package, or splitting into two changesets so the server entry only mentions API-shape consistency.

Extended reasoning...

What the issue is

.changeset/stdio-subpath-export.md is a single changeset that applies to both @modelcontextprotocol/client and @modelcontextprotocol/server. When changesets runs version, the body text is copied verbatim into each package's CHANGELOG.md. Line 6 reads:

The package root entries no longer pull in node:child_process, node:stream, or cross-spawn, fixing bundling for browser and Cloudflare Workers targets.

That sentence is accurate for the client package but not for the server package.

Why it's inaccurate for the server

  • packages/server/package.json has no cross-spawn dependency (the only runtime dep is zod).
  • packages/server/src/server/stdio.ts:1 is import type { Readable, Writable } from 'node:stream' — a type-only import that TypeScript/tsdown erase at compile time, so node:stream was never present in the server's emitted JS.
  • The file has no node:child_process import at all.

So the server root entry never pulled in node:child_process, node:stream, or cross-spawn, and server bundling for browser/Workers was never broken by stdio. The server-side change in this PR is purely an API-shape consistency move (matching the client's ./stdio subpath), as the PR's own corrected comments now state.

Why this is a missed sibling location

This exact class of inaccuracy was already raised in inline-comment 3073901242 and fixed by the author in three sibling locations:

  • packages/server/src/stdio.ts comment (c2b85db) → now reads "server stdio has only type-level Node imports"
  • packages/server/test/server/barrelClean.test.ts comment (c2b85db) → now notes "type-level node:stream imports (erased at compile time)"
  • packages/server/src/index.ts comment (86a6331) → now reads "server stdio has only type-level Node imports (erased at compile time)"

The changeset prose is the fourth location with the same wording and was not updated. This matches REVIEW.md's "Completeness — partial migrations leave sibling code paths with the very bug the PR claims to fix" and "Documentation & Changesets — flag prose the diff doesn't back".

Step-by-step proof

  1. Maintainer runs pnpm changeset version.
  2. Changesets reads .changeset/stdio-subpath-export.md, sees both @modelcontextprotocol/client and @modelcontextprotocol/server in the frontmatter.
  3. The body (line 6) is appended verbatim to packages/server/CHANGELOG.md under the new minor version.
  4. The published server CHANGELOG now claims its root entry "no longer pulls in node:child_process, node:stream, or cross-spawn, fixing bundling for browser and Cloudflare Workers targets".
  5. Per packages/server/package.json (no cross-spawn dep) and packages/server/src/server/stdio.ts:1 (type-only import), none of those modules were ever in the server root entry — the claim is false.
  6. The PR's own packages/server/src/index.ts:31-33 and packages/server/src/stdio.ts:3-5 (post-86a6331c) explicitly contradict this changelog text.

Impact

No functional/runtime impact — this is changelog accuracy only. A user reading the server CHANGELOG would be told their bundling was "fixed" when nothing was actually broken, which is mildly confusing but harmless.

How to fix

Either scope the node-deps sentence to the client package, e.g.:

Move stdio transports to a ./stdio subpath export. … For @modelcontextprotocol/client, the package root no longer pulls in node:child_process, node:stream, or cross-spawn, fixing bundling for browser and Cloudflare Workers targets. For @modelcontextprotocol/server, the subpath matches the client's shape for consistency (server stdio had only type-level Node imports). …

Or split into two changeset files so each package gets accurate prose.

3 changes: 2 additions & 1 deletion docs/client-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ First, let's set up our imports and create the basic client class in `src/index.

```ts source="../examples/client-quickstart/src/index.ts#prelude"
import Anthropic from '@anthropic-ai/sdk';
import { Client, StdioClientTransport } from '@modelcontextprotocol/client';
import { Client } from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
import readline from 'readline/promises';

const ANTHROPIC_MODEL = 'claude-sonnet-4-5';
Expand Down
2 changes: 1 addition & 1 deletion docs/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {
SdkError,
SdkErrorCode,
SSEClientTransport,
StdioClientTransport,
StreamableHTTPClientTransport
} from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
```

## Connecting to a server
Expand Down
6 changes: 3 additions & 3 deletions docs/migration-SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Replace all `@modelcontextprotocol/sdk/...` imports using this table.
| `@modelcontextprotocol/sdk/client/auth.js` | `@modelcontextprotocol/client` |
| `@modelcontextprotocol/sdk/client/streamableHttp.js` | `@modelcontextprotocol/client` |
| `@modelcontextprotocol/sdk/client/sse.js` | `@modelcontextprotocol/client` |
| `@modelcontextprotocol/sdk/client/stdio.js` | `@modelcontextprotocol/client` |
| `@modelcontextprotocol/sdk/client/stdio.js` | `@modelcontextprotocol/client/stdio` |
| `@modelcontextprotocol/sdk/client/websocket.js` | REMOVED (use Streamable HTTP or stdio; implement `Transport` for custom needs) |

### Server imports
Expand All @@ -51,7 +51,7 @@ Replace all `@modelcontextprotocol/sdk/...` imports using this table.
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `@modelcontextprotocol/sdk/server/mcp.js` | `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/server/index.js` | `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/server/stdio.js` | `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/server/stdio.js` | `@modelcontextprotocol/server/stdio` |
| `@modelcontextprotocol/sdk/server/streamableHttp.js` | `@modelcontextprotocol/node` (class renamed to `NodeStreamableHTTPServerTransport`) OR `@modelcontextprotocol/server` (web-standard `WebStandardStreamableHTTPServerTransport` for Cloudflare Workers, Deno, etc.) |
| `@modelcontextprotocol/sdk/server/sse.js` | REMOVED (migrate to Streamable HTTP) |
| `@modelcontextprotocol/sdk/server/auth/*` | REMOVED (use external auth library) |
Expand All @@ -66,7 +66,7 @@ Replace all `@modelcontextprotocol/sdk/...` imports using this table.
| `@modelcontextprotocol/sdk/shared/transport.js` | `@modelcontextprotocol/client` or `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/shared/uriTemplate.js` | `@modelcontextprotocol/client` or `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/shared/auth.js` | `@modelcontextprotocol/client` or `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/shared/stdio.js` | `@modelcontextprotocol/client` or `@modelcontextprotocol/server` |
| `@modelcontextprotocol/sdk/shared/stdio.js` | `@modelcontextprotocol/client/stdio` or `@modelcontextprotocol/server/stdio` |
Comment thread
claude[bot] marked this conversation as resolved.
Outdated

Notes:

Expand Down
6 changes: 4 additions & 2 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
**After (v2):**

```typescript
import { Client, StreamableHTTPClientTransport, StdioClientTransport } from '@modelcontextprotocol/client';
import { McpServer, StdioServerTransport, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';

// Node.js HTTP server transport is in the @modelcontextprotocol/node package
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
Expand Down
3 changes: 2 additions & 1 deletion docs/server-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ Now let's dive into building your server.
Add these to the top of your `src/index.ts`:

```ts source="../examples/server-quickstart/src/index.ts#prelude"
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';

const NWS_API_BASE = 'https://api.weather.gov';
Expand Down
3 changes: 2 additions & 1 deletion docs/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { randomUUID } from 'node:crypto';
import { createMcpExpressApp } from '@modelcontextprotocol/express';
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
import type { CallToolResult, ResourceLink } from '@modelcontextprotocol/server';
import { completable, McpServer, ResourceTemplate, StdioServerTransport } from '@modelcontextprotocol/server';
import { completable, McpServer, ResourceTemplate } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';
```

Expand Down
3 changes: 2 additions & 1 deletion examples/client-quickstart/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//#region prelude
import Anthropic from '@anthropic-ai/sdk';
import { Client, StdioClientTransport } from '@modelcontextprotocol/client';
import { Client } from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
import readline from 'readline/promises';

const ANTHROPIC_MODEL = 'claude-sonnet-4-5';
Expand Down
1 change: 1 addition & 0 deletions examples/client-quickstart/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"forceConsistentCasingInFileNames": true,
"paths": {
"@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"],
"@modelcontextprotocol/client/stdio": ["./node_modules/@modelcontextprotocol/client/src/stdio.ts"],
"@modelcontextprotocol/client/_shims": ["./node_modules/@modelcontextprotocol/client/src/shimsNode.ts"],
"@modelcontextprotocol/core": [
"./node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/src/index.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/client/src/clientGuide.examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
SdkError,
SdkErrorCode,
SSEClientTransport,
StdioClientTransport,
StreamableHTTPClientTransport
} from '@modelcontextprotocol/client';
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
//#endregion imports

// ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"paths": {
"*": ["./*"],
"@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"],
"@modelcontextprotocol/client/stdio": ["./node_modules/@modelcontextprotocol/client/src/stdio.ts"],
"@modelcontextprotocol/client/_shims": ["./node_modules/@modelcontextprotocol/client/src/shimsNode.ts"],
"@modelcontextprotocol/core": [
"./node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/src/index.ts"
Expand Down
3 changes: 2 additions & 1 deletion examples/server-quickstart/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//#region prelude
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';

const NWS_API_BASE = 'https://api.weather.gov';
Expand Down
1 change: 1 addition & 0 deletions examples/server-quickstart/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"forceConsistentCasingInFileNames": true,
"paths": {
"@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"],
"@modelcontextprotocol/server/stdio": ["./node_modules/@modelcontextprotocol/server/src/stdio.ts"],
"@modelcontextprotocol/server/_shims": ["./node_modules/@modelcontextprotocol/server/src/shimsNode.ts"],
"@modelcontextprotocol/core": [
"./node_modules/@modelcontextprotocol/server/node_modules/@modelcontextprotocol/core/src/index.ts"
Expand Down
3 changes: 2 additions & 1 deletion examples/server/src/arktypeExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* ArkType implements the Standard Schema spec with built-in JSON Schema conversion.
*/

import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import { type } from 'arktype';

const server = new McpServer({
Expand Down
3 changes: 2 additions & 1 deletion examples/server/src/mcpServerOutputSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* This demonstrates how to easily create tools with structured output
*/

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

const server = new McpServer({
Expand Down
3 changes: 2 additions & 1 deletion examples/server/src/serverGuide.examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { randomUUID } from 'node:crypto';
import { createMcpExpressApp } from '@modelcontextprotocol/express';
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
import type { CallToolResult, ResourceLink } from '@modelcontextprotocol/server';
import { completable, McpServer, ResourceTemplate, StdioServerTransport } from '@modelcontextprotocol/server';
import { completable, McpServer, ResourceTemplate } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';
//#endregion imports

Expand Down
3 changes: 2 additions & 1 deletion examples/server/src/toolWithSampleServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Run with: pnpm tsx src/toolWithSampleServer.ts

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

const mcpServer = new McpServer({
Expand Down
3 changes: 2 additions & 1 deletion examples/server/src/valibotExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* StandardJSONSchemaV1-compliant schemas.
*/

import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
import { McpServer } from '@modelcontextprotocol/server';
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
import { toStandardJsonSchema } from '@valibot/to-json-schema';
import * as v from 'valibot';

Expand Down
1 change: 1 addition & 0 deletions examples/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"paths": {
"*": ["./*"],
"@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"],
"@modelcontextprotocol/server/stdio": ["./node_modules/@modelcontextprotocol/server/src/stdio.ts"],
"@modelcontextprotocol/server/_shims": ["./node_modules/@modelcontextprotocol/server/src/shimsNode.ts"],
"@modelcontextprotocol/express": ["./node_modules/@modelcontextprotocol/express/src/index.ts"],
"@modelcontextprotocol/node": ["./node_modules/@modelcontextprotocol/node/src/index.ts"],
Expand Down
4 changes: 4 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
},
"./stdio": {
"types": "./dist/stdio.d.mts",
"import": "./dist/stdio.mjs"
},
"./validators/cf-worker": {
"types": "./dist/validators/cfWorker.d.mts",
"import": "./dist/validators/cfWorker.mjs"
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export type { LoggingOptions, Middleware, RequestLogger } from './client/middlew
export { applyMiddlewares, createMiddleware, withLogging, withOAuth } from './client/middleware.js';
export type { SSEClientTransportOptions } from './client/sse.js';
export { SSEClientTransport, SseError } from './client/sse.js';
export type { StdioServerParameters } from './client/stdio.js';
export { DEFAULT_INHERITED_ENV_VARS, getDefaultEnvironment, StdioClientTransport } from './client/stdio.js';
// StdioClientTransport, getDefaultEnvironment, DEFAULT_INHERITED_ENV_VARS, StdioServerParameters are exported from
// the './stdio' subpath to keep the root entry free of process-spawning runtime dependencies (child_process, cross-spawn).
export type {
ReconnectionScheduler,
StartSSEOptions,
Expand Down
8 changes: 8 additions & 0 deletions packages/client/src/stdio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Subpath entry for the stdio client transport.
//
// Exported separately from the root entry so that bundling `@modelcontextprotocol/client` for browser or
// Cloudflare Workers targets does not pull in `node:child_process`, `node:stream`, or `cross-spawn`. Import
// from `@modelcontextprotocol/client/stdio` only in process-spawning runtimes (Node.js, Bun, Deno).

export type { StdioServerParameters } from './client/stdio.js';
export { DEFAULT_INHERITED_ENV_VARS, getDefaultEnvironment, StdioClientTransport } from './client/stdio.js';
55 changes: 55 additions & 0 deletions packages/client/test/client/barrelClean.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { execFileSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import { beforeAll, describe, expect, test } from 'vitest';

const pkgDir = join(dirname(fileURLToPath(import.meta.url)), '../..');
const distDir = join(pkgDir, 'dist');
const NODE_ONLY = /\b(child_process|cross-spawn|node:stream|node:child_process)\b/;

function chunkImportsOf(entryPath: string): string[] {
const visited = new Set<string>();
const queue = [entryPath];
while (queue.length > 0) {
const file = queue.shift()!;
if (visited.has(file)) continue;
visited.add(file);
const src = readFileSync(file, 'utf8');
for (const m of src.matchAll(/from\s+["']\.\/(.+?\.mjs)["']/g)) {
queue.push(join(dirname(file), m[1]!));
}
}
visited.delete(entryPath);
return [...visited];
}

describe('@modelcontextprotocol/client root entry is browser-safe', () => {
beforeAll(() => {
if (!existsSync(join(distDir, 'index.mjs')) || !existsSync(join(distDir, 'stdio.mjs'))) {
execFileSync('pnpm', ['build'], { cwd: pkgDir, stdio: 'inherit' });
}
}, 60_000);

test('dist/index.mjs contains no process-spawning runtime imports', () => {
const entry = join(distDir, 'index.mjs');
expect(readFileSync(entry, 'utf8')).not.toMatch(NODE_ONLY);
});

test('chunks transitively imported by dist/index.mjs contain no process-spawning runtime imports', () => {
const entry = join(distDir, 'index.mjs');
for (const chunk of chunkImportsOf(entry)) {
expect({ chunk, content: readFileSync(chunk, 'utf8') }).not.toEqual(
expect.objectContaining({ content: expect.stringMatching(NODE_ONLY) })
);
}
});

test('dist/stdio.mjs exists and exports StdioClientTransport', () => {
const stdio = readFileSync(join(distDir, 'stdio.mjs'), 'utf8');
expect(stdio).toMatch(/\bStdioClientTransport\b/);
expect(stdio).toMatch(/\bgetDefaultEnvironment\b/);
expect(stdio).toMatch(/\bDEFAULT_INHERITED_ENV_VARS\b/);
});
});
2 changes: 1 addition & 1 deletion packages/client/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineConfig({
failOnWarn: 'ci-only',
// 1. Entry Points
// Directly matches package.json include/exclude globs
entry: ['src/index.ts', 'src/shimsNode.ts', 'src/shimsWorkerd.ts', 'src/shimsBrowser.ts', 'src/validators/cfWorker.ts'],
entry: ['src/index.ts', 'src/stdio.ts', 'src/shimsNode.ts', 'src/shimsWorkerd.ts', 'src/shimsBrowser.ts', 'src/validators/cfWorker.ts'],

// 2. Output Configuration
format: ['esm'],
Expand Down
4 changes: 4 additions & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
},
"./stdio": {
"types": "./dist/stdio.d.mts",
"import": "./dist/stdio.mjs"
},
"./validators/cf-worker": {
"types": "./dist/validators/cfWorker.d.mts",
"import": "./dist/validators/cfWorker.mjs"
Expand Down
3 changes: 2 additions & 1 deletion packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export type { HostHeaderValidationResult } from './server/middleware/hostHeaderV
export { hostHeaderValidationResponse, localhostAllowedHostnames, validateHostHeader } from './server/middleware/hostHeaderValidation.js';
export type { ServerOptions } from './server/server.js';
export { Server } from './server/server.js';
export { StdioServerTransport } from './server/stdio.js';
// StdioServerTransport is exported from the './stdio' subpath to keep the root entry free of process-stdio
// runtime dependencies (node:stream).
Comment thread
claude[bot] marked this conversation as resolved.
Outdated
export type {
EventId,
EventStore,
Expand Down
7 changes: 7 additions & 0 deletions packages/server/src/stdio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Subpath entry for the stdio server transport.
//
// Exported separately from the root entry so that bundling `@modelcontextprotocol/server` for browser or
// Cloudflare Workers targets does not pull in `node:stream`. Import from `@modelcontextprotocol/server/stdio`
// only in process-stdio runtimes (Node.js, Bun, Deno).

export { StdioServerTransport } from './server/stdio.js';

Check failure on line 7 in packages/server/src/stdio.ts

View check run for this annotation

Claude / Claude Code Review

Server barrelClean test guard is ineffective; stdio.ts comment is inaccurate

The server barrelClean test's NODE_ONLY regex (/\b(node:stream|node:child_process)\b/) cannot detect StdioServerTransport re-export regression because packages/server/src/server/stdio.ts uses only a type-only import from node:stream, which TypeScript erases at compile time — so no node:stream string ever appears in compiled output regardless of bundle contents. Additionally, the comment in packages/server/src/stdio.ts inaccurately claims the subpath separation 'does not pull in node:stream', whe
Comment thread
felixweinberger marked this conversation as resolved.
Loading
Loading