MCP TypeScript SDK (V2) / @modelcontextprotocol/client
@modelcontextprotocol/client
The MCP (Model Context Protocol) TypeScript client SDK. Build MCP clients that connect to MCP servers.
WARNING
This is a beta release. The API surface is settling but breaking changes remain possible until v2 stabilizes. Please try it and open issues — feedback during the beta directly shapes the stable release.
NOTE
This is v2 of the MCP TypeScript SDK. It replaces the monolithic @modelcontextprotocol/sdk package from v1. See the migration guide if you're coming from v1.
Install
bash
npm install @modelcontextprotocol/client@betaTypeScript ≥6.0 no longer auto-includes @types/* — add "types": ["node"] to your tsconfig.json compilerOptions (the published .d.mts references Buffer).
Documentation
- Repository README — overview, package layout, examples
- Client guide — connecting, calling tools, OAuth, and middleware
- API reference
- MCP specification
Modules
- client/auth
- client/auth.examples
- client/authErrors
- client/authExtensions
- client/authExtensions.examples
- client/client
- client/client.examples
- client/crossAppAccess
- client/middleware
- client/middleware.examples
- client/probeClassifier
- client/responseCache
- client/sse
- client/stdio
- client/streamableHttp
- client/streamableHttp.examples
- client/versionNegotiation
- fromJsonSchema
- index
- shimsBrowser
- shimsNode
- shimsWorkerd
- stdio
- validators/ajv
- validators/cfWorker