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
Expose server-assigned session_id on ClientSession
Read session_id from InitializeResult._meta after initialize and expose
as session.session_id property. Enables client-side construction of
session-scoped event topics for the {session_id} authorization convention.
Copy file name to clipboardExpand all lines: docs/events.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,10 @@ Topics are `/`-separated strings with a maximum depth of 8 segments. Clients sub
27
27
-`+` matches exactly one segment
28
28
-`#` matches zero or more trailing segments (must be the last segment)
29
29
30
+
### Session-Scoped Topics
31
+
32
+
Servers may use a `{session_id}` placeholder in topic patterns to scope topics to individual sessions (e.g., `app/sessions/{session_id}/messages`). When a topic contains `{session_id}`, the server enforces that subscribers can only substitute their own session UUID -- wildcards and other session IDs are rejected. This convention is not part of the core MCP spec but is a common server-side pattern (used by FastMCP, among others).
After initialization, `session.session_id` returns the server-assigned session ID (`str | None`), sourced from `InitializeResult._meta["session_id"]`. This is useful for constructing session-scoped topic patterns:
0 commit comments