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) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-04-30 02:06:40 +02:00
co-authored by Claude Opus 4.7
parent 404b551ec5
commit 783adeca6e
+8
View File
@@ -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")