feat(mcp): support DisableStandaloneSSE for HTTP transport (#2108)
This commit is contained in:
parent
e414b82ac3
commit
e70928cc6f
1 changed files with 14 additions and 3 deletions
|
|
@ -276,14 +276,25 @@ func (m *Manager) ConnectServer(
|
||||||
if cfg.URL == "" {
|
if cfg.URL == "" {
|
||||||
return fmt.Errorf("URL is required for SSE/HTTP transport")
|
return fmt.Errorf("URL is required for SSE/HTTP transport")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure DisableStandaloneSSE based on transport type.
|
||||||
|
// - "http": Request-response only mode. Disable the standalone SSE stream
|
||||||
|
// to avoid compatibility issues with servers that don't support GET /mcp.
|
||||||
|
// - "sse": Bidirectional mode. Enable the standalone SSE stream to receive
|
||||||
|
// server-initiated notifications (e.g., ToolListChangedNotification).
|
||||||
|
// - Empty or auto-detected: Defaults to "sse" behavior (standalone SSE enabled).
|
||||||
|
disableStandaloneSSE := (cfg.Type == "http")
|
||||||
|
|
||||||
logger.DebugCF("mcp", "Using SSE/HTTP transport",
|
logger.DebugCF("mcp", "Using SSE/HTTP transport",
|
||||||
map[string]any{
|
map[string]any{
|
||||||
"server": name,
|
"server": name,
|
||||||
"url": cfg.URL,
|
"url": cfg.URL,
|
||||||
|
"disableStandaloneSSE": disableStandaloneSSE,
|
||||||
})
|
})
|
||||||
|
|
||||||
sseTransport := &mcp.StreamableClientTransport{
|
sseTransport := &mcp.StreamableClientTransport{
|
||||||
Endpoint: cfg.URL,
|
Endpoint: cfg.URL,
|
||||||
|
DisableStandaloneSSE: disableStandaloneSSE,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add custom headers if provided
|
// Add custom headers if provided
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue