Skip to content

MCP Server with HTTP transport fails after connection reset #418

Description

@vugenti

If connection to HTTP based MCP server is temporarily disrupted after the tools are initialized, the following errors appear in logs and no requests can be processed until after the agent is restarted and establishes a new connection to the MCP server:

time=2026-02-15T20:54:27.468-05:00 level=DEBUG msg="Agent is consuming a job" agent=test_agent job="&{Result:0xc000428120 ReasoningCallback:0x7ff653d0f180 ResultCallback:0x7ff653d0eb60 ConversationHistory:[{Role:user Content:tt Refusal: MultiContent:[] Name: ReasoningContent: FunctionCall:<nil> ToolCalls:[] ToolCallID:}] UUID:dc35e499-201a-4e8b-88a6-0b6955af6fb6 Metadata:map[] DoneFilter:false BuiltinTools:[] UserTools:[] ToolChoice: context:0xc000610050 fragment:<nil> cancel:0x7ff652e26ec0 Obs:0xc000580840}" source.file=C:/src/LocalAGI/core/agent/agent.go source.L=1315
time=2026-02-15T20:54:27.469-05:00 level=DEBUG msg="No filters" source.file=C:/src/LocalAGI/core/agent/agent.go source.L=588
time=2026-02-15T20:54:27.469-05:00 level=DEBUG msg="Processing user inputs" agent=test_agent conversation="user: tt\n" source.file=C:/src/LocalAGI/core/agent/agent.go source.L=512
time=2026-02-15T20:54:27.469-05:00 level=DEBUG msg="[Knowledge Base Lookup] Disabled, skipping" agent=test_agent source.file=C:/src/LocalAGI/core/agent/knowledgebase.go source.L=21
time=2026-02-15T20:54:27.478-05:00 level=ERROR msg="Error listing tools: %v" !BADKEY="connection closed: calling \"tools/list\": client is closing: standalone SSE stream: failed to connect: Bad Request" source.file=C:/Users/user/go/pkg/mod/github.com/mudler/cogito@v0.8.2-0.20260215230740-d1c0dc9bd9dc/mcp.go source.L=108
time=2026-02-15T21:50:08.960-05:00 level=ERROR msg="Error executing cogito" error="failed to get relevant guidelines: failed to get MCP tools: connection closed: calling \"tools/list\": client is closing: standalone SSE stream: failed to connect: Bad Request" source.file=C:/src/LocalAGI/core/agent/agent.go source.L=1162
time=2026-02-15T21:50:08.960-05:00 level=DEBUG msg="Agent has finished" agent=test_agent source.file=C:/src/LocalAGI/core/agent/agent.go source.L=238

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions