Skip to content

Changes MCP_HOST set by toolhive to 0.0.0.0 #1089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/thv/app/run_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func AddRunFlags(cmd *cobra.Command, config *RunFlags) {
cmd.Flags().StringVar(
&config.TargetHost,
"target-host",
transport.LocalhostIPv4,
transport.TargetHostIPv4,
"Host to forward traffic to (only applicable to SSE or Streamable HTTP transport)")
cmd.Flags().StringVar(
&config.PermissionProfile,
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/thv_run.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pkg/transport/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const (
LocalhostName = "localhost"
// LocalhostIPv4 is the standard IPv4 address for localhost
LocalhostIPv4 = "127.0.0.1"
// TargetHostIPv4 is the standard IPv4 address for the target host
TargetHostIPv4 = "0.0.0.0"
)

// HTTPTransport implements the Transport interface using Server-Sent/Streamable Events.
Expand Down Expand Up @@ -66,9 +68,9 @@ func NewHTTPTransport(
host = LocalhostIPv4
}

// If targetHost is not specified, default to localhost
// If targetHost is not specified, default to bind to all interfaces
if targetHost == "" {
targetHost = LocalhostIPv4
targetHost = TargetHostIPv4
}

return &HTTPTransport{
Expand Down
Loading