How a Cloudflare KV race condition randomly broke Katto's MCP OAuth flow
Katto, an AI video clipping tool, suffered intermittent OAuth failures when users connected it to Claude via its hosted MCP server. The root cause was a race condition in Cloudflare Workers KV: after a user approved access, the deposit request wrote an API key to one edge location, but the browser's immediate callback request could land on a different edge node before the key had propagated, returning null and killing the session. Initial workarounds — adding retry logic and a one-second refresh delay — reduced failures but could not eliminate them entirely. The permanent fix removed the cross-request read altogether, having the deposit endpoint complete the OAuth grant in memory and return the final redirect URL directly. The old callback path was retained as a backward-compatible fallback, fully resolving the issue without breaking existing integrations.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in