MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / _make_session

Function _make_session

tests/server/test_session.py:63–72  ·  view source on GitHub ↗

Single-channel session: the stub is both request and standalone outbound.

(
    outbound: StubOutbound,
    *,
    capabilities: ClientCapabilities | None = None,
    protocol_version: str = LATEST_HANDSHAKE_VERSION,
)

Source from the content-addressed store, hash-verified

61
62
63def _make_session(
64 outbound: StubOutbound,
65 *,
66 capabilities: ClientCapabilities | None = None,
67 protocol_version: str = LATEST_HANDSHAKE_VERSION,
68) -> ServerSession:
69 """Single-channel session: the stub is both request and standalone outbound."""
70 client_info = Implementation(name="c", version="0") if capabilities is not None else None
71 conn = Connection.from_envelope(protocol_version, client_info, capabilities, outbound=outbound)
72 return ServerSession(outbound, conn)
73
74
75def _two_channel_session(request_ch: StubOutbound, standalone_ch: StubOutbound) -> ServerSession:

Calls 3

ImplementationClass · 0.90
ServerSessionClass · 0.90
from_envelopeMethod · 0.80

Tested by

no test coverage detected