feat!: remove WebSocketClientTransport#1783
Conversation
🦋 Changeset detectedLatest commit: e1ce74a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
There was a problem hiding this comment.
LGTM — straightforward removal with good migration docs.
Extended reasoning...
Overview
This PR removes WebSocketClientTransport from @modelcontextprotocol/client. The changes are:
- Delete
packages/client/src/client/websocket.ts(74 lines) - Remove the re-export from
packages/client/src/index.ts(1 line) - Remove
wsimports and thews:///wss://branch fromscripts/cli.ts(internal dev CLI) - Add migration guidance to
docs/migration.mdanddocs/migration-SKILL.md - Add a changeset marking a major bump for
@modelcontextprotocol/client
Security risks
None. This PR only removes code and adds documentation. No new logic, no auth changes, no user input handling changes.
Level of scrutiny
Low scrutiny warranted. The code changes are purely deletions — removing a file, removing export/import lines, removing a branch from an internal CLI. The migration documentation is thorough and accurate. The design decision to remove WebSocket transport was already made with maintainer consensus in issue #142.
Other factors
- The two nit-level bugs found (leftover
ws/@types/wsdevDependencies, andws://URLs falling through to StdioClientTransport in the internal CLI) are valid but minor cleanup items that don't affect correctness or any public API surface. - All tests pass per the PR description (311 tests, typecheck, lint, build).
- The changeset correctly marks this as a major bump since it removes a public export.
There was a problem hiding this comment.
LGTM — clean removal with proper migration docs, dependency cleanup, and helpful error for ws:// URLs.
Extended reasoning...
Overview
This PR removes WebSocketClientTransport from @modelcontextprotocol/client, deleting the implementation file (packages/client/src/client/websocket.ts), its re-export from packages/client/src/index.ts, and the ws/@types/ws devDependencies from package.json, pnpm-workspace.yaml, and pnpm-lock.yaml. The internal CLI (scripts/cli.ts) is updated to throw a clear error for ws:// URLs. Migration docs are updated in both docs/migration.md and docs/migration-SKILL.md.
Security risks
None. This PR removes code rather than adding it, and does not touch auth, crypto, or permissions.
Level of scrutiny
Low scrutiny warranted. This is a straightforward deletion of a transport class with no complex logic changes. The only new code is a single throw new Error(...) line in an internal CLI script. The breaking change is properly marked with a major changeset.
Other factors
- Both prior nit-level comments from my previous review are already addressed in the current PR diff (dead deps removed, explicit ws:// error added).
- No bugs found by the bug hunting system.
- Tests pass per the PR description.
- Migration documentation is thorough and covers both human-readable and LLM-optimized formats.
Removes
WebSocketClientTransportfrom the client package.Motivation and Context
Per #142, maintainer consensus (jspahrsummers, felixweinberger, calclavia) is to remove the WebSocket transport to avoid transport proliferation. WebSocket is not a spec-defined MCP transport, and keeping it in the SDK encourages non-conformant deployments without a testing baseline.
Users who need WebSocket can implement the
Transportinterface directly — it remains exported from@modelcontextprotocol/client.Closes #142.
How Has This Been Tested?
pnpm --filter @modelcontextprotocol/client typecheck— passespnpm --filter @modelcontextprotocol/client test— 311 tests passpnpm --filter @modelcontextprotocol/client lint— passespnpm build:all— builds cleanlyBreaking Changes
Yes.
WebSocketClientTransportis no longer exported. Users must migrate toStreamableHTTPClientTransportorStdioClientTransport, or implement a customTransport. Migration guidance added todocs/migration.mdanddocs/migration-SKILL.md.Types of changes
Checklist
Additional context
ws:/wss:handling fromscripts/cli.ts(test CLI now supports http/https + stdio only)@modelcontextprotocol/clientmajor bump