mcp-proxy
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-proxyfetch https://api.github.com/repos/cloudflare/workers-sdk and show me the status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-proxy
A small curl-over-MCP gateway for AI agents, designed for Cloudflare Workers.
The Worker exposes one MCP tool, curl, so an agent can call public Internet APIs with normal HTTP semantics. The outbound request is intentionally transparent: caller-supplied methods, headers, credentials, cookies, query strings, and bodies are forwarded without application-level filtering or auth/write policy.
It also supports server-managed credential rules. A rule matches a destination domain/path and injects configured headers immediately before the outbound request. This lets agents call authenticated APIs without putting API keys/tokens in the MCP tool arguments.
There is deliberately no OAuth flow for the MCP server itself. Authentication is a high-entropy random URL path:
https://mcp-proxy.<account>.workers.dev/<random-secret><random-secret> replaces the usual /mcp path. Requests to any other path return 404 rather than 401, so MCP clients do not start OAuth discovery.
The human admin UI is separate and uses a normal password login at /admin.
Tool: curl
The tool is intentionally read/write and generic.
Inputs:
url— publichttp://orhttps://URL, including query stringmethod— arbitrary HTTP method string; defaultGETheaders— forwarded without MCP-side filtering/rewrite/credential strippingbody— raw UTF-8 body, forwarded exactly as suppliedbody_base64— convenience binary body whenbodyis absentjson— convenience JSON body whenbody/body_base64are absentform— convenience URL-encoded body when the fields above are absenttimeout_ms— MCP-side overall timeout; default 30s,0disables itmax_bytes— maximum response bytes returned to the agent; default 2 MiBfollow_redirects— defaulttruemax_redirects— default10
If multiple body forms are supplied, precedence is:
body > body_base64 > json > formCloudflare Workers Fetch still has its own platform/runtime rules. If a particular method/header/body combination is unsupported by the runtime, the runtime error is returned; the MCP server does not add an extra policy layer.
Related MCP server: http-mcp
Credential rules
Credential rules are stored in the CREDENTIALS Workers KV binding and managed through the built-in admin UI.
Each rule contains:
domain— exact hostname such asportal.example.com, or one leading wildcard such as*.example.compath prefix— optional path scope such as/api;/matches the whole domainheaders— any header/value pairs, for exampleAuthorization,X-Api-Key,Cookie, or vendor-specific headersmodeoverride— configured value replaces a same-name caller headerif_missing— configured value is only added when the request does not already contain the header
priority— lower-priority/general rules apply first; higher-priority/more-specific rules can override themHTTPS only— enabled by defaultenabled— temporarily disable a rule without deleting it
Example:
Domain: portal-dev1az5avn.vozer.org
Path prefix: /api
Mode: override
HTTPS only: yes
Headers:
Authorization: Bearer <NC_API_KEY>The agent can then call:
{
"url": "https://portal-dev1az5avn.vozer.org/api/mcp",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{}}"
}The Worker adds the matching credential headers server-side before fetch().
Rules are evaluated per outbound hop. Injected credentials are never copied into the caller header set, so a credential for one domain does not accidentally follow a redirect to another domain. If the redirect target has its own matching rule, that rule is applied instead. Caller-supplied headers retain the normal transparent redirect behavior.
Admin UI
Set an admin password as a Worker runtime secret:
printf '%s' 'use-a-long-random-password-here' | npx wrangler secret put ADMIN_PASSWORD
npm run deployThen open:
https://mcp-proxy.example.workers.dev/adminAfter a successful login the Worker sets an HttpOnly; Secure; SameSite=Strict session cookie scoped to /admin. The password itself is never placed in the cookie or URL. Changing ADMIN_PASSWORD invalidates existing admin sessions.
The UI supports create/edit/delete, header rows, wildcard domains, path prefixes, priority/mode, enable/disable, and a URL matcher test.
ADMIN_PASSWORD is required at deploy time. ADMIN_PATH is no longer used for the admin UI. The MCP endpoint still uses MCP_PATH because MCP clients may otherwise start OAuth discovery.
The credential rules are stored as application data in Workers KV. The MCP tool never returns stored header values and logs never include credential values.
Security model
The gateway keeps only the network safety boundary needed to avoid turning the Worker into an SSRF/private-network proxy:
only
http://andhttps://URLs are accepteddirect IP-literal targets are rejected
localhost,*.localhost,*.local,*.internal, and*.home.arpaare rejectedrequests back to the MCP Worker's own hostname are rejected
every redirect target is revalidated before it is fetched
Cloudflare
global_fetch_strictly_publicroutes globalfetch()as public Internet trafficdo not attach a Workers VPC/private-network binding unless private-network access is explicitly intended
Everything else is caller-controlled. In particular the MCP server does not strip Host, auth headers, cookies, forwarding headers, cf-* headers, or custom application headers before calling Workers Fetch. The Workers runtime may still normalize, reject, or override transport-controlled headers.
Managed credential rules are separate from caller headers. They are applied immediately before each outbound fetch and recalculated after every redirect.
Troubleshooting / logs
Structured JSON logs are emitted for:
curl.startcurl.credentials_appliedcurl.redirectcurl.completecurl.errormcp.auth_rejectedmcp.origin_rejectedmcp.misconfigured
Logs include request_id, Cloudflare Ray ID when available, method, target host/path, status, timings, byte counts, redirect count, query parameter names, header names, and matched credential rule IDs/names.
Logs do not include request/response bodies, header values, credential values, MCP secret paths, admin passwords, or query-string values.
Tail live logs:
npx wrangler tailThen correlate a failed MCP response with its request_id.
Deploy
npm install
MCP_PATH="$(openssl rand -hex 32)"
printf '%s' "$MCP_PATH" | npx wrangler secret put MCP_PATH
ADMIN_PASSWORD="$(openssl rand -base64 32)"
printf '%s' "$ADMIN_PASSWORD" | npx wrangler secret put ADMIN_PASSWORD
npm run deploy
echo "MCP path: /$MCP_PATH"
echo "Admin UI: /admin"wrangler.jsonc declares a CREDENTIALS KV binding without an account-specific namespace ID. Modern Wrangler automatically provisions and links the KV namespace on deploy; when deploying through a dashboard/Git integration, the generated resource ID remains visible in the Cloudflare dashboard rather than being written back to the repository.
Configure the agent's Streamable HTTP MCP URL with the exact deployed Worker URL plus the MCP secret path:
https://mcp-proxy.example.workers.dev/7f9a...64-random-hex-chars...Do not append /mcp.
Development
npm install
npm run check
npm run devFor local development, create .dev.vars:
MCP_PATH=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
ADMIN_PASSWORD=change-me-to-a-strong-passwordThis server cannot be deployed
Maintenance
Related MCP Connectors
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.
MCP tools for AI agents: render URLs to image/PDF, check link health, convert HTML/CSV/JSON.
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables LLMs to make HTTP requests using structured cURL commands with support for multiple authentication methods, custom headers, and comprehensive request/response control.273MIT
- AlicenseAqualityDmaintenanceEnables LLMs to make HTTP requests with OAuth2, session cookies, retry logic, and cURL command generation, while providing security features like SSRF protection and TLS enforcement.1MIT
- AlicenseCqualityBmaintenanceMCP server for safely reading public URLs for AI agents, providing tools to fetch, extract, cache, and inspect web content as evidence.15MIT
- FlicenseNot gradedqualityBmaintenanceEnables HTTP requests and web data extraction via natural language, acting as an AI-era curl.-