Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,14 @@ private static Uri BuildWebSocketUri(string baseUrl)
throw new InvalidOperationException($"Invalid MCP base URL: {baseUrl}");
}

// Replace 0.0.0.0 with localhost for client connections
// 0.0.0.0 is only valid for server binding, not client connections
string host = httpUri.Host == "0.0.0.0" ? "localhost" : httpUri.Host;
// Replace bind-only addresses with localhost for client connections
// 0.0.0.0 and :: are only valid for server binding, not client connections
string host = httpUri.Host;
if (host == "0.0.0.0" || host == "::")
{
McpLog.Warn($"[WebSocket] Base URL host '{host}' is bind-only; using 'localhost' for client connection.");
host = "localhost";
}

var builder = new UriBuilder(httpUri)
{
Expand Down
7 changes: 6 additions & 1 deletion Server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ EXPOSE 8080

ENV PYTHONPATH=/app/Server/src

CMD ["uv", "run", "python", "src/main.py", "--transport", "http", "--http-host", "0.0.0.0", "--http-port", "8080"]
# ENTRYPOINT allows override via docker run arguments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The comment about ENTRYPOINT being overridable via docker run is a bit misleading.

With an ENTRYPOINT like `[

# Default: stdio transport (Docker MCP Gateway compatible)
# For HTTP: docker run -p 8080:8080 <image> --transport http --http-host 0.0.0.0 --http-port 8080
# If hosting remotely, you should add the --project-scoped-tools flag
ENTRYPOINT ["uv", "run", "mcp-for-unity"]
CMD []