Skip to content

MCP Client Session Management Compatibility Issue #3035

@actuallyrizzn

Description

@actuallyrizzn

Problem Description

The Letta MCP client has compatibility issues with MCP servers that implement SSE (Server-Sent Events) transport. When connecting to MCP servers via SSE, Letta attempts to send JSON-RPC requests via POST to the SSE endpoint, which is not supported by the MCP specification.

Root Cause Analysis

After examining the Letta source code and testing with FastMCP servers, the issue is:

  1. Letta's SSE client expects bidirectional communication - It tries to POST JSON-RPC requests to /sse endpoint
  2. FastMCP's SSE implementation is unidirectional - It only supports server→client streaming via GET requests
  3. MCP SSE specification requires bidirectional communication - Clients should be able to send requests over the SSE connection itself

Expected Behavior

Letta should follow the proper MCP SSE protocol flow:

  1. Connect to SSE endpoint (/sse) via GET request
  2. Send JSON-RPC requests (initialize, tools/list) over the SSE connection itself
  3. Receive responses via SSE events
  4. Use established session for subsequent operations

Current Behavior

Letta incorrectly attempts to:

  1. ✅ Connect to SSE endpoint via GET request (works)
  2. ❌ Send JSON-RPC requests via POST to /sse endpoint (405 Method Not Allowed)
  3. ❌ Send JSON-RPC requests via POST to /messages/ endpoint (requires session_id)

This causes:

  • HTTP 405 Method Not Allowed on POST to /sse
  • HTTP 400 Bad Request on POST to /messages/ (session_id required)
  • Tool loading failures

Technical Details

From the Letta source code (letta/services/mcp/sse_client.py):

  • Uses official MCP library's sse_client
  • Expects bidirectional communication over SSE
  • Creates ClientSession with SSE transport streams

From server logs:

INFO: 34.72.165.107:36352 - "POST /sse HTTP/1.1" 405 Method Not Allowed
INFO: 64.95.12.49:53934 - "POST /messages/ HTTP/1.1" 400 Bad Request

Impact

This prevents Letta from successfully connecting to MCP servers that properly implement SSE transport according to the MCP specification.

Workaround

MCP server developers are forced to implement permissive endpoints that bypass proper MCP protocol flow, which compromises security and protocol compliance.

Request

Please update the Letta MCP client to properly implement bidirectional SSE communication according to the MCP specification, allowing JSON-RPC requests to be sent over the SSE connection itself rather than via separate POST requests.

Environment

  • Letta version: Latest
  • MCP Protocol version: 2024-11-05
  • Server: FastMCP-based servers with proper SSE implementation
  • Issue confirmed with clean FastMCP implementation (no custom overrides)

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