MCP middleware was discarding tenant_id and api_key_id after authentication. The authenticate_mcp() call mutated a RequestContext with these fields, but tools later created a fresh RequestContext without them. This caused UsageMeteringValidator to see tenant_id="unknown" and skip billing entirely. Propagate tenant_id and api_key_id via ContextVars (same pattern as bank_id and api_key) so the RequestContext passed to the memory engine has the full auth context needed for usage tracking. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| http.py | ||
| mcp.py | ||