fix: address PR review — stale mcp-oauth refs, Playwright TimeoutError catch

- Replace 4 stale mcp-oauth references in CLAUDE.md with mcp-login-flow
- Import and catch playwright.async_api.TimeoutError in consent retry loop
  (Playwright's TimeoutError doesn't inherit from Python's built-in)
- Replace unreachable `return True` with explicit RuntimeError raise
- Add clarifying comment for hardcoded login-flow port default

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-04-01 16:32:17 +02:00
co-authored by Claude Opus 4.6
parent 86f350ab49
commit b4c3b48e61
2 changed files with 8 additions and 7 deletions
+4 -3
View File
@@ -21,6 +21,7 @@ from mcp import ClientSession
from mcp.client.session import RequestContext
from mcp.client.streamable_http import streamablehttp_client
from mcp.types import ElicitRequestParams, ElicitResult, ErrorData
from playwright.async_api import TimeoutError as PlaywrightTimeoutError
from nextcloud_mcp_server.client import NextcloudClient
@@ -2022,7 +2023,7 @@ async def _handle_oauth_consent_screen(page, username: str = "user"):
)
logger.info(f" Consent granted for {username}")
return True
except TimeoutError:
except (TimeoutError, PlaywrightTimeoutError):
if attempt == 2:
screenshot_path = f"/tmp/consent_click_failed_{username}.png"
await page.screenshot(path=screenshot_path)
@@ -2035,7 +2036,7 @@ async def _handle_oauth_consent_screen(page, username: str = "user"):
f" Consent click attempt {attempt + 1} didn't navigate, retrying..."
)
return True # unreachable but satisfies type checker
raise RuntimeError("consent click retry loop exited unexpectedly")
else:
logger.error(f" Allow button not found for {username}")
return False
@@ -2051,7 +2052,7 @@ async def _get_oauth_token_with_scopes(
oauth_callback_server,
scopes: str,
resource: str | None = None,
mcp_server_base_url: str = "http://localhost:8004",
mcp_server_base_url: str = "http://localhost:8004", # login-flow container port
) -> str:
"""
Helper function to obtain OAuth token with specific scopes.