mcp-server-cloudflare
cloudflare/mcp-server-cloudflare
- Type
- MCP server
- Scanned
- Oct 29, 2026
- Version
- a21972e21928
- Files read
- 442
This project provides a collection of remote servers that let AI assistants inspect and manage Cloudflare services, including Workers, databases, headless browsers, and sandboxed containers. The biggest risk is that an AI processing untrusted content could be tricked into modifying or deleting your Cloudflare resources, reading sensitive account data, or reaching unintended API endpoints due to unencoded tool inputs.
What it can reach
- Network
- Connects to Cloudflare REST and GraphQL APIs, OAuth endpoints, remote MCP servers (*.mcp.cloudflare.com), and arbitrary external websites via the Browser Rendering service.
- Secrets
- Uses Cloudflare OAuth tokens, refresh tokens, and API tokens to authenticate requests and manage resources in your Cloudflare account.
- Shell commands
- Executes arbitrary shell commands inside an isolated, remote Cloudflare sandbox container.
- Browser
- Controls remote headless browser sessions to navigate to arbitrary URLs, crawl pages, render PDFs, and take screenshots.
- Files
- Reads, writes, and deletes files inside the remote Cloudflare sandbox container, and writes temporary configuration files under .wrangler/vitest during local testing.
Findings
-
MediumURL path traversal in Browser Rendering session and crawl tools
apps/browser-rendering/src/tools/browser.tools.ts:623
The
get_crawl_result,cancel_crawl, andkill_browser_sessiontools acceptjob_idandsession_idas unconstrained strings (z.string()) and interpolate them directly into the Cloudflare API URL path withoutencodeURIComponentor UUID validation. If an untrusted webpage induces the agent via prompt injection to pass relative path segments (../../...), the server will issue authenticatedGETorDELETErequests to arbitrary Cloudflare API endpoints permitted by the user's token.Fix: Validate
job_idandsession_idas UUIDs (e.g.,z.string().uuid()) and encode them withencodeURIComponent()before constructing the request path. -
MediumURL path traversal in AutoRAG search tools
apps/autorag/src/tools/autorag.tools.ts:76
The
searchandai_searchtools acceptrag_idas an arbitrary string (z.string()) and interpolate it directly into the API URL path passed toclient.post(). A malicious prompt can supply../sequences inrag_idto send authenticatedPOSTrequests to other Cloudflare API endpoints.Fix: Validate
rag_idagainst an allowed character pattern (such asz.string().regex(/^[a-zA-Z0-9_-]+$/)) and wrap it inencodeURIComponent()when building the URL path. -
MediumUnencoded path parameters in CASB integration and asset tools
apps/cloudflare-one-casb/src/api/cf1-integration.api.ts:44
integrationIdParamandassetIdParamare defined as plainz.string()schemas inintegrations.tools.ts(despite their descriptions stating they are UUIDs) and are concatenated directly into the API endpoint path withoutencodeURIComponent(). An attacker who controls tool arguments via prompt injection can use../or query parameters to redirect authenticatedGETrequests to other account API endpoints.Fix: Enforce
.uuid()onintegrationIdParam,assetIdParam, andassetCategoryIdParam, and useencodeURIComponent()when constructing endpoint paths. -
MediumUnencoded path parameters in Workers Builds API calls
apps/workers-builds/src/api/workers-builds.api.ts:27
workerIdandbuildUUIDare validated only as non-empty strings (z.string().min(1)) and interpolated directly into API URL paths inlistBuilds,getBuild, andgetBuildLogs. Supplying path traversal segments (../) or query characters (?,&) allows a caller to alter the target Cloudflare API endpoint or query parameters.Fix: Validate
buildUUIDwithz.string().uuid()and encode bothworkerIdandbuildUUIDwithencodeURIComponent(). -
MediumUnencoded scriptName in Workers service lookup
packages/mcp-common/src/shared-tools/workers.api.ts:40
handleGetWorkersServiceinterpolatesscriptNamedirectly into/workers/services/${scriptName}without URL-encoding or character validation. A craftedscriptNamecontaining../or?can traverse to other account-scoped Cloudflare API endpoints.Fix: Encode
scriptNameusingencodeURIComponent(scriptName)and validate it against valid Worker script name rules. -
MediumUnvalidated URL scheme in OAuth consent dialog links
packages/mcp-common/src/workers-oauth-utils.ts:281
renderApprovalDialogrenders the client-suppliedclientUriinside an<a href="...">tag after passing it throughsanitizeHtml(). BecausesanitizeHtml()only escapes HTML characters (&,<,>,",') and does not check the URL scheme, a dynamically registered OAuth client supplying ajavascript:URI as itsclient_uricould execute JavaScript in the user's browser if clicked.Fix: Validate that
consent.clientUriandserver.logoparse as valid URLs with anhttps:orhttp:protocol before rendering them inhreforsrcattributes. -
LowGraphQL query injection in graphql_type_details
apps/graphql/src/tools/graphql.tools.ts:146
fetchTypeDetailsinterpolates thetypeNametool argument directly into a GraphQL query string (__type(name: "${typeName}")) without escaping quotes or using GraphQL variables. A craftedtypeNamecan break out of the string literal and inject arbitrary GraphQL fields into the request.Fix: Pass
typeNameas a GraphQL variable (query TypeDetails($name: String!) { __type(name: $name) { ... } }) instead of interpolating it into the query string. -
LowInconsistent truthiness check on DEV_DISABLE_OAUTH string variable
packages/mcp-common/src/cloudflare-api.ts:11
While
devApiTokenModeEnabledinapi-token-mode.tschecksenv.DEV_DISABLE_OAUTH === 'true',getCloudflareClientandfetchCloudflareApicheckif (env.DEV_DISABLE_OAUTH). Because environment variables in Wrangler are strings, settingDEV_DISABLE_OAUTH="false"evaluates as truthy and causes API requests to ignore the user's OAuth token in favor ofDEV_CLOUDFLARE_API_TOKEN.Fix: Check
env.DEV_DISABLE_OAUTH === 'true'consistently acrosscloudflare-api.tsandwarp_diag_reader.ts.