Skip to content

Python MCP SDK's session.initialize() only returns the parsed JSON-RPC result, not the HTTP response headers (MCP-Session-Id) #1643

@neerajagarwal041

Description

@neerajagarwal041

Ee're injecting MCP-Session-Id in the middleware is in the HTTP response headers at MCP Server, but the MCP SDK's session.initialize() only returns the parsed JSON-RPC result, not the HTTP headers.

The middleware IS adding the header to the HTTP response (both for the initial SSE GET and for the subsequent POST requests to /messages/), but the MCP SDK doesn't expose those headers to us.

Our MCP Server using the mcp.server.fastmcp Python SDK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions