How to fix Context7 MCP 'SSE stream disconnected: TypeError: terminated'?
My MCP client intermittently logs
SSE stream disconnected: TypeError: terminatedwhen using Context7 with"url": "https://mcp.context7.com/mcp". Toggling the Context7 connection off and on in the client's MCP panel fixes it temporarily. Is there a permanent fix, or is this a known issue? Clients reported in the thread include Gemini CLI and Kilo Code.Originally asked on GitHub: https://github.com/upstash/context7/issues/341
5 answers
The issue thread is closed, and as of the last maintainer comments no fix is planned: a maintainer replied “not planned for now”, and another later noted the error appears to be client-related in at least some cases (several reporters saw it with Gemini CLI and Kilo Code). The reporter’s configuration was:
json"Context7": { "url": "https://mcp.context7.com/mcp" }The only workaround confirmed in the thread is toggling the Context7 connection off and on in your client’s MCP panel; the connection re-establishes and works again until the next disconnect. One Gemini CLI user reported that simply retrying the request worked and suspected a network interruption. A maintainer suggested that keep-alive events or switching to a client that supports Streamable HTTP instead of SSE might solve it, but that was a suggestion and was not tested in the thread.
Note that one Kilo Code user who self-hosted Context7 (Docker Compose with a Redis container) reported the same “SSE stream disconnected: TypeError: terminated” error, so at least in that case self-hosting did not avoid it.
As general advice: if you hit the error, retry the request or toggle the MCP connection off and on. If it happens often, try a client that uses Streamable HTTP, per the maintainer’s suggestion.
Did this work for you?What a GitHub user tried on GitHub (Worked)
The reporter toggled the Context7 main switch off and on in the client's MCP panel whenever the error appeared; the connection was re-established and worked until the next disconnect.
Source: https://github.com/upstash/context7/issues/341 (opens external site)
Did this work for you?What @Ucok23 tried on GitHub (Worked)
A Gemini CLI user retried the Context7 request and reported that the tools functioned correctly afterward, possibly due to a network interruption.
Source: https://github.com/upstash/context7/issues/341#issuecomment-3431731087 (opens external site)
Did this work for you?What @AlexeyBoiler tried on GitHub (Didn't work)
A Kilo Code user self-hosted Context7 with Docker Compose (context7 image plus a Redis container, port 127.0.0.1:8080) and still reported the same 'SSE stream disconnected: TypeError: terminated' error.
Source: https://github.com/upstash/context7/issues/341#issuecomment-3508846429 (opens external site)
Did this work for you?What @enesgules tried on GitHub (Outcome unclear)
A maintainer suggested sending periodic keep-alive events or using a client that supports Streamable HTTP instead of SSE, but said they were not sure it was necessary; this was not tested in the thread.
Source: https://github.com/upstash/context7/issues/341#issuecomment-3012740000 (opens external site)
Did this work for you?
Related questions
- How do I add a library's generated llms.txt / llms-full.txt file to Context7?
- Does Context7 support documentation versioning like Next.js 13 vs 14?
- Does the context7 MCP server support SSE or Streamable HTTP transport?
- Does Context7 validate user-submitted repository docs against malicious content?
- Context7 MCP: "Documentation not found or not finalized" error in Claude Code — fix?