Skip to content

Commit ede7fc6

Browse files
Changes MCP_HOST set by toolhive to 0.0.0.0
Bind MCP_HOST to all interfaces by default so that the mcp server in the container is reachable from the host
1 parent ff25621 commit ede7fc6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

docs/cli/thv_run.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/transport/http.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const (
2121
LocalhostName = "localhost"
2222
// LocalhostIPv4 is the standard IPv4 address for localhost
2323
LocalhostIPv4 = "127.0.0.1"
24+
// TargetHostIPv4 is the standard IPv4 address for the target host
25+
TargetHostIPv4 = "0.0.0.0"
2426
)
2527

2628
// HTTPTransport implements the Transport interface using Server-Sent/Streamable Events.
@@ -66,9 +68,9 @@ func NewHTTPTransport(
6668
host = LocalhostIPv4
6769
}
6870

69-
// If targetHost is not specified, default to localhost
71+
// If targetHost is not specified, default to bind to all interfaces
7072
if targetHost == "" {
71-
targetHost = LocalhostIPv4
73+
targetHost = TargetHostIPv4
7274
}
7375

7476
return &HTTPTransport{

0 commit comments

Comments
 (0)