Skip to content

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

Merged
mattzcarey merged 2 commits into
cloudflare:mainfrom
jhutchings1:feat/user-agent
Aug 25, 2026
Merged

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

Conversation

@jhutchings1

Copy link
Copy Markdown
Contributor

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
@mattzcarey
mattzcarey merged commit 75c4dbc into cloudflare:main Aug 25, 2026
2 checks passed
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.

2 participants