Skip to content

Upgrade to protocol version 2024-10-07 - #19

Merged
jspahrsummers merged 4 commits into
mainfrom
justin/upgrade-spec
Oct 21, 2024
Merged

Upgrade to protocol version 2024-10-07#19
jspahrsummers merged 4 commits into
mainfrom
justin/upgrade-spec

Conversation

@jspahrsummers

@jspahrsummers jspahrsummers commented Oct 21, 2024

Copy link
Copy Markdown
Member

Necessary to use the Python SDK with the latest versions of the inspector and example servers.

@jspahrsummers
jspahrsummers requested a review from dsp-ant October 21, 2024 13:51
Comment thread mcp_python/types.py
"""Parameters for the initialize request."""

protocolVersion: Literal[1]
protocolVersion: str | int

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lenient version parsing for now.

Comment thread mcp_python/types.py
"""After receiving an initialize request from the client, the server sends this."""

protocolVersion: Literal[1]
protocolVersion: str | int

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lenient version parsing for now.

@jspahrsummers
jspahrsummers merged commit 6cdd97b into main Oct 21, 2024
@jspahrsummers
jspahrsummers deleted the justin/upgrade-spec branch October 21, 2024 14:33
ksteiny pushed a commit to ksteiny/python-sdk that referenced this pull request Dec 5, 2025
feat(tools): add place_option_combo_order for multileg orders
MrSampson added a commit to MrSampson/python-sdk that referenced this pull request Aug 19, 2026
…ion (#1)

* fix: return a self-describing 404 for an unknown streamable-http session

StreamableHTTPSessionManager answered a request for a missing or
credential-mismatched session with a bare "Session not found" -- the
same misleading-error problem modelcontextprotocol#19/modelcontextprotocol#26 already fixed for
SseServerTransport's equivalent case (a redeploy or expiry invalidating
every connected client's session_id at once), just not ported to this
transport.

Both call sites now share one message via _session_not_found_response(),
built once so the "unknown session" and "credential mismatch" cases
(which must answer identically -- see the comment) can't drift apart.

Verified: full suite 1140 passed / 0 regressions (95 skipped, 1 xfailed,
2 pre-existing collection errors for the unrelated optional `websockets`
extra, not installed in this environment) plus ruff and pyright clean.

* fix: address review -- comment direction, unvalidated input note, expire coverage

- _session_not_found_response's comment said "callers below" / "check
  above" -- true when this sat inline in sse.py, backwards once hoisted
  to a module-level function above both call sites. Converted to a
  docstring, direction fixed.
- session_id here is the raw, client-supplied mcp-session-id header,
  never validated against SESSION_ID_PATTERN (only IDs the server mints
  are) -- unlike sse.py's session_id.hex, which is already
  UUID-validated. Safe (JSON-escaped, application/json, truncated to
  64 chars matching the file's existing convention) but the docstring
  now says so, rather than leaving it to be re-derived later.
- Test now asserts "expire" is covered, not just "restart" -- the one
  genuinely new clause this message adds over the sse-side wording
  (this transport has a session_idle_timeout; sse doesn't), which was
  the one claim the prior substring checks didn't actually verify.

---------

Co-authored-by: oliver <oliver.sampson@gitterdan.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants