Skip to content

fix: extract client info per-request in stateless mode#28

Merged
kashishhora merged 1 commit intomainfrom
fix/stateless-client-info-bleed
Apr 1, 2026
Merged

fix: extract client info per-request in stateless mode#28
kashishhora merged 1 commit intomainfrom
fix/stateless-client-info-bleed

Conversation

@kashishhora
Copy link
Copy Markdown
Member

Summary

In stateless mode, the SDK cached client_name/client_version from the first request and applied it to all subsequent users on the shared server. A customer reported all sessions showing "Cursor/2.6.22" even for Claude/Codex users.

Fix: same pattern as the identity fix — extract client info per-request, set directly on each event, skip the session_info merge in stateless mode so event-level values survive. Also extracts clientInfo from MCP InitializeRequest params in low-level handlers (was a TODO).

Bumps version to 0.1.15b2.

Depends on

  • MCPCat/mcpcat-server#209

Test plan

  • 3 new tests in test_stateless.py
  • 350 passed full regression

@kashishhora kashishhora requested a review from naji247 March 31, 2026 14:49
Comment on lines +253 to +257
if request.params and hasattr(request.params, 'clientInfo') and request.params.clientInfo:
client_name = request.params.clientInfo.name
client_version = getattr(request.params.clientInfo, 'version', None)
if not client_name:
client_name, client_version = get_client_info_from_request_context(server, request_context)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did you do a db look up to see what they look like?

Separately, I'm worried initialized is either:

  1. Not consistently published via the Python SDK
  2. May have a different client ID and version than is advertised via headers

Not sure how you want to handle that since it may mean new sessions created incorrectly...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe good to do an analysis on DB for some of these questions :|

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.

Will look into this as a separate PR. Can merge this for now since it's still a beta version.

@kashishhora kashishhora merged commit 1bdfd6d into main Apr 1, 2026
39 checks passed
@kashishhora kashishhora deleted the fix/stateless-client-info-bleed branch April 1, 2026 14:48
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