Skip to content

Commit f5cee0a

Browse files
authored
docs: document stateless mode and custom transports (#485)
1 parent d870f5e commit f5cee0a

File tree

2 files changed

+52
-12
lines changed

2 files changed

+52
-12
lines changed

docs/protocol.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,35 @@ the server using the streamable transport protocol.
182182

183183
#### Stateless Mode
184184

185-
<!-- TODO -->
186-
187-
#### Sessionless mode
188-
189-
<!-- TODO -->
185+
The streamable server supports a _stateless mode_ by setting
186+
[`StreamableHTTPOptions.Stateless`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#StreamableHTTPOptions.Stateless),
187+
which is where the server does not perform any validation of the session id,
188+
and uses a temporary session to handle requests. In this mode, it is impossible
189+
for the server to make client requests, as there is no way for the client's
190+
response to reach the session.
191+
192+
However, it is still possible for the server to access the `ServerSession.ID`
193+
to see the logical session
194+
195+
> [!WARNING]
196+
> Stateless mode is not directly discussed in the spec, and is still being
197+
> defined. See modelcontextprotocol/modelcontextprotocol#1364,
198+
> modelcontextprotocol/modelcontextprotocol#1372, or
199+
> modelcontextprotocol/modelcontextprotocol#11442 for potential refinements.
200+
201+
_See [examples/server/distributed](../examples/server/distributed/main.go) for
202+
an example using statless mode to implement a server distributed across
203+
multiple processes._
190204

191205
### Custom transports
192206

193-
<!-- TODO -->
207+
The SDK supports [custom
208+
transports](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#custom-transports)
209+
by implementing the
210+
[`Transport`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Transport)
211+
interface: a logical bidirectional stream of JSON-RPC messages.
212+
213+
_Full example: [examples/server/custom-transport](../examples/server/custom-transport/main.go)._
194214

195215
### Concurrency
196216

internal/docs/protocol.src.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,35 @@ the server using the streamable transport protocol.
114114

115115
#### Stateless Mode
116116

117-
<!-- TODO -->
118-
119-
#### Sessionless mode
120-
121-
<!-- TODO -->
117+
The streamable server supports a _stateless mode_ by setting
118+
[`StreamableHTTPOptions.Stateless`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#StreamableHTTPOptions.Stateless),
119+
which is where the server does not perform any validation of the session id,
120+
and uses a temporary session to handle requests. In this mode, it is impossible
121+
for the server to make client requests, as there is no way for the client's
122+
response to reach the session.
123+
124+
However, it is still possible for the server to access the `ServerSession.ID`
125+
to see the logical session
126+
127+
> [!WARNING]
128+
> Stateless mode is not directly discussed in the spec, and is still being
129+
> defined. See modelcontextprotocol/modelcontextprotocol#1364,
130+
> modelcontextprotocol/modelcontextprotocol#1372, or
131+
> modelcontextprotocol/modelcontextprotocol#11442 for potential refinements.
132+
133+
_See [examples/server/distributed](../examples/server/distributed/main.go) for
134+
an example using statless mode to implement a server distributed across
135+
multiple processes._
122136

123137
### Custom transports
124138

125-
<!-- TODO -->
139+
The SDK supports [custom
140+
transports](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#custom-transports)
141+
by implementing the
142+
[`Transport`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Transport)
143+
interface: a logical bidirectional stream of JSON-RPC messages.
144+
145+
_Full example: [examples/server/custom-transport](../examples/server/custom-transport/main.go)._
126146

127147
### Concurrency
128148

0 commit comments

Comments
 (0)