fix: address PR review feedback and fix CI test failures

- Revert default transport to streamable-http (not a breaking change)
- Extract AVAILABLE_APPS constant to server/__init__.py (DRY)
- Wrap get_stdio_mcp ValueError in click.ClickException for clean errors
- Fix test_stdio.py: call _reload_config() so dynaconf sees env changes
- Use lazy %-style logging in stdio.py
- Add private API comments in test assertions
- Derive --enable-app CLI choices from AVAILABLE_APPS
- README: show explicit --transport stdio in uvx examples

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-04-07 23:03:12 +02:00
co-authored by Claude Opus 4.6
parent 09006fcea9
commit e9c46a04a0
8 changed files with 56 additions and 90 deletions
+8 -32
View File
@@ -11,7 +11,6 @@ import logging
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from dataclasses import dataclass
from typing import Callable
from mcp.server.fastmcp import Context, FastMCP
@@ -19,18 +18,7 @@ from nextcloud_mcp_server.client import NextcloudClient
from nextcloud_mcp_server.config import get_settings
from nextcloud_mcp_server.config_validators import AuthMode, validate_configuration
from nextcloud_mcp_server.context import get_client as get_nextcloud_client
from nextcloud_mcp_server.server import (
configure_calendar_tools,
configure_collectives_tools,
configure_contacts_tools,
configure_cookbook_tools,
configure_deck_tools,
configure_news_tools,
configure_notes_tools,
configure_sharing_tools,
configure_tables_tools,
configure_webdav_tools,
)
from nextcloud_mcp_server.server import AVAILABLE_APPS
logger = logging.getLogger(__name__)
@@ -99,30 +87,18 @@ def get_stdio_mcp(enabled_apps: list[str] | None = None) -> FastMCP:
return await client.capabilities()
# --- tool registration ---
available_apps: dict[str, Callable] = {
"notes": configure_notes_tools,
"tables": configure_tables_tools,
"webdav": configure_webdav_tools,
"sharing": configure_sharing_tools,
"calendar": configure_calendar_tools,
"collectives": configure_collectives_tools,
"contacts": configure_contacts_tools,
"cookbook": configure_cookbook_tools,
"deck": configure_deck_tools,
"news": configure_news_tools,
}
if enabled_apps is None:
enabled_apps = list(available_apps.keys())
enabled_apps = list(AVAILABLE_APPS.keys())
for app_name in enabled_apps:
if app_name in available_apps:
logger.info(f"Configuring {app_name} tools")
available_apps[app_name](mcp)
if app_name in AVAILABLE_APPS:
logger.info("Configuring %s tools", app_name)
AVAILABLE_APPS[app_name](mcp)
else:
logger.warning(
f"Unknown app: {app_name}. "
f"Available apps: {list(available_apps.keys())}"
"Unknown app: %s. Available apps: %s",
app_name,
list(AVAILABLE_APPS.keys()),
)
return mcp