shouldRewriteLocalhostToDocker returns true when MCP server localhost URLs should be rewritten to host.docker.internal so that containerised AI agents can reach servers running on the host. Rewriting is enabled whenever the agent sandbox is active (i.e. sandbox.agent is not explicitly disabled).
(workflowData *WorkflowData)
| 65 | // running on the host. Rewriting is enabled whenever the agent sandbox is active |
| 66 | // (i.e. sandbox.agent is not explicitly disabled). |
| 67 | func shouldRewriteLocalhostToDocker(workflowData *WorkflowData) bool { |
| 68 | result := workflowData != nil && (workflowData.SandboxConfig == nil || |
| 69 | workflowData.SandboxConfig.Agent == nil || |
| 70 | !workflowData.SandboxConfig.Agent.Disabled) |
| 71 | mcpRenderingLog.Printf("shouldRewriteLocalhostToDocker: %v (agent sandbox active)", result) |
| 72 | return result |
| 73 | } |
| 74 | |
| 75 | // noOpCacheMemoryRenderer is a no-op MCPToolRenderers.RenderCacheMemory function for engines |
| 76 | // that do not need an MCP server entry for cache-memory. Cache-memory is a simple file share |
no test coverage detected