Fresh-machine hardening from review
- util: drop dead openai/json/sys/requests/PIL extras (openai import would ImportError before engine load); ultralytics fallback path now raises (AGPL isolation - only MIT icon_detect_v3 ships) - requirements: default path only; paddle + ultralytics moved to README optional section - setup.sh: venv fallback for distros without ensurepip; --skip-weights verified - start.sh: bind 127.0.0.1 by default (LAN = explicit opt-in) - docs: absolute-path !cat examples, HF startup/airgap notes, token placement, security defaults
This commit is contained in:
1 parent
933f33e70a
commit
61a0f353cd
6 files changed
+48
-23
No files matched your search
@@ -52,6 +52,12 @@ git clone https://git.plean.rip/plean/omniparse-mcp.git && cd omniparse-mcp
|
||||
curl -s http://127.0.0.1:8898/healthz
|
||||
```
|
||||
|
||||
`start.sh` binds **127.0.0.1 by default** — the bearer token is a static
|
||||
secret, so LAN exposure is an explicit opt-in: `OMNI_API_HOST=0.0.0.0
|
||||
./start.sh` (firewall it yourself). The token lives **outside the repo**
|
||||
(`~/.config/omniparse_token`, mode 600, auto-generated on first start) so
|
||||
clones and worktrees share it and it can never be committed.
|
||||
|
||||
`start.sh` readiness = an actual parse round-trip, not just "models loaded"
|
||||
(OCR loads lazily and its detection peak is where VRAM pressure bites).
|
||||
|
||||
@@ -95,9 +101,12 @@ Start the service first. Then any MCP harness — omp (`~/.omp/agent/mcp.json`):
|
||||
"cwd": "/path/to/omniparse-mcp",
|
||||
"timeout": 120000,
|
||||
"env": { "OMNI_API_URL": "http://127.0.0.1:8898",
|
||||
"OMNI_API_TOKEN": "!cat ~/.config/omniparse_token" } } } }
|
||||
"OMNI_API_TOKEN": "!cat /home/YOU/.config/omniparse_token" } } } }
|
||||
```
|
||||
|
||||
(use an **absolute** path: `!cmd` values are exec'd without a shell in most
|
||||
harnesses, so `~` never expands)
|
||||
|
||||
The shim registers one tool, `omniparse(image_path | image_b64, format,
|
||||
include_som)`. In omp: `/mcp reload`, then `/mcp test omniparse`. The same
|
||||
entry works in Claude Desktop / Cursor-class harnesses; where `!cmd` env
|
||||
@@ -123,6 +132,21 @@ Florence, 1920×1080 screenshots:
|
||||
OCR-recognition-bound: 1080 Ti ≈ 1070 Ti here. Any sm_70+ card with more
|
||||
memory scales with batch size instead.
|
||||
|
||||
## Optional engines & notes
|
||||
|
||||
- **PaddleOCR** (alternate OCR; the service exposes `engine: "paddle"` per
|
||||
request): `pip install paddleocr==2.10.0 paddlepaddle==3.0.0` into the venv.
|
||||
Deliberately not in `requirements.txt` — hundreds of MB plus their own
|
||||
numpy/protobuf pins.
|
||||
- **Ultralytics/YOLOv8 detector**: not offered — AGPL-3.0, and this pipeline
|
||||
ships only the MIT `icon_detect_v3` (YOLOv9-E). Requesting another detector
|
||||
path raises explicitly rather than dragging AGPL code in.
|
||||
- **HuggingFace at startup**: the Florence-2 *processor* and tokenizer load
|
||||
from `huggingface.co` on boot (`trust_remote_code=True` runs upstream
|
||||
modeling code — pin your own audited copy in `weights/icon_caption_florence/
|
||||
preprocessor_config.json` world if that matters to you). Airgapped boxes:
|
||||
prime `HF_HOME` once on a networked machine, then set `HF_HUB_OFFLINE=1`.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **`503 GPU out of memory (another process on the card?)`** — something else
|
||||
|
||||
Reference in new issue
Block a user