CleanParse A2A Document & Table Extractor
by ZhannaBee
README.md
# CleanParse A2A Micro-API (Stage 3)
> **Try it live & Automation Suite:**
> - **RapidAPI Marketplace:** [CleanParse AI Web & Table Extractor](https://rapidapi.com/ZhannaBee/api/cleanparse-ai-web-table-extractor)
> - **Live Docs & MCP Endpoint:** [Swagger UI](https://cleanparse-a2a-api.onrender.com/docs) · `https://cleanparse-a2a-api.onrender.com/mcp`
> - **Apify Actor (SaaS Pricing Monitor):** [Run on Apify Store](https://apify.com/heralded_bounty/apify-saas-pricing-monitor) · [GitHub](https://github.com/ZhannaBee/apify-saas-pricing-monitor)
> - **n8n & Make Automation Pack ($19):** [AI Competitor Pricing & Web Intel Pack on Gumroad](https://9413612092659.gumroad.com/l/competitor-intel-n8n-make)
Zero-LLM-cost deterministic Web/HTML/Text extraction & lossless Table normalizer with **FastAPI REST** + **MCP JSON-RPC 2.0** dual endpoints, SQLite billing/rate-limit metering, RapidAPI proxy verification, and one-click Render cloud deployment.
## Architecture
- **Zero External LLM Cost (`$0.00/call`):** Pure local parsing (`BeautifulSoup4` + `lxml`) strips nav/ads/scripts, expands complex `colspan`/`rowspan` HTML tables into lossless 2D JSON + GFM Markdown, and reduces token footprint for downstream AI agents.
- **Dual A2A Interface:**
- **REST API:** `POST /v1/extract`, `POST /v1/extract/tables`, `POST /v1/keys/issue`, `GET /v1/usage`, `GET /v1/pricing`, `GET /health`, `GET /.well-known/agent.json`
- **MCP JSON-RPC 2.0:** `POST /mcp` (`initialize`, `tools/list`, `tools/call` for `extract_document`, `extract_tables`, `check_quota`)
- **Billing & Rate-Limit Gate (`SQLite WAL`):**
- SHA-256 hashed API keys (`X-API-Key` / `Authorization: Bearer`)
- Constant-time RapidAPI proxy verification (`X-RapidAPI-Proxy-Secret` + `X-RapidAPI-User` + `X-RapidAPI-Subscription`)
- UTC daily plan quotas (`free`: 50/day, `pro`: 2,000/day, `enterprise`: 50,000/day) returning `429 Too Many Requests` with `Retry-After`
- Per-request usage & estimated USD revenue logging (`GET /v1/admin/revenue`)
- **Security:** SSRF protection blocking loopback, RFC1918 private IPs, cloud metadata (`169.254.169.254`), and non-HTTP(S) schemes.
## Local Run & Test
```powershell
.\.venv\Scripts\python.exe -m pytest tests -v
.\.venv\Scripts\python.exe scripts\export_openapi.py
.\.venv\Scripts\python.exe -m uvicorn app.main:app --host 127.0.0.1 --port 8000
```
## Cloud Deployment & RapidAPI Registration
1. Push `micro_api_stage3/` to a GitHub repo and connect via **Render Blueprint** (`render.yaml`, free tier).
2. Copy the Render URL (`https://<service>.onrender.com`) and import `artifacts/openapi_rapidapi.json` into **RapidAPI Studio**.
3. Copy RapidAPI's `X-RapidAPI-Proxy-Secret` into Render's `RAPIDAPI_PROXY_SECRET` environment variable.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues