# 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 once the sandbox root has been initialized. # server.py is created in a later task; importing it lazily keeps this # package importable (and unit-testable) before that task lands. try: # pragma: no cover - exercised once server.py exists from files_mcp.server import app # noqa: E402 except ImportError: app = None # type: ignore[assignment] ROOT: Path | None = _ROOT __all__ = ["app", "ROOT"]