Skip to content

[FEATURE] 优化外部mcp的http连接和无限请求 #35

@LilyAva000

Description

@LilyAva000

测试的 MCP : https://mcp.copilotkit.ai/

SSE 连接正常
HTTP 连接测试无法连接,且无法暂停中断,导致后台尝试无限请求最终触发Limit上限后继续不停的请求
HTTP 连接测试日志:

[GIN] 2026/02/25 - 15:31:54 | 200 |      30.791µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:31:55 | 200 |      32.833µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:31:56 | 200 |      30.375µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:07 | 200 |        37.5µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:07 | 200 |      52.583µs |             ::1 | GET      "/api/agent-loop/tasks"
[GIN] 2026/02/25 - 15:32:08 | 200 |      42.375µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:09 | 200 |      30.166µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:10 | 200 |      31.209µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:11 | 200 |      56.333µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:12 | 200 |      38.292µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:13 | 200 |      29.875µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:14 | 200 |      35.041µs |             ::1 | GET      "/api/external-mcp/CopilotKit_HTTP"
[GIN] 2026/02/25 - 15:32:14 | 200 |      53.708µs |             ::1 | GET      "/api/external-mcp"
{"level":"warn","timestamp":"2026-02-25T15:32:16.639+0800","caller":"mcp/external_manager.go:758","msg":"获取外部MCP工具数量失败(SSE 流已关闭或服务端未在流上返回 tools/list 响应)","name":"CopilotKit_SSE","hint":"若为 SSE 连接,请确认服务端保持 GET 流打开并按 MCP 规范以 event: message 推送 JSON-RPC 响应","error":"connection closed: calling \"tools/list\": client is closing: EOF"}
[GIN] 2026/02/25 - 15:32:17 | 200 |      35.917µs |             ::1 | GET      "/api/agent-loop/tasks"
{"level":"warn","timestamp":"2026-02-25T15:32:26.639+0800","caller":"mcp/external_manager.go:758","msg":"获取外部MCP工具数量失败(SSE 流已关闭或服务端未在流上返回 tools/list 响应)","name":"CopilotKit_SSE","hint":"若为 SSE 连接,请确认服务端保持 GET 流打开并按 MCP 规范以 event: message 推送 JSON-RPC 响应","error":"connection closed: calling \"tools/list\": client is closing: EOF"}
[GIN] 2026/02/25 - 15:32:27 | 200 |      25.541µs |             ::1 | GET      "/api/agent-loop/tasks"
{"level":"warn","timestamp":"2026-02-25T15:32:36.639+0800","caller":"mcp/external_manager.go:758","msg":"获取外部MCP工具数量失败(SSE 流已关闭或服务端未在流上返回 tools/list 响应)","name":"CopilotKit_SSE","hint":"若为 SSE 连接,请确认服务端保持 GET 流打开并按 MCP 规范以 event: message 推送 JSON-RPC 响应","error":"connection closed: calling \"tools/list\": client is closing: EOF"}

期望优化交互解决无限请求问题,以及为何无法连接此MCP工具的 HTTP 模式。经测试,其它工具如 CURSOR, VSCODE 是可以正常连接此MCP工具的HTTP模式的

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions