-
Notifications
You must be signed in to change notification settings - Fork 600
Description
Hi team 👋
I'd like to propose adding support for specifying a desired mcp-session-id when initializing an McpClient. This could be exposed as an optional field in McpClientOptions.
Motivation
In some scenarios, it's useful to associate a client session with a pre-defined or externally managed session ID—for example, for debugging, tracing, or coordinating across services. Currently, the session ID appears to be auto-generated internally, which limits flexibility in these cases.
Suggested Change
Extend McpClientOptions to include an optional sessionId (or mcpSessionId) field. If provided, the client should use this value instead of generating a new one.
public sealed class McpClientOptions
{
// ...existing fields
public string? SessionId { get; set; } // optional override for mcp-session-id
}Benefits
- Enables better traceability across systems
- Facilitates integration with external session management tools
- Adds flexibility without breaking existing behavior
Let me know if this sounds reasonable or if there's a preferred way to approach it. Happy to help with a PR if needed!
Thanks 🙏