feat(files-mcp): mount at /files-mcp via MCP_SERVICES registry
- main.py: import files_app, append McpService entry to MCP_SERVICES. Lifespan already iterates the list, so no edit to the lifespan function. - tests/conftest.py: autouse fixture rebinds files_mcp.core.path_guard._ROOT to a per-test tmp_path so the sandbox is fresh for every test. - files_mcp/__init__.py: drop the try/except around the server import now that server.py exists, restoring fail-fast on a missing/corrupt server module in production. The _init_root() try/except stays, since pytest collection can import the package before FILES_MCP_ROOT is set. Verified via uv run pytest: 327 tests pass, no regressions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,3 +6,20 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _isolate_files_mcp_root(tmp_path, monkeypatch):
|
||||
"""Point files_mcp at a fresh tmp_path for every test.
|
||||
|
||||
Sets FILES_MCP_ROOT and rebinds files_mcp.core.path_guard's module-level
|
||||
_ROOT, so each test starts with an empty sandbox. Spark_executor tests
|
||||
are unaffected by this fixture — they don't touch the files_mcp sandbox.
|
||||
"""
|
||||
monkeypatch.setenv("FILES_MCP_ROOT", str(tmp_path))
|
||||
from files_mcp.core import path_guard
|
||||
path_guard.set_root_for_testing(tmp_path.resolve())
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user