ACS (All-Crawl-System)
by ratneshdagli
README.md
<div align="center">
# ACS · All-Crawl-System
**One local service that gets the web for your AI agent: search, crawl, research, extract, download and transcribe.
When one method is blocked, it moves up to the next.**





</div>
---
## Why
AI agents fail on the real web. Pages are drawn by JavaScript, sit behind bot walls ("Just a moment..."), need a login,
or are YouTube videos instead of text. An agent ends up with a 403, an empty page or a captcha.
ACS handles that in one call. You ask for a page and it starts with the fastest, cheapest method. If the result looks
blocked or empty, it moves to a stealthier one, up to your own Chrome browser with your logins. The agent gets clean
text, markdown, JSON, a screenshot or a file, plus an error that says what went wrong and what to try next.
```mermaid
flowchart LR
A[Agent asks for a URL] --> B[curl_cffi<br/>browser fingerprint]
B -->|blocked / empty| C[Playwright · Patchright<br/>headless browsers]
C -->|blocked| D[Scrapling · Crawl4AI<br/>stealth browsers]
D -->|blocked| E[Camoufox<br/>anti-detect Firefox]
E -->|blocked| F[Firecrawl]
F -->|blocked| G[Your real Chrome<br/>via the ACS extension]
B & C & D & E & F & G -->|real content| H[text · markdown · JSON · screenshot · file]
```
## What it can do
| MCP tool | REST | What you get |
|---|---|---|
| `crawl` | `POST /crawl` | One page as text, markdown, HTML, screenshot, metrics or links. YouTube links return the transcript |
| `crawl_batch` | `POST /crawl/batch` | Many URLs in parallel, within a size budget that fits an agent's context |
| `search` | `POST /search` | Web search: SearXNG, falling back to DuckDuckGo, then Bing |
| `research` | `POST /research` | Search, then read the top results in parallel. `mode="answer"` writes a short answer from those pages only, with [1] [2] citations |
| `extract` | `POST /extract` | Structured JSON from a page, described in plain words ("all product names and prices") |
| `download` | `POST /download` | A file, a video or MP3 from about 1,800 sites (yt-dlp), or a full transcript |
| `screenshot` | `POST /crawl` (`task=screenshot`) | A PNG of the page, desktop or mobile |
| `page_metrics` | `POST /crawl` (`task=metrics`) | SEO and performance data: titles, headings, images, structured data, page weight, request count |
| `discover_endpoints` | `POST /crawl` (`task=endpoints`) | Every page URL of a site, plus the hidden JSON/API calls its pages make, with sample fields |
| `social` | – | Read posts from Reddit, X, YouTube and others, using your logged-in browser |
| `run_agent` | `POST /agent` | A browsing agent that clicks, types and scrolls to finish a task on a site |
| `ask_google` | `POST /ext/ask_google` | Asks Google AI Mode in your own Chrome and returns its answer |
| `clear_cookies` | `DELETE /cookies/{domain}` | Forget a stale saved login for a site |
| `health` | `GET /health` | Which layers work on this machine, what is missing and the exact command to fix it |
Also included: a web dashboard (`/app/`), async jobs with live progress (`/crawl/async`, `/jobs/{id}`), whole-site crawls
(`/crawl/site`), scheduled re-crawls (`/schedule`), a response cache, cookie reuse per site, detailed logs, and a second
machine as an extra layer (`force_layer="remote"`).
**YouTube transcripts keep working when YouTube rate-limits the caption files.** ACS switches to the transcript panel
in your Chrome and reads it from there.
## Quick start
You need **Python 3.11+** and **Git**. Chrome is optional; it adds the last and strongest layer.
```bash
git clone https://github.com/ratneshdagli/All-Crawl-System.git
cd All-Crawl-System
```
**Windows**
```powershell
powershell -ExecutionPolicy Bypass -File setup.ps1
.venv\Scripts\python.exe start.py
```
**macOS / Linux**
```bash
bash setup.sh
.venv/bin/python start.py
```
Then open **http://127.0.0.1:8900/app/**. The setup script creates `.venv`, installs everything, downloads the browsers,
creates `.env` and prints which layers are ready. It is safe to run again.
<details>
<summary><b>Docker instead</b> (ACS + SearXNG + self-hosted Firecrawl in one command)</summary>
```bash
cp .env.example .env # optional: add keys
docker compose up -d --build # first build takes a while (browsers)
curl http://127.0.0.1:8900/health
```
ACS listens on `127.0.0.1:8900`, SearXNG on `:8080` and Firecrawl on `:3002`. The Chrome-extension layer is not
available inside Docker, because it needs a Chrome on the same machine.
</details>
<details>
<summary><b>Manual install</b></summary>
```bash
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python -m acs.install # browsers, Camoufox, .env, layer check (--docker also starts SearXNG)
python start.py # or: python -m uvicorn acs.server:app --port 8900
```
</details>
## Connect your AI agent
ACS serves MCP at **`http://127.0.0.1:8900/mcp`** (streamable HTTP). Keep `start.py` running. Every agent session then
shares one ACS: one cache, one browser limit, one set of saved logins.
**Claude Code**
```bash
claude mcp add --transport http -s user acs http://127.0.0.1:8900/mcp
```
Opening this folder in Claude Code needs no command: the bundled `.mcp.json` already points there.
**Cursor, Windsurf, Claude Desktop and other MCP clients**
```json
{ "mcpServers": { "acs": { "type": "http", "url": "http://127.0.0.1:8900/mcp" } } }
```
**Codex**, or any client that only supports stdio, can run ACS as its own process instead:
```toml
[mcp_servers.acs]
command = "/path/to/All-Crawl-System/.venv/bin/python" # Windows: ...\.venv\Scripts\python.exe
args = ["-m", "acs.mcp_server"]
env = { PYTHONPATH = "/path/to/All-Crawl-System" }
```
**Plain HTTP**
```bash
curl -s -X POST http://127.0.0.1:8900/crawl -H "Content-Type: application/json" \
-d '{"url": "https://example.com", "task": "markdown"}'
curl -s -X POST http://127.0.0.1:8900/research -H "Content-Type: application/json" \
-d '{"query": "what is camoufox", "mode": "answer"}'
```
## Use your own Chrome (optional, strongest layer)
1. Open `chrome://extensions` and turn on **Developer mode**.
2. Click **Load unpacked** and pick the `extension/` folder.
ACS can then open pages in a background tab of your real Chrome, with your logins and a real fingerprint. It can also
hand your cookies for one site to a download (for example a members-only video). The extension only talks to
`127.0.0.1` and authenticates with a secret in `extension/acs_token.js`, which setup creates. Never share that file.
ACS uses at most 2 tabs at a time and closes them when done.
## Settings
Everything is optional and lives in `.env` (see [`.env.example`](.env.example)). Without any key, ACS still crawls,
searches, downloads and gets transcripts.
| Setting | What it turns on |
|---|---|
| `GROQ_API_KEY`, `GEMINI_API_KEY` | AI features: cited answers, `extract`, `run_agent`, the Gemini vision layer. Both have free tiers ([Groq](https://console.groq.com), [Google AI Studio](https://aistudio.google.com)) |
| `ANTHROPIC_API_KEY` | The Claude vision layer (reads a screenshot when the HTML is useless) |
| `FIRECRAWL_URL` / `FIRECRAWL_CLOUD_KEY` | A self-hosted Firecrawl, or hosted Firecrawl as a last resort for the hardest bot walls (uses credits) |
| `SEARXNG_URL` | Your SearXNG for search (default `http://127.0.0.1:8080`) |
| `CAMOUFOX_URL` | A Camoufox server on another machine (otherwise Camoufox runs locally) |
| `ACS_WORKER_URL` | A second machine running ACS, used as the `remote` layer |
| `ACS_MAX_BROWSERS`, `ACS_MAX_MEMORY_PCT` | How hard ACS may push this machine (defaults: 2 browsers, 96 % RAM) |
**It will not freeze your computer.** Every ACS process on the machine shares one limit: at most 2 browsers at once,
2 tabs in your Chrome, and no new browser once RAM is nearly full. Extra requests wait their turn. Work that times out
is killed together with all its child processes. `GET /health` shows the limits and the current free memory.
## Security
- The REST API and MCP endpoint bind to **127.0.0.1** and have no login. Do not expose port 8900 to a network.
- Every fetch, and every redirect hop, is checked against private and local addresses. A page cannot make ACS
read your router, your other services or cloud metadata.
- `python -m acs.mcp_http` is a separate internet-facing variant. It uses a secret URL path and fewer layers, and
blocks private addresses, downloads to disk and your Chrome. Put it behind a tunnel (for example Tailscale Funnel or
Cloudflare Tunnel) to use ACS from claude.ai.
- Secrets (`.env`, `.mcp_secret`, `extension/acs_token.js`), cookies, downloads and logs live in ignored files and
folders. They are never committed or copied into the Docker image.
Use ACS on content you are allowed to access, and respect each site's terms. ACS does not solve CAPTCHAs: when a page
demands one, it returns that page and says so.
## How it is built
```
acs/
server.py FastAPI: REST, dashboard (/app/), MCP at /mcp, Chrome-extension bridge
mcp_server.py the 14 MCP tools (also runs stand-alone over stdio)
mcp_http.py internet-facing MCP variant (secret path, restricted)
router.py picks the layer chain, detects blocks and empty pages, escalates, caches
layers/ one file per fetch method: curl_cffi, httpx, playwright, patchright, scrapling,
crawl4ai, camoufox, webcmd, firecrawl, vision, gemini_vision, cdp, chrome, remote, ...
research.py search with fallbacks, parallel reading, cited answers
download.py yt-dlp downloads and transcripts, with the Chrome transcript-panel fallback
agent.py the multi-step browsing agent
utils/ block detection, machine limits, network guard, cookie sessions, metrics, logs
extension/ Chrome extension (Manifest V3) that lets ACS drive your real Chrome
tests/ pytest suite
docker-compose.yml ACS + SearXNG + Firecrawl stack
```
## Troubleshooting
| Symptom | Fix |
|---|---|
| A layer shows `--` in setup or `/health` | `/health` → `missing` prints the exact fix. Re-run `python -m acs.install` after fixing |
| `search` says SearXNG is unreachable | Fine: it falls back to DuckDuckGo and Bing. For SearXNG run `python -m acs.install --docker` |
| An answer says *"Busy: this PC is out of free RAM"* | Close something heavy and call again, or lower `ACS_MAX_BROWSERS` |
| `chrome` layer unavailable | Load the extension (see above) and keep Chrome open |
| YouTube transcript slow (60–90 s) | YouTube is rate-limiting caption files. ACS is reading the transcript panel in your Chrome instead |
| The MCP client cannot connect | Make sure `start.py` is running, then check `curl http://127.0.0.1:8900/health` |
Logs: `logs/ops-server.jsonl` records every tool call with its arguments, timing and result. `logs/errors-server.log`
records warnings and tracebacks.
## For AI agents setting this up
1. Clone, then run `setup.ps1` (Windows) or `bash setup.sh` (macOS/Linux). Both stop with a clear message if Python is too old.
2. Start the server in the background: `.venv/bin/python start.py` (Windows: `.venv\Scripts\python.exe start.py`).
3. Confirm with `GET http://127.0.0.1:8900/health`: `status` should be `ok`; `missing` lists optional layers and their fixes.
4. Register `http://127.0.0.1:8900/mcp` as an HTTP MCP server, then call the `health` tool.
5. Run `python -m pytest -q tests`: all tests should pass with no keys and no network services.
## Tests
```bash
python -m pytest -q tests
```
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues