Replies: 2 comments
-
the With Session Management also does not work, it creates session id when initialize, and it was sent through response header, but after that, client sends initialized event imideiately but without session id. |
Beta Was this translation helpful? Give feedback.
0 replies
-
that is a bug |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-submission Checklist
Question Category
Question
We're trying to integrate MCP using the official mcp Python SDK, and we’ve hit a persistent issue where the MCP server (via sse_app()) fails to recognize the x-session-id and x-user-id headers — even when they are present and correct.
Our Setup
Backend: FastAPI (Python 3.10)
MCP Integration:
We're using app = mcp.sse_app() from FastMCP, mounted at /mcp
Frontend: Nextjs + Redux
It calls our backend /mcp/query, which acts as a proxy to /mcp/messages/
Session Management:
We're generating a proper sessionid and userid per user, storing in Redux and headers
Proxy Logic (/mcp/query)
Our backend proxy forwards the request to MCP like this:
Diagnostics:
Inside our MCP prompt (@mcp.prompt()), we added:
🔍 Result: the headers never show up as x-session-id or x-user-id.
Instead, we keep getting: Received request without session_id
Even though we confirmed those headers are being sent.
Even Direct cURL Fails
We ran:
❌ Still got session_id is required.
Can anybody please clarify:
Does sse_app() actually support reading session info from headers like x-session-id, x-user-id?
Is there any middleware/filter stripping headers we should account for?
Would it be possible to support reading session directly from the JSON body? (some parts of the docs mention it, but SDK doesn't seem to support that)
Any example of sse_app() working in a FastAPI-based fullstack integration (Nextjs/React + FastAPI)?
Beta Was this translation helpful? Give feedback.
All reactions