fix(mcp): coordinate OAuth token refresh and authorization polling

Prevent concurrent refresh-token rotation across instances, distinguish
expired-but-refreshable tokens from active authorization, and bind OAuth
popup polling to a per-attempt ID so stale tokens cannot satisfy new consent.
This commit is contained in:
wizardchen
2026-07-23 15:33:20 +08:00
committed by lyingbug
parent c74b0caa35
commit 8ae82573ab
31 changed files with 1418 additions and 109 deletions
@@ -0,0 +1,3 @@
ALTER TABLE mcp_oauth_tokens
DROP COLUMN IF EXISTS refresh_lease_until,
DROP COLUMN IF EXISTS refresh_lease_id;
@@ -0,0 +1,7 @@
DO $$ BEGIN RAISE NOTICE '[Migration 000074] Adding MCP OAuth refresh lease...'; END $$;
ALTER TABLE mcp_oauth_tokens
ADD COLUMN IF NOT EXISTS refresh_lease_id VARCHAR(36),
ADD COLUMN IF NOT EXISTS refresh_lease_until TIMESTAMP WITH TIME ZONE;
DO $$ BEGIN RAISE NOTICE '[Migration 000074] MCP OAuth refresh lease ready'; END $$;