Skip to content

feat: set User-Agent: cloudflare-mcp on all outbound Cloudflare API requests - #203

Open
jhutchings1 wants to merge 2 commits into
cloudflare:mainfrom
jhutchings1:feat/user-agent
Open

feat: set User-Agent: cloudflare-mcp on all outbound Cloudflare API requests#203
jhutchings1 wants to merge 2 commits into
cloudflare:mainfrom
jhutchings1:feat/user-agent

Conversation

@jhutchings1

Copy link
Copy Markdown

Adds User-Agent: cloudflare-mcp to all outbound requests the MCP server makes to the Cloudflare API, making server-originated traffic identifiable in Cloudflare's own analytics and logs.

Without this, requests from the MCP server are indistinguishable from any other bearer token usage at the HTTP layer.

  • USER_AGENT constant defined in src/constants.ts alongside SERVER_INFO
  • fetchWithRetry injects the header on every call — handles both string-URL and Request-object inputs, always overriding any caller-supplied value
  • OAuth token exchange/refresh calls (cloudflare-auth.ts) are intentionally excluded
  • Tests updated to assert User-Agent is present via Headers.get() (fixing stale bracket-access assertions in the process)

@jhutchings1
jhutchings1 marked this pull request as ready for review August 24, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant