Skip to content

Commit 728e491

Browse files
committed
Docker 빌드 수정: docker-compose.yml 및 Dockerfile의 경로 오류를 수정하여 정상 빌드가 가능하도록 조치했습니다.
Windows 로그 경로 개선: Python 서버가 Windows 환경에서 올바른 AppData 경로(Standard)를 사용하도록 수정했습니다. 코드 정리: C# 설정 스크립트에서 불필요한 경로 참조를 제거했습니다.
1 parent 7f481eb commit 728e491

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

MCPForUnity/Editor/Setup/ServerEnvironmentSetup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public static class ServerEnvironmentSetup
1818
{
1919
public static string ServerRoot => Path.Combine(AssetPathUtility.GetPackageAbsolutePath(), "Server~");
2020
public static string VenvPath => Path.Combine(ServerRoot, ".venv");
21-
public static string RequirementsPath => Path.Combine(ServerRoot, "Server", "requirements.txt");
2221

2322
private const string UV_VERSION = "0.5.11";
2423

MCPForUnity/Server~/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ RUN pip install uv
2020

2121
COPY . /app
2222

23-
WORKDIR /app/Server
23+
WORKDIR /app
2424

2525
RUN uv sync --frozen --no-dev
2626

2727
EXPOSE 8080
2828

29-
ENV PYTHONPATH=/app/Server/src
29+
ENV PYTHONPATH=/app
3030

3131
CMD ["uv", "run", "python", "src/main.py", "--transport", "http", "--http-host", "0.0.0.0", "--http-port", "8080"]

MCPForUnity/Server~/src/main.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@
3838

3939
# Also write logs to a rotating file so logs are available when launched via stdio
4040
try:
41-
_log_dir = os.path.join(os.path.expanduser(
42-
"~/Library/Application Support/UnityMCP"), "Logs")
41+
if os.name == 'nt':
42+
_base_dir = os.environ.get('APPDATA') or os.path.expanduser('~\\AppData\\Roaming')
43+
_log_dir = os.path.join(_base_dir, "UnityMCP", "Logs")
44+
else:
45+
_log_dir = os.path.join(os.path.expanduser(
46+
"~/Library/Application Support/UnityMCP"), "Logs")
4347
os.makedirs(_log_dir, exist_ok=True)
4448
_file_path = os.path.join(_log_dir, "unity_mcp_server.log")
4549
_fh = RotatingFileHandler(
@@ -378,8 +382,11 @@ def main():
378382
# Allow individual host/port to override URL components
379383
http_host = args.http_host or os.environ.get(
380384
"UNITY_MCP_HTTP_HOST") or parsed_url.hostname or "localhost"
381-
http_port = args.http_port or (int(os.environ.get("UNITY_MCP_HTTP_PORT")) if os.environ.get(
382-
"UNITY_MCP_HTTP_PORT") else None) or parsed_url.port or 8080
385+
# Parse HTTP port safely
386+
env_port = os.environ.get("UNITY_MCP_HTTP_PORT")
387+
parsed_port = int(env_port) if env_port else None
388+
389+
http_port = args.http_port or parsed_port or parsed_url.port or 8080
383390

384391
os.environ["UNITY_MCP_HTTP_HOST"] = http_host
385392
os.environ["UNITY_MCP_HTTP_PORT"] = str(http_port)
@@ -400,8 +407,12 @@ def main():
400407
parsed_url = urlparse(http_url)
401408
host = args.http_host or os.environ.get(
402409
"UNITY_MCP_HTTP_HOST") or parsed_url.hostname or "localhost"
403-
port = args.http_port or (int(os.environ.get("UNITY_MCP_HTTP_PORT")) if os.environ.get(
404-
"UNITY_MCP_HTTP_PORT") else None) or parsed_url.port or 8080
410+
411+
# Safe port parsing for transport logic
412+
env_port_t = os.environ.get("UNITY_MCP_HTTP_PORT")
413+
env_port_val = int(env_port_t) if env_port_t else None
414+
415+
port = args.http_port or env_port_val or parsed_url.port or 8080
405416

406417
logger.info(f"Starting FastMCP with SSE transport on {host}:{port}")
407418
mcp.run(transport=transport, host=host, port=port)

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ version: "3.9"
33
services:
44
unity-mcp-server:
55
build:
6-
context: .
7-
dockerfile: Server/Dockerfile
6+
context: MCPForUnity/Server~
7+
dockerfile: Dockerfile
88
ports:
99
- "8080:8080"
1010
restart: unless-stopped
1111
environment:
12-
- PYTHONPATH=/app/Server/src
12+
- PYTHONPATH=/app
1313
command: ["uv", "run", "python", "src/main.py", "--transport", "http", "--http-host", "0.0.0.0", "--http-port", "8080"]

0 commit comments

Comments
 (0)