| name | fetch-url |
| description | Use this when you need the raw HTTP response for non-HTML content or APIs. Examples: JSON, XML, RSS/Atom, CSV, plain text, files, or downloads. If the target is a human-readable web page (HTML) that should be converted to markdown, use fetch-webpage instead. |
Fetch URL
Fetch raw HTTP responses from URLs. Supports multiple URLs and custom headers.
Usage
node {baseDir}/scripts/fetch.mjs "https://api.example.com/data"
node {baseDir}/scripts/fetch.mjs '["https://api.example.com/data1", "https://api.example.com/data2"]'
node {baseDir}/scripts/fetch.mjs '["https://api.example.com/json", "https://api.example.com/text"]' '[{"accept":"application/json"}, {"accept":"text/plain"}]'
node {baseDir}/scripts/fetch.mjs "https://api.example.com/data" --timeout 60000
Examples
JSON API
node {baseDir}/scripts/fetch.mjs "https://api.github.com/repos/microsoft/vscode" '{"accept":"application/json","user-agent":"Mozilla/5.0"}'
XML
node {baseDir}/scripts/fetch.mjs "https://api.example.com/soap" '{"accept":"application/xml"}'
node {baseDir}/scripts/fetch.mjs "https://example.com/sitemap.xml"
RSS / Atom Feed
node {baseDir}/scripts/fetch.mjs "https://example.com/rss.xml" '{"accept":"application/rss+xml"}'
node {baseDir}/scripts/fetch.mjs "https://example.com/atom.xml" '{"accept":"application/atom+xml"}'
CSV / Plain Text
node {baseDir}/scripts/fetch.mjs "https://example.com/data.csv" '{"accept":"text/csv"}'
node {baseDir}/scripts/fetch.mjs "https://example.com/robots.txt" '{"accept":"text/plain"}'
Multiple Formats
node {baseDir}/scripts/fetch.mjs '["https://api.example.com/data.json", "https://api.example.com/data.xml"]' '[{"accept":"application/json"}, {"accept":"application/xml"}]'
Options
urls_json: JSON array of URLs or a single URL string
headers_json: Optional JSON array of headers objects (same length as urls)
--timeout <ms>: Request timeout in milliseconds (default: 30000)
Notes:
- Returns raw HTTP response body
- For multiple URLs, returns JSON array of results
- Node.js 18+ required (native fetch)