BOSSTORQUE / Internal Infrastructure Report

Cloudflare MCP Connector Replacement

May 8, 2026 — Replaced 3 fragile OAuth-based MCP connectors with a single token-based stdio server
Three Cloudflare MCP connectors were stuck in an OAuth refresh loop, repeatedly opening browser dialogs that couldn't complete. Root cause: mcp-remote's 1-hour OAuth token refresh path is fragile and breaks when Claude Desktop sleeps mid-refresh. Fixed by replacing all three with a single custom stdio MCP server that uses a long-lived API token instead. No more OAuth flows. Ever.
3
connectors retired
1
stdio server built
13
tools recovered
0
OAuth flows remain

What was broken

Three Cloudflare MCP connectors had been added to claude_desktop_config.json via the mcp-remote proxy:

All three connect via OAuth: mcp-remote spins up a localhost callback listener on a random port, opens the browser to dash.cloudflare.com for consent, then receives the redirect to complete auth. Tokens are 1-hour bearer tokens with an offline_access scope for silent refresh.

One by one, each connector started looping. Browser dialogs would open showing "There was an error fetching accounts. Please try again." with a fresh consent challenge each time. Clicking Authorize hit localhost:22749/oauth/callback which returned ERR_CONNECTION_REFUSED — the listener was already dead.

Root cause

Three separate failure modes feeding the same loop:

This left every retry hitting a dead localhost port, generating fresh consent challenges that auto-expired, with the browser auto-refreshing tabs from earlier failed attempts. The loop was self-sustaining as long as the connector entry remained in config.

What we tried first (and why it didn't last)

Initial fix: clear stale state, run mcp-remote manually in terminal so the OAuth flow completes without Cowork interfering. Tokens get cached, Cowork picks them up on next spawn. Worked for ~22 hours, then refresh failed overnight, restarting the loop.

The pattern was clear: any fix relying on the OAuth refresh path will break on the next refresh failure. We needed to bypass OAuth entirely.

The durable fix

Built a custom stdio MCP server in Node (zero dependencies) at ~/.claude/scripts/cloudflare-graphql-mcp/index.js. It speaks the MCP JSON-RPC protocol over stdin/stdout and authenticates to api.cloudflare.com using a long-lived API token.

Key design properties:

The Cloudflare API token has minimal-scope permissions: Account Analytics:Read, Account Settings:Read, Workers Scripts:Read, Workers Tail:Read, Workers Builds Configuration:Read, Zone:Read, Zone Analytics:Read.

Tools recovered vs. retired

CapabilityOld connectorNew toolStatus
Run GraphQL Analytics queriescloudflare-graphqlgraphql_queryWorking
List zones / get zone detailscloudflare-graphqlzones_list, zone_detailsWorking
List accountscloudflare-graphqlaccounts_listWorking
Introspect GraphQL schemacloudflare-graphqlgraphql_schema_introspectWorking
List Workers in accountcloudflare-observabilityworkers_list109 workers, sorted by recency
Get Worker source codecloudflare-observabilityworker_get_codeES module multipart parsed
Get Worker bindings/settingscloudflare-observabilityworker_metadataWorking
Real-time Worker log tailcloudflare-observabilityworker_tailWebSocket-based, 1–60 sec windows
Search Cloudflare docscloudflare-observabilitycloudflare_docs_searchUses cached llms-full.txt
Workers Builds CI listingcloudflare-workers-buildsworkers_builds_listEndpoint not in public REST API — returns informative empty
About Workers Builds: The Cloudflare-hosted MCP at builds.mcp.cloudflare.com uses an internal API path that isn't published in the public REST API surface. Since you deploy via wrangler deploy from CLI rather than the Workers Builds CI feature, no builds exist in the CI system anyway. The tools are vestigial — if you ever connect a worker to git auto-deploys, we'll revisit the endpoint.

Final state

MCP servers in claude_desktop_config.json:

OAuth state cleared from ~/.mcp-auth/: all three Cloudflare endpoint hashes (graphql, observability, builds) have lock files, code verifiers, and tokens removed. No mcp-remote processes for Cloudflare endpoints will respawn.

Cached on disk: ~/.claude/cache/cf-docs-llms-full.txt (49MB Cloudflare developer documentation archive, refreshed every 7 days for the docs search tool).

What we deferred

If this breaks

Token revoked or rotated: generate a new one at dash.cloudflare.com with the same scopes, update the env block in ~/Library/Application Support/Claude/claude_desktop_config.json under cloudflare-graphql, restart Cowork.
Server crash or syntax error: backups of claude_desktop_config.json sit next to the original with .bak.<timestamp> suffix. The MCP server itself lives at ~/.claude/scripts/cloudflare-graphql-mcp/index.js and can be re-copied from the workspace folder if needed.

Files of record