You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -772,24 +772,25 @@ The session hierarchy has been refactored to support pluggable transport impleme
772
772
773
773
#### New `AbstractBaseSession` Protocol
774
774
775
-
A new runtime-checkable Protocol, AbstractBaseSession, establishes a transport-agnostic contract for all MCP sessions. It ensures that client and server sessions share a consistent communication interface regardless of the transport used.
775
+
A new runtime-checkable Protocol, `AbstractBaseSession`, establishes a transport-agnostic contract for all MCP sessions. It ensures that client and server sessions share a consistent communication interface regardless of the transport used.
776
776
777
-
**Key characteristics of `AbstractBaseSession`:**
777
+
##### Key characteristics of `AbstractBaseSession`
778
778
779
-
To maintain a clean architectural boundary, AbstractBaseSession is a pure interface—it defines what methods must exist but does not manage how they work.
779
+
To maintain a clean architectural boundary, `AbstractBaseSession` is a pure interface—it defines what methods must exist but does not manage how they work.
780
780
781
781
***No State Management**: The protocol does not handle internal machinery like task groups, response streams, or buffers.
782
782
783
-
***Implementation Ownership**: The concrete class is now fully responsible for managing its own state and lifecycle for how it sends and receives data.
783
+
***Implementation Ownership**: The concrete class is fully responsible for managing its own state and lifecycle for how it sends and receives data.
784
784
785
-
***No Inheritance Needed**: As a structural protocol, you no longer need to call super().**init**() or inherit from a base class to satisfy the contract.
785
+
***No Inheritance Needed**: As a structural protocol, you no longer need to call **super().\_\_init\_\_()** or inherit from a base class to satisfy the contract.
786
786
787
-
**Motivation: Interface vs. Implementation**
788
-
Previously, all custom sessions were required to inherit from BaseSession, which locked them into a specific architecture involving memory streams and JSON-RPC message routing, but now users have the flexibility to implement their own transport logic.
787
+
##### Motivation: Interface vs. Implementation
789
788
790
-
BaseSession (Implementation): Remains available for transports that follow the standard pattern of reading and writing JSON-RPC messages over streams. You can continue to inherit from this if you want the SDK to handle message linking and routing for you.
789
+
Previously, all custom sessions were required to inherit from BaseSession, which locked them into a specific architecture involving memory streams and JSON-RPC message routing, but with this change, users have the flexibility to implement their own transport logic with either of the following options:
791
790
792
-
AbstractBaseSession (Interface): A new stateless protocol for transports that do not use standard streams or JSON-RPC. It defines the "what" (method signatures) without enforcing the "how" (internal machinery).
791
+
***BaseSession (Implementation)**: Remains available for transports that follow the standard pattern of reading and writing JSON-RPC messages over streams. You can continue to inherit from this if you want the SDK to handle message linking and routing for you.
792
+
793
+
***AbstractBaseSession (Interface)**: A new stateless protocol for transports that do not use standard streams or JSON-RPC. It defines the "what" (method signatures) without enforcing the "how" (internal machinery).
0 commit comments