# coding=utf-8 """ @Time :2026/6/30 @Author :tao.chen """ from pathlib import Path from files_mcp.core import path_guard # Fail fast at process start if FILES_MCP_ROOT is unset / bad. During tests # the root is injected via set_root_for_testing(), so tolerate the env var # being unset here rather than crashing at import/collection time. _ROOT: Path | None try: _ROOT = path_guard._init_root() except RuntimeError: _ROOT = None # Re-export the FastAPI app. server.py now exists, so this import is # unconditional — a missing/corrupt server.py fails loud at import time # (production-correct behavior). The sandbox root is only needed by the # tool routes at request time, not at import, so this stays safe to import # even when FILES_MCP_ROOT is unset (e.g. during pytest collection). from files_mcp.server import app # noqa: E402 ROOT: Path | None = _ROOT __all__ = ["app", "ROOT"]