Skip to content

SDK V2 #809

@ihrpr

Description

@ihrpr

This issue is to track changes we need to have

@KKonstantinov EDITs:

Please note the below is a wishlist, and will be introduced in v2 depending on demand and timeline considerations; Some of it would be opened up for contributors for a PR after the v2 refactor.

  • Decouple from Zod, allow for any validator ("bring your own").
  • Type-first as opposed to zod schema-first approach
  • Protocol.ts - although the goal is to have symmetric client and server, protocol.ts contains nasty conditionals which can be executed only by client or server, but not both, defeating the purpose of an abstract class. File hard to read & extend.
  • Tests - All tests under /test directory
  • Tests - Reusable helpers under /test/helper directory - e.g. creating mock server, mock client, connecting them together, etc. etc. (we already have a significant amount we could move there).
  • Decouple from express to allow for lighter SDK, and easier compatibility with other HTTP frameworks (e.g. Hono, fastify, others)
  • non-node environment considerations (e.g. Bun, Deno on the backend, react-native on frontend, etc.)
  • Publish @modelcontextprotocol/typescript-sdk-client and @modelcontextprotocol/typescript-sdk-server to reduce package size on users with a single consideration (e.g. either server or client)
  • clear abstracted way to define experimental features in the SDK
  • DX quality of life improvements, such as inject your own logger
  • DX - ability to listen on onError and hook in custom behavior on McpErrors thrown
  • Ability to pass in JSON schema on the higher-order abstraction (McpServer)
  • DX - provide OpenTelemetry (@opentelemetry/api) capabilities out of the box - inject your own telemetry Tracer/Metrics Provider
  • Examples - move out in another package or out of src/ - examples should import from @modelcontextprotocol/sdk to be readily copy-able as opposed to having relative imports in them
  • ctx object inside the tool extra for transport/server controls.
  • Using Headers as opposed to a custom object in request context

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions