cloudscraper.js is a thin Node.js layer over the Python cloudscraper library
(the actual Cloudflare-bypass engine). So you need two runtimes:
| Requirement | Version | Notes |
|---|---|---|
| Node.js | ≥ 20 | The MCP server dynamically imports the ESM MCP SDK, which needs ≥ 22.12. |
| Python 3 | 3.8+ | With the cloudscraper package importable. |
Earlier versions (≤ 0.1.x) auto-installed Python on
postinstall— includingsudo apt/yum, Homebrew andcurl … | bash. That was removed in 0.2.0. Installing system packages is now an explicit, opt-in choice, which keeps the package safe in CI, Docker, serverless and locked-down environments. If thecloudscraperpackage is missing at runtime, the library fails fast with a clear message instead of trying to install anything.
npm install cloudscraper.jspip install cloudscraper
# On PEP 668 "externally-managed" environments (recent macOS/Debian):
pip install --break-system-packages cloudscraperindex.py and daemon.py automatically detect and use a .venv/ in the
project's working directory:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate.bat
pip install cloudscraperAn opt-in script that detects Python, creates a venv when the environment is
externally managed, and installs cloudscraper for you:
npm run install-deps
# or, to install only the Python library:
npm run install-pythonThere is also a programmatic installDependencies() method on the legacy
CloudScraper class — it is only run when you explicitly call it, never on
install:
const CloudScraper = require("cloudscraper.js").default;
const scraper = new CloudScraper();
await scraper.installDependencies(); // opt-in; may install Python + cloudscraperpython3 -c "import cloudscraper; print('ok', cloudscraper.__version__)"The repo ships a multi-stage Dockerfile that bundles Node, the
compiled SDK, Python 3 and cloudscraper (installed into an isolated venv — no
--break-system-packages, no system-python pollution). No host Python needed:
docker build -t cloudscraper-js .
docker run -i --rm cloudscraper-js # boots the MCP server on stdioPoint any MCP client (Claude Desktop, IDEs, …) at that docker run command, or
override the CMD to run the SDK / an example instead.
The Python library isn't importable by the interpreter the SDK spawns. Install
it (see step 2). If you use usePython3: false, make sure python (not just
python3) resolves to an interpreter that has cloudscraper.
Your Python is PEP 668 managed (recent macOS/Homebrew, Debian/Ubuntu). Use a
virtual environment (Option B) or add --break-system-packages (Option A).
Do not run pip with sudo — it pollutes system Python and is unnecessary.
Install Python 3 for your OS (https://www.python.org/downloads/, or your package
manager), ensure it's on PATH, then re-run step 2. On Windows, check
"Add Python to PATH" during installation.
The MCP server needs Node ≥ 22.12 (it dynamically imports the ESM MCP SDK).
Check with node --version.
- The SDK spawns
python3by default (pythonwhenusePython3: false). - Before importing
cloudscraper,index.py/daemon.pylook for a.venv/in the current working directory and add itssite-packagestosys.path. - So a project-local
.venv"just works" without manual activation, and a globally-installedcloudscraperworks too.