Skip to content

401 Unauthorized: Session not found #384

@JMLX42

Description

@JMLX42

Following up on a bug tracked on the rmcp-actix-web crate:

https://gitlab.com/lx-industries/rmcp-actix-web/-/issues/15#note_2699030396

This bug also affects the offficial axum implementation. So I'm creating this issue to make sure we agree on the expected behavior.

Describe the bug

The session is automatically destroyed when the SSE streaming connection ends in the HTTP streamable implementation.

  1. Session Creation: Client POSTs → Session ID returned ✅
  2. SSE Connection: Client GETs SSE stream ✅
  3. Service Task: Spawned task calls service.waiting().await
  4. Critical Issue: When SSE connection drops, service.waiting() completes
  5. Auto Cleanup: Session gets automatically destroyed 💥
  6. Failure: Next request with same session ID → 401: Session not found

To Reproduce
Steps to reproduce the behavior:

  1. run the composition_streamable_http_example example
  2. open MCP inspector
  3. call "List Tools" twice or call List Tools then the sum tool

Expected behavior

Calling "List Tools" twice or calling multiple tools should work.

Logs

Not available yet. Will add ASAP.

Additional context

stateful_mode = false solves the problem. But many (most?) tools - such as sum - are stateful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bugBug fixes and error corrections

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions