From 783adeca6e39a4452c35e325cc978903a3d539b0 Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Thu, 30 Apr 2026 02:06:40 +0200 Subject: [PATCH] fix(vector-sync): wire document streams into OAuthAppContext The nc_get_vector_sync_status MCP tool was returning hardcoded status="unknown", indexed=0, pending=0 for all OAuth deployments because OAuthAppContext lacked the document_receive_stream field. The tool's getattr() lookup against the lifespan context returned None and triggered an early-return before the Qdrant count query. Add the four vector-sync fields to OAuthAppContext (matching AppContext) and populate them from the _vector_sync_state singleton at the lifespan yield site. Co-Authored-By: Claude Opus 4.7 (1M context) --- nextcloud_mcp_server/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nextcloud_mcp_server/app.py b/nextcloud_mcp_server/app.py index c5a39675..e0b1c87a 100644 --- a/nextcloud_mcp_server/app.py +++ b/nextcloud_mcp_server/app.py @@ -348,6 +348,10 @@ class OAuthAppContext: server_client_id: Optional[str] = ( None # MCP server's OAuth client ID (static or DCR) ) + document_send_stream: Optional[MemoryObjectSendStream] = None + document_receive_stream: Optional[MemoryObjectReceiveStream] = None + shutdown_event: Optional[anyio.Event] = None + scanner_wake_event: Optional[anyio.Event] = None class BasicAuthMiddleware: @@ -1180,6 +1184,10 @@ def get_app(transport: str = "streamable-http", enabled_apps: list[str] | None = oauth_client=oauth_client, oauth_provider=oauth_provider, server_client_id=client_id, + document_send_stream=_vector_sync_state.document_send_stream, + document_receive_stream=_vector_sync_state.document_receive_stream, + shutdown_event=_vector_sync_state.shutdown_event, + scanner_wake_event=_vector_sync_state.scanner_wake_event, ) finally: logger.info("Shutting down MCP server")