obfus.link

cURL to Fetch converts curl commands from API docs or terminal history into production fetch, axios, got, ky, or node-fetch code. It extracts secrets to process.env references, generates exponential or linear retry wrappers, and adds inline comments explaining each translated option for unfamiliar libraries.

Tier 2converters✓ TDD Verified

cURL to Fetch

Convert curl commands to fetch, axios, got, ky, or node-fetch

How to use

  1. Paste your curl commandDrop in the full curl command, including all flags and headers.
  2. Choose a target libraryfetch (browser/Node 18+), axios, node-fetch, got, or ky.
  3. Configure optionsToggle typescript, extractEnvVars, annotate, and configure retryConfig if needed.
  4. Run the converterClick Run or press Ctrl+Enter to convert. Output is generated instantly.
  5. Copy and integrateCopy the code, imports, and env var manifest into your project.
Read technical article

MCP / API

Call curl_to_fetch directly from any MCP-compatible agent:

// MCP TypeScript SDK
const result = await client.callTool({
  name: "curl_to_fetch",
  arguments: {
    "curl": "...",
    "target": "fetch"
  }
});

// curl
curl -X POST https://obfus.link/mcp \
  -H "Authorization: Bearer <SPT>" \
  -H "Content-Type: application/json" \
  -d '{"method":"tools/call","params":{"name":"curl_to_fetch","arguments":{"curl":"...","target":"fetch"}}}'

Related tools

JSON to Zod
Generate Zod schemas with JSDoc and branded types from any JSON
JWT Hardener
Audit and harden JWT tokens with security scoring and diff output
HMAC Generator
Generate and verify HMAC signatures with Stripe, GitHub, Twilio, Shopify, Slack templates

FAQ

What does the env var extraction do?

It detects Authorization header values, API keys in query params, and bearer tokens, replacing them with process.env.VARIABLE_NAME references. The original values are returned in the envVars manifest with the original masked, so you know exactly what was extracted.

How does the retry wrapper work?

When retryConfig is provided, the generated code is wrapped in an async retry loop with the specified strategy (exponential or linear) and status codes (e.g. [429, 502, 503]). The output is production-ready — no additional scaffolding required.

Which curl flags are supported?

Standard flags: -X (method), -H (headers), -d / --data / --data-raw (body), -b (cookie), --user (basic auth), -F (multipart), -L (follow redirects), --compressed. Unsupported flags are returned in the warnings array so you can address them manually.

Can I use this tool via the MCP API?

Yes. The tool is registered on the obfus.link MCP server at https://obfus.link/mcp. Call it from any MCP-compatible agent with a Shared Payment Token. The MCP tool name matches the snake_case slug shown in the integration snippet.