Inner Voice
Where Curiosity Finds a Voice
Show only posts from the date:2026/10/31
How I Built an OAuth2 Bridge on Cloudflare Workers for Gemini MCP Servers
Most modern AI assistants (like Google Gemini) support the Model Context Protocol (MCP), allowing them to pull live data from external tools. However, integrating cloud-hosted LLM panels with self-hosted ecosystem tools like ezBookkeeping presents a strict authentication mismatch: the client demands a rigorous OAuth 2.1 authorization code flow complete with Client IDs and secrets, while minimalist self-hosted servers rely purely on lightweight static bearer tokens. Rather than deploying a cumbersome identity provider suite, we can bridge this gap with a serverless Token-to-OAuth Proxy Bridge using Cloudflare Workers. By intercepting automatic OIDC discovery routes, issuing mock authorization codes, and swapping secure session tokens for real master bearer headers on the fly, edge computing allows us to securely connect cloud AI workflows to private local databases with zero server maintenance.