Files
LocalAI/core/http/endpoints
localai-org-maint-botandlocalai-org-maint-bot 0102751b31 fix(mcp): connect to legacy SSE servers (#12304)
* fix(mcp): connect to legacy SSE servers

Remote model MCP connections only use Streamable HTTP, so legacy SSE
servers fail initialization. Retry with SSE when the initial POST returns
400, 404, or 405.

Share one discovery timeout across attempts and cancel failed connections
without truncating successful sessions. Preserve HTTP policy and reject
foreign SSE message endpoints before attaching credentials.

Add SDK integration tests and document automatic transport selection.

Assisted-by: Codex:gpt-6
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* fix(mcp): avoid narrowing HTTP status codes

Store the initialization status in a 64-bit atomic value to avoid the
integer overflow conversion reported by gosec.

Assisted-by: Codex:GPT-6 gosec
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
2026-10-08 16:41:33 +02:00
..
…