Remote MCP server for Cloudflare R2, deployable on Cloudflare Workers.
This MCP server exposes Cloudflare R2 object storage operations (list, head, get, put, delete, copy, move, rename) via a remote MCP endpoint, deployab...
1// File not provided, but referenced in config.ts line 101: import { normalizeRootPrefix } from "./r2/keys";
2// The rootPrefix is only used to prefix keys, but tools accept arbitrary keys without validation that they fall under rootPrefix.// Exploitable if MCP is exposed to untrusted prompts (network_exposed) or by a compromised LLM (local_only).
1// File not provided, but the server registers tools: object delete, object copy, object move, object rename.
2// These allow permanent deletion and modification of objects.// Exploitable if MCP is exposed to untrusted prompts (network_exposed) or by a compromised LLM (local_only).
1// File not provided, but the tools accept user-supplied keys without sanitization.
2// Example from object get: key is passed directly to env.R2_BUCKET.get(key).// Exploitable if MCP is exposed to untrusted prompts (network_exposed) or by a compromised LLM (local_only).
40export function createAccountApi(config: ServerConfig): AccountApi {
41 const { accountId, apiToken } = requireAccountConfig(config);
42
43 return {
44 async get(path, query) {
45 const url = new URL(`${CLOUDFLARE_API_BASE}/accounts/${encodePathPart(accountId)}${path}`);
46 appendQuery(url, query);
47
48 const response = await fetch(url, {
49 headers: {
50 Accept: "application/json",
51 Authorization: `Bearer ${apiToken}`,
52 },
53 method: "GET",
54 });// Exploitable if MCP is exposed to untrusted prompts (network_exposed) or by a compromised LLM (local_only).
96 presignAccessKeyId: clean(env.R2_ACCESS_KEY_ID),
97 presignEndpoint: clean(env.R2_S3_ENDPOINT) ?? defaultR2Endpoint(accountId),
98 presignRegion: clean(env.R2_S3_REGION) ?? "auto",
99 presignSecretAccessKey: clean(env.R2_SECRET_ACCESS_KEY),// Exploitable if MCP is exposed to untrusted prompts (network_exposed) or by a compromised LLM (local_only).