Skip to content

Bug: Frontend shows "MCP added!" success toast when streamable-http connection fails #2823

@mgquach

Description

@mgquach

Bug: Frontend shows "MCP added!" success toast when streamable-http connection fails

Describe the bug
When connecting a streamable-http MCP server with an invalid URL, the backend correctly returns a 400 error, but the frontend displays a green "MCP added!" success toast. The "My MCPs" tab then shows "No MCP servers connected", which contradicts the success toast.

SSE connections with the same invalid input correctly show an error toast.

To Reproduce

  1. Open the MCP Servers dialog
  2. Select type "streamable-http"
  3. Enter any invalid URL (e.g. "abc")
  4. Click Confirm
  5. Observe: green "MCP added!" toast appears, but no server is listed under "My MCPs"

Expected behavior
The frontend should show an error toast (consistent with SSE behavior), since the backend returns HTTP 400:

{"detail": "Could not connect to the MCP: unhandled errors in a TaskGroup (1 sub-exception)"}

Actual behavior

  • SSE with invalid URL → error toast (correct)
  • streamable-http with invalid URL → "MCP added!" success toast (incorrect)

Environment

  • Chainlit version: 2.9.6
  • MCP SDK version: 1.26.0
  • Python version: 3.13+

Additional context
The backend behavior is correct in both cases (returns 400). This appears to be a frontend-only issue in how the streamable-http response is handled compared to SSE.

Related: #2147 (MCP URL validation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfrontendPertains to the frontend.needs-triage

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions