We are excited to introduce
mpx, the Mathpix command-line interface. It is a single static binary that runs Mathpix OCR and document conversion straight from your terminal, with nothing to install alongside it.Install
One command installs it on macOS, Linux, or Windows (WSL):
curl -fsSL https://mathpix.com/mpx-cli/install.sh | sh
The script detects your OS and CPU, downloads the matching release, verifies its checksum, and puts
mpx on your PATH.Configure
mpx configure
mpx configure prompts for your credentials and defaults and stores them under ~/.mpx. Bring the app_id and app_key from your Mathpix account. You can also supply them with the MATHPIX_APP_ID / MATHPIX_APP_KEY environment variables, and keep separate identities in named profiles.Convert a document
mpx is organized as mpx <service> <command>. The scs service wraps our OCR and document API, and the output file’s extension picks the format:mpx scs convert paper.pdf paper.mmd
mpx scs convert paper.pdf paper.docx
mpx scs convert notes.md notes.docx # Markdown in, DOCX out
mpx scs convert equation.png equation.mmd # an image
Convert a folder
Point it at a directory and it converts every document in parallel, one progress line per file, and writes a report you can re-run:
mpx scs convert ./scans/ ./out/ --map pdf:docx,md:docx
Adding request options
Common options have flags (
--page-ranges, --rm-spaces, --include-equation-tags); every other API option is reachable through --options-json:mpx scs convert paper.pdf paper.mmd --options-json '{"rm_fonts": true, "include_chemistry": true}'
Add
--async to submit through the Files API and write results straight to your own bucket.Private Cloud OCR
If you run Private Cloud OCR in your own infrastructure, the same tool drives it. Point
--endpoint at your deployment:mpx pco --endpoint http://pco.internal:8080 convert ./scans/ ./out/ --formats docx
mpx pco --endpoint http://pco.internal:8080 status
The source is on GitHub, and full documentation is at mathpix.com/docs/mpx.