diff --git a/nextcloud_mcp_server/server/__init__.py b/nextcloud_mcp_server/server/__init__.py index 38ba6ea3..45fab885 100644 --- a/nextcloud_mcp_server/server/__init__.py +++ b/nextcloud_mcp_server/server/__init__.py @@ -1,4 +1,6 @@ -from typing import Callable +from collections.abc import Callable + +from mcp.server.fastmcp import FastMCP from .calendar import configure_calendar_tools from .collectives import configure_collectives_tools @@ -16,7 +18,7 @@ from .webdav import configure_webdav_tools # Used by app.py (HTTP), stdio.py (stdio), and cli.py (--enable-app choices). # Semantic search is excluded here because it is a cross-app feature gated # by VECTOR_SYNC_ENABLED, not an individual Nextcloud app. -AVAILABLE_APPS: dict[str, Callable] = { +AVAILABLE_APPS: dict[str, Callable[[FastMCP], None]] = { "notes": configure_notes_tools, "tables": configure_tables_tools, "webdav": configure_webdav_tools, diff --git a/tests/test_cli.py b/tests/test_cli.py index c97c0132..9d25dae9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -318,10 +318,6 @@ def test_stdio_calls_get_stdio_mcp(runner, clean_env, monkeypatch): called_with["enabled_apps"] = enabled_apps return FakeMcp() - monkeypatch.setattr( - "nextcloud_mcp_server.cli.get_stdio_mcp", mock_get_stdio_mcp, raising=False - ) - # The lazy import means we need to patch at the module level it imports from monkeypatch.setattr("nextcloud_mcp_server.stdio.get_stdio_mcp", mock_get_stdio_mcp) result = runner.invoke(run, ["--transport", "stdio"]) diff --git a/tests/unit/test_stdio.py b/tests/unit/test_stdio.py index 06602f80..a70053be 100644 --- a/tests/unit/test_stdio.py +++ b/tests/unit/test_stdio.py @@ -17,6 +17,8 @@ def single_user_env(monkeypatch): # Ensure multi-user mode is off (may leak from other tests) monkeypatch.delenv("ENABLE_MULTI_USER_BASIC_AUTH", raising=False) _reload_config() + yield + _reload_config() @pytest.mark.unit