Skip to main content

Docling Serve for Apple Silicon

PyPI CI

A native, background Docling Serve sidecar for Apple Silicon. PyTorch-backed Docling pipeline stages use Metal Performance Shaders (MPS), OCR uses Apple's Vision framework through OCRMac, and Dockerized clients connect through host.docker.internal.

Runtime

  • PyTorch-backed Docling stages use MPS with CPU fallback for unsupported operators
  • OCRMac uses Apple Vision directly; it does not run through PyTorch or MPS
  • Native accurate OCR for Simplified Chinese with English companion recognition
  • One converter worker to avoid duplicated model memory and MPS contention
  • Eight CPU threads for pipeline stages that remain CPU-bound
  • Loopback-only API and UI on port 5001
  • Remote model services and external plugins disabled

Requirements

  • Apple Silicon Mac
  • macOS with PyTorch MPS support
  • uv

Install

Install the application from PyPI:

uv tool install docling-serve-mps

Start the background sidecar:

docling-serve-mps start

start validates Apple Silicon and MPS support, starts Docling Serve when needed, waits for the health endpoint, and prints the API, UI, and log locations. Repeating it is safe and reports the existing managed process.

Open the local UI at:

http://127.0.0.1:5001/ui/

Stop the sidecar:

docling-serve-mps stop

The service does not start automatically after a macOS reboot. Run start when needed.

Source Checkout

For development or locked source deployment:

git clone https://github.com/hanlianlu/docling-serve-mps.git
cd docling-serve-mps
./service.sh start

The wrapper checks .venv against uv.lock, repairs it with uv sync --locked only when necessary, and delegates to the same packaged CLI. Its accepted commands are also exactly start and stop:

./service.sh stop

Configuration

The built-in defaults target an M4 Max with 48 GB unified memory while leaving capacity for DLightRAG and macOS:

DOCLING_DEVICE=mps
PYTORCH_ENABLE_MPS_FALLBACK=1
DOCLING_NUM_THREADS=8
DOCLING_SERVE_ENG_LOC_NUM_WORKERS=1
DOCLING_SERVE_OPTIONS_CACHE_SIZE=2
DOCLING_HOST=127.0.0.1
DOCLING_PORT=5001
DOCLING_SERVE_ENABLE_UI=true
DOCLING_SERVE_ENABLE_REMOTE_SERVICES=false
DOCLING_SERVE_ALLOW_EXTERNAL_PLUGINS=false
DOCLING_SERVE_CUSTOM_OCR_PRESETS='{"auto":{"kind":"ocrmac","framework":"vision","recognition":"accurate","lang":["zh-Hans","en-US"]}}'

Set an environment variable before start to override a default. Source checkouts can place overrides in service.env; installed tools can export them in the calling shell. For example:

export DOCLING_PORT=5101
docling-serve-mps start

Use DOCLING_SERVE_MPS_STATE_DIR to override the state directory. The default is:

~/Library/Application Support/docling-serve-mps/

It contains the lifecycle lock, PID record, persistent log, and Docling scratch directory. The PID record is atomic, and stop verifies process identity before sending SIGTERM.

Keep the service on 127.0.0.1. The UI is not separately authenticated, so do not bind to 0.0.0.0 unless an authenticated reverse proxy protects it.

OCR

The service replaces Docling Serve's built-in auto OCR preset through its official custom preset registry. Clients can keep sending ocr_preset=auto; the effective configuration is:

engine: OCRMac
framework: Apple Vision
recognition: accurate
languages: zh-Hans, en-US

The language order prioritizes Simplified Chinese, with English as Apple's supported companion language. The caller's force_ocr value remains authoritative. LightRAG currently sends force_ocr=true, so its conversions continue to use full-page OCR.

This service-side setting applies only when a document reaches Docling for a new parse. It does not migrate or reprocess existing DLightRAG documents, chunks, vectors, knowledge graphs, or parser caches.

DLightRAG Integration

For Dockerized DLightRAG, configure Docling as an external endpoint:

parser_sidecars:
  docling:
    endpoint: http://host.docker.internal:5001

Remove or comment out the active MinerU block. If both MinerU and Docling are configured, DLightRAG prioritizes MinerU. Do not enable DLightRAG's CPU Docling Compose profile at the same time because this native service already owns port 5001.

Verify connectivity from the DLightRAG container:

docker compose exec -T dlightrag-api python -c \
  "import urllib.request; print(urllib.request.urlopen('http://host.docker.internal:5001/health').read().decode())"

Upgrade

Upgrade the installed application, then restart it:

docling-serve-mps stop
uv tool upgrade docling-serve-mps
docling-serve-mps start

For a source checkout, explicitly update and review the lockfile before restarting:

./service.sh stop
uv lock --upgrade-package docling-serve \
  --upgrade-package docling-slim \
  --upgrade-package ocrmac
./service.sh start

Troubleshooting

Check health directly:

curl http://127.0.0.1:5001/health

Check whether another process owns port 5001:

lsof -nP -iTCP:5001 -sTCP:LISTEN

The start output prints the persistent log path. Initial startup can take longer while model artifacts are downloaded and loaded. Docling logs the selected accelerator as mps; OCRMac delegates recognition to Apple Vision independently.

Release

Maintainers publish by creating a GitHub Release whose tag exactly matches the pyproject.toml version with a v prefix, for example v0.1.0. The release workflow rebuilds and tests the artifacts, then publishes through PyPI Trusted Publishing with GitHub OIDC. No PyPI API token is stored in GitHub.

License

MIT License. Copyright (c) 2026 Hanlian Lyu. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docling_serve_mps-0.1.0.tar.gz (262.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docling_serve_mps-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file docling_serve_mps-0.1.0.tar.gz.

File metadata

  • Download URL: docling_serve_mps-0.1.0.tar.gz
  • Upload date:
  • Size: 262.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for docling_serve_mps-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa883b1a54f5c14a8393c2f38d7594a7d55697952738551c20016cd990457ef4
MD5 1cbe9e51708dba224ed151902a56b1e9
BLAKE2b-256 13355ef02c5b88a59de132fc719db7cde755579f4bc27fbd1ed42d8ff6097582

See more details on using hashes here.

Provenance

The following attestation bundles were made for docling_serve_mps-0.1.0.tar.gz:

Publisher: publish.yml on hanlianlu/docling-serve-mps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docling_serve_mps-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for docling_serve_mps-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 995b60777217308b7460180ea531701346b848060f8059f0eb1076f7b6c7dabb
MD5 fdc25ff3dfdec3f96670768b9cc755b0
BLAKE2b-256 e551597dc5cea1a229313d38b1f15e7b0bb967845c79d2ab22190e258fa25986

See more details on using hashes here.

Provenance

The following attestation bundles were made for docling_serve_mps-0.1.0-py3-none-any.whl:

Publisher: publish.yml on hanlianlu/docling-serve-mps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page