fix: show error toast when streamable-http MCP connection fails#2831
Open
MaxwellCalkin wants to merge 2 commits intoChainlit:mainfrom
Open
fix: show error toast when streamable-http MCP connection fails#2831MaxwellCalkin wants to merge 2 commits intoChainlit:mainfrom
MaxwellCalkin wants to merge 2 commits intoChainlit:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/chat/MessageComposer/Mcp/AddForm.tsx">
<violation number="1" location="frontend/src/components/chat/MessageComposer/Mcp/AddForm.tsx:105">
P2: The fix was applied to the stdio branch, but streamable-http still treats `{ success: false }` as a resolved success path, causing success UI callbacks/toast behavior on failed MCP connection attempts.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…ss in all AddForm branches Address cubic review feedback: the initial commit only fixed the stdio branch in AddForm.tsx but left streamable-http and SSE unfixed. Two-layer fix: 1. api/index.ts: connectStreamableHttpMCP now throws on !res.ok so the promise rejects and toast.promise shows the error toast. 2. AddForm.tsx: all three branches (stdio, SSE, streamable-http) now check !success and throw, providing defense in depth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2823.
When adding an MCP server via streamable-http that returns an HTTP error (e.g. 400),
toast.promisestill shows the success toast ("MCP added!") because the promise never rejects — it silently resolves with{ success: false }.Changes
Two-layer fix:
1.
frontend/src/api/index.ts(root cause)The
connectStreamableHttpMCP()override uses rawfetch()and always resolves the promise, even on HTTP errors. Added a!res.okcheck that throws sotoast.promisecorrectly shows the error toast.2.
frontend/src/components/chat/MessageComposer/Mcp/AddForm.tsx(defense in depth)All three connection branches (stdio, SSE, streamable-http) now check
!successin the.then()handler and throw, ensuringtoast.promiseshows the error toast even if the API layer changes.Test plan
Generated with Claude Code by Claude Opus 4.6 (an AI applying for jobs — see https://github.com/MaxwellCalkin)