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 -17
View File
@@ -14,6 +14,7 @@ from nextcloud_mcp_server.migrations import (
upgrade_database,
)
from nextcloud_mcp_server.observability import get_uvicorn_logging_config
from nextcloud_mcp_server.server import AVAILABLE_APPS
from .app import get_app
@@ -36,29 +37,16 @@ from .app import get_app
@click.option(
"--transport",
"-t",
default="stdio",
default="streamable-http",
show_default=True,
type=click.Choice(["stdio", "streamable-http", "http"]),
type=click.Choice(["streamable-http", "http", "stdio"]),
help="MCP transport protocol",
)
@click.option(
"--enable-app",
"-e",
multiple=True,
type=click.Choice(
[
"notes",
"tables",
"webdav",
"calendar",
"contacts",
"cookbook",
"deck",
"news",
"collectives",
"sharing",
]
),
type=click.Choice(sorted(AVAILABLE_APPS.keys())),
help="Enable specific Nextcloud app APIs. Can be specified multiple times. If not specified, all apps are enabled.",
)
@click.option(
@@ -264,7 +252,10 @@ def run(
)
from .stdio import get_stdio_mcp # noqa: PLC0415
mcp = get_stdio_mcp(enabled_apps=enabled_apps)
try:
mcp = get_stdio_mcp(enabled_apps=enabled_apps)
except ValueError as e:
raise click.ClickException(str(e)) from e
mcp.run(transport="stdio")
return