MCPcopy Create free account
hub / github.com/github/gh-aw / shouldRewriteLocalhostToDocker

Function shouldRewriteLocalhostToDocker

pkg/workflow/mcp_renderer_factory.go:67–73  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

65// running on the host. Rewriting is enabled whenever the agent sandbox is active
66// (i.e. sandbox.agent is not explicitly disabled).
67func 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

Calls 1

PrintfMethod · 0.45

Tested by

no test coverage detected