Extracts structured content from Office and PDF documents into JSON and markdown and generates documents from markdown.
Also known as sunholo-data/ailang-parse, ailang-parse, @ailang/parse
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- 3,212
- Latest version
- 0.14.1
- Last commit
- Nov 12, 2026
- License
- Apache-2.0
What is AILANG Parse MCP?
AILANG Parse extracts structured content from Office and PDF documents into JSON and markdown and generates documents from markdown.
Summary generated from the project's README
About AILANG Parse MCP server
AILANG Parse provides a comprehensive system for converting various document formats into structured JSON and markdown. It supports parsing 16 different formats, including Office files like DOCX, PPTX, and XLSX, as well as PDFs, HTML, and images. For Office documents, the tool uses deterministic XML parsing that operates locally without requiring AI or cloud connectivity. When handling PDFs, it defaults to a local poppler backend but can automatically escalate to docling OCR for scanned files.
Developers can use this tool to generate new documents in nine different formats by writing markdown. This process allows for the creation of complex files like spreadsheets or presentations from simple text. The system is AI-agnostic, meaning you can plug in external models like Gemini, Claude, or local Ollama via specific flags. While most parsing is local, users opting for AI backends for PDFs must authenticate using Google ADC. The package is available via Python, JavaScript, and Go SDKs, making it easy to integrate into existing workflows.
What you can do with it
- 1Convert Office files to markdownTransform a complex Word document into LLM-ready markdown for further processing.
- 2Generate documents from markdownCreate a professional DOCX file by providing markdown content and a reference template.
- 3Perform OCR on scanned PDFsAutomatically use local OCR to extract text from a PDF that lacks a text layer.
- 4Audit document structureRun a strict structural check on a DOCX file to find heading gaps or missing image descriptions.
Written from the project's README. Every use case is checked against a quote from it.
How to install AILANG Parse MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall AILANG Parse MCP in Claude Code
$ claude mcp add --env 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' ailang-parse -- npx -y @ailang/parseInstall AILANG Parse MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"ailang-parse": {
"command": "npx",
"args": [
"-y",
"@ailang/parse"
],
"env": {
"DOCPARSE_API_KEY": "<YOUR_DOCPARSE_API_KEY>"
}
}
}
}Install AILANG Parse MCP in VS Code
.vscode/mcp.json
{
"servers": {
"ailang-parse": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@ailang/parse"
],
"env": {
"DOCPARSE_API_KEY": "<YOUR_DOCPARSE_API_KEY>"
}
}
}
}Install AILANG Parse MCP in VS Code CLI
$ code --add-mcp '{"name":"ailang-parse","type":"stdio","command":"npx","args":["-y","@ailang/parse"],"env":{"DOCPARSE_API_KEY":"<YOUR_DOCPARSE_API_KEY>"}}'Install AILANG Parse MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"ailang-parse": {
"command": "npx",
"args": [
"-y",
"@ailang/parse"
],
"env": {
"DOCPARSE_API_KEY": "<YOUR_DOCPARSE_API_KEY>"
}
}
}
}Install AILANG Parse MCP in Codex
$ codex mcp add ailang-parse --env 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' --env 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' -- npx -y @ailang/parseInstall AILANG Parse MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.ailang-parse] command = "npx" args = ["-y", "@ailang/parse"] [mcp_servers.ailang-parse.env] DOCPARSE_API_KEY = "<YOUR_DOCPARSE_API_KEY>"
Install AILANG Parse MCP in Gemini CLI
$ gemini mcp add -s user -e 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' -e 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' ailang-parse npx -- -y @ailang/parseInstall AILANG Parse MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"ailang-parse": {
"command": "npx",
"args": [
"-y",
"@ailang/parse"
],
"env": {
"DOCPARSE_API_KEY": "<YOUR_DOCPARSE_API_KEY>"
}
}
}
}Configuration
DOCPARSE_API_KEYSecretAILANG Parse API key (dp_...). Optional — the bridge auto-loads keys saved at ~/.config/ailang-parse/credentials.json. Get one from https://www.sunholo.com/ailang-parse/
DOCPARSE_API_KEYSecretAILANG Parse API key (dp_...). Optional — the bridge auto-loads keys saved at ~/.config/ailang-parse/credentials.json. Get one from https://www.sunholo.com/ailang-parse/
AILANG_PARSE_MCP_URLOverride the hosted MCP endpoint. Defaults to https://docparse.ailang.sunholo.com/mcp/
AILANG_PARSE_MCP_URLOverride the hosted MCP endpoint. Defaults to https://docparse.ailang.sunholo.com/mcp/
| Name | Description | |
|---|---|---|
| DOCPARSE_API_KEY | AILANG Parse API key (dp_...). Optional — the bridge auto-loads keys saved at ~/.config/ailang-parse/credentials.json. Get one from https://www.sunholo.com/ailang-parse/ | Secret |
| DOCPARSE_API_KEY | AILANG Parse API key (dp_...). Optional — the bridge auto-loads keys saved at ~/.config/ailang-parse/credentials.json. Get one from https://www.sunholo.com/ailang-parse/ | Secret |
| AILANG_PARSE_MCP_URL | Override the hosted MCP endpoint. Defaults to https://docparse.ailang.sunholo.com/mcp/ | |
| AILANG_PARSE_MCP_URL | Override the hosted MCP endpoint. Defaults to https://docparse.ailang.sunholo.com/mcp/ |
Automated checks
Ran Nov 12, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablePass
- Open source license (OSI)Pass
- Commit or release in the last yearPass
- Package name not close to a popular packagePass
- Remote endpoint uses HTTPSPass
- Destructive tools are labelledNot checked
- No hidden instructions to the modelPass
- No critical advisory in the package or its dependenciesPass
README
View on GitHubAILANG Parse
Universal document parsing and generation in AILANG. Extracts structured content from DOCX, PPTX, XLSX, PDF, and image files into JSON and markdown — and writes documents back out in 9 formats. To author a document, write Markdown and convert it; see Writing documents in Markdown.
Office formats (DOCX, PPTX, XLSX) use deterministic XML parsing — no AI, no cloud, instant results. PDFs default to the deterministic pdftotext backend (poppler) — also no AI, no cloud — with poppler (headings, lists, tables and header/footer from the same tools, no installs), docling and liteparse as local alternatives escalating automatically to local docling OCR for scanned/image-only PDFs. Pluggable AI (Gemini, Claude, local Ollama) is available via --pdf-backend ai but is never chosen automatically. Images delegate to whatever AI model you plug in. AILANG Parse is AI-agnostic: swap --pdf-backend/--ai to change the backend, zero code changes.
Install
Two routes; both put a docparse command on your PATH, and both write output
next to the file you parse (--output-dir DIR or DOCPARSE_OUTPUT_DIR to
change that).
Already have AILANG? (0.42.0+ of this package, AILANG v0.40.0 dev or later)
ailang install sunholo/ailang_parse
docparse report.docx
The package's [bin] table gives you a shim in ~/.ailang/bin that runs
straight out of the registry cache: parse one file, or --convert it. It is
deliberately the thin path — describe/summarize, batch mode, PDF backends
and --install-backends are not on it (see below). ailang bin list /
ailang bin uninstall docparse manage it.
Otherwise, or for the full CLI:
curl -fsSL https://www.sunholo.com/ailang-parse/install.sh | sh
Fetches the published package (~400 KB), installs the AILANG runtime if you do
not have it, and links the full docparse wrapper (plus docparse-audit and
docparse-render) into ~/.local/bin. --version, --prefix and
--uninstall are supported; re-running is a no-op. If you install both,
ailang install tells you which one docparse resolves to.
That covers every deterministic format. PDF needs two more things, and they are easy to miss:
brew install poppler # pdftotext, the default PDF backend
# (apt install poppler-utils on Debian/Ubuntu)
docparse --install-backends # docling + liteparse, for scans and layout
--install-backends matters even if you never pass --pdf-backend: when
pdftotext finds no text layer the parser escalates to docling on its own, so
without it a scanned PDF fails on the default backend. AI backends
authenticate with Google ADC (gcloud auth application-default login), not an
API key.
git clone https://github.com/sunholo-data/ailang-parse.git
ln -s "$(pwd)/ailang-parse/bin/docparse" /usr/local/bin/docparse
The wrapper finds the project root by walking up for docparse/main.ail, so it
works from a clone, an installed prefix, or a symlink chain. Note that the CLI
wrapper and the PDF adapter live under assets/ — the only path the AILANG
publisher bundles verbatim — with symlinks at their historical locations.
SDKs
Use AILANG Parse from your language of choice:
pip install ailang-parse # Python
npm install @ailang/parse # JavaScript/TypeScript
go get github.com/sunholo-data/ailang-parse-go # Go
Quick Start
# Office documents (deterministic, no AI needed)
docparse report.docx
docparse slides.pptx
docparse spreadsheet.xlsx
# PDF (deterministic pdftotext by default — no AI); images (AI auto-enabled)
docparse document.pdf
docparse photo.png
# Options
docparse report.docx describe # AI image descriptions
docparse report.docx summarize # AI document summary
docparse contract.pdf # PDF: deterministic pdftotext (default)
docparse scan.pdf # Scanned PDF: escalates to local docling OCR
docparse scan.pdf --pdf-backend ai --ai gemini-3.5-flash-lite # External AI (paid), opt-in only
# Format conversion
docparse report.docx --convert output.html
docparse data.csv --convert report.docx
docparse notes.md --convert slides.pptx
docparse notes.md --convert offer.docx --reference-doc letterhead.docx
# AI document generation
ailang run --entry main --caps IO,FS,Env,AI --ai gemini-3.5-flash-lite \
docparse/main.ail --generate report.docx --prompt "Q1 sales report with tables"
Output
Every run produces, in the directory you ran from (--output-dir DIR or
DOCPARSE_OUTPUT_DIR to change it):
<filename>.json— Structured JSON with typed blocks<filename>.md— LLM-ready markdown
What AILANG Parse Extracts
| Feature | DOCX | PPTX | XLSX | Best Competitor |
|---|---|---|---|---|
| Tables with merged cells | Yes | Yes | Yes | Raw OOXML only |
| Track changes (redlining) | Yes | — | — | Pandoc (3/3) |
| Comments (interleaved) | Yes | — | — | Raw OOXML (2/2) |
| Headers/footers | Yes | — | — | Kreuzberg (2/3) |
| Text boxes / VML shapes | Yes | Yes | — | Raw OOXML (1/2) |
| Equations (§22.1) | Yes | — | — | None |
| Field codes (§17.16) | Yes | — | — | Kreuzberg, OOXML |
| Speaker notes | — | Yes | — | None |
| Multi-sheet extraction | — | — | Yes | Kreuzberg |
OfficeDocBench v2 (87 files, 11 formats, 8 metrics): AILANG Parse PR #116 candidate 98.1% composite with 100.0% coverage. Ten adapters compared, including the hosted Extend (Parse 2.0, 53.3% coverage-adjusted) and LlamaParse (standard mode) APIs. Source-verified structural assertions now measure cell positions, comment targets, list depth, formatting, formulas, colours, and slide/notes relationships. Methodology and results.
Supported Formats
Parsing (16 formats): DOCX, PPTX, XLSX, ODT, ODP, ODS, HTML, Markdown, CSV, EPUB, EML, MBOX, TEX, RTF, PDF, images (JPG/PNG)
Generation (9 formats): DOCX, PPTX, XLSX, ODT, ODP, ODS, HTML, Markdown, QMD (Quarto)
Writing documents in Markdown
Markdown is the input an LLM can write, so it is the practical way to generate a document: write markdown, convert to any of the nine output formats.
docparse report.md --convert report.docx
What survives the trip: YAML front matter (title/author/date → document
properties), bold/italic/code/strike as real character formatting,
links as real hyperlinks, images (local paths are read and embedded), fenced
code blocks, blockquotes, nested lists, thematic breaks, and tables with
alignment and column spans.
Headers, footers, comments and tracked changes have no Markdown syntax; those are preserved when converting from a document that already contains them.
Local document verification (v0.41.2+)
docparse-audit and docparse-render are AILANG companions to the CLI.
AILANG Parse v0.41.2 requires AILANG 0.35.0 or newer. They run
locally and require no hosted account. The installer links them when present in
the installed release; in a checkout use ./bin/docparse-audit and
./bin/docparse-render.
docparse-audit report.docx --strict
docparse-render report.docx --output-dir qa/report
docparse-render before.docx --compare after.docx --output-dir qa/comparison
The read-only DOCX audit emits JSON inventories and findings for table grids and
headers, heading gaps, image descriptions, links, comments and fields. Exit codes
are 0 for a completed audit, 1 for findings with --strict, and 2 for unreadable
input. It is a bounded structural check; it does not certify accessibility or
resolve arbitrary style inheritance.
Rendering supports .docx, .odt, .pptx, .xlsx and .pdf. Install LibreOffice
and Poppler for Office input; PDF needs only Poppler. No new Python dependency is
needed. Select tools with --soffice / --pdftoppm (or DOCPARSE_SOFFICE /
DOCPARSE_PDFTOPPM). --dpi defaults to 144 and --timeout to 120 seconds per
process. The output directory must be new. Each document gets a PDF and numbered
PNG pages; the manifest records source hashes, tool paths and page directories.
Comparison identifies changed/added/removed pages using uncompressed raster
hashes. Inspect the two PNG sets side by side; no diff overlays are generated.
visual_review: pending means page images still need inspection.
The implementation is in docparse/services/document_render.ail and
docparse/services/docx_audit.ail; regression verification is AILANG too:
ailang run --entry main --caps IO,FS,Env,Process \
--process-allowlist "true,false,mktemp,mkdir,$(command -v soffice),$(command -v pdftoppm)" \
--process-timeout 120s scripts/verify_document_quality.ail -- \
/tmp/docparse-quality-new "$(command -v soffice)" "$(command -v pdftoppm)"
Styling a generated DOCX from a template
--reference-doc is the Quarto/Pandoc reference-doc feature: an existing
.docx supplies the look, the Markdown supplies the content.
docparse annex.md --convert annex.docx --reference-doc letterhead.docx
Generated tables use the selected section's usable width, with bounded content weights for columns and repeating semantic headers. Merged-cell widths sum the columns they cover.
The template's styles.xml, numbering.xml, theme, embedded fonts, headers,
footers and page setup are applied to the new content. Everything the merge does
not regenerate is carried through byte-for-byte, so the letterhead, logo and
licensed fonts come out exactly as they went in.
What comes from where:
| Template | page size, margins, headers, footers, page numbering, fonts, theme, colours |
| Your document | the body content, and docProps/core.xml (title/author) |
| Merged | styles.xml (ours fill only the styleIds the template lacks), numbering.xml (our list definitions take ids above the template's), [Content_Types].xml, both .rels |
Two consequences worth knowing:
- The template's headers and footers win. A source document's own headers are
dropped rather than mixed with the letterhead. The page furniture all lives in
the template's body
<w:sectPr>, which is lifted whole. - The template's comments are dropped along with its body, and so are
commentsExtended.xmlandpeople.xml. Comments in the source document still come through.
Two flags refine a multi-section template:
--reference-section Npicks which of the template's sections supplies the page setup, headers and footers — 1 is the first section, Word's numbering. The default is the last section (the body-level one, what the flag-less behaviour has always lifted). A multi-section template's wanted furniture is often an earlier section's — the master agreement's CONFIDENTIAL footer, not the Annex's missing one.--table-style NAMEbinds generated tables to a table style the template defines (matched on styleId, then style name). Without it, the style namedTableis used if the template has one, else the first table style that is not the implicit Normal Table. Under a bound style the generator stops emitting its own hardcoded borders — the style carries them.
An unreadable or non-DOCX reference is an error and writes nothing — a silent fallback to the built-in styling would produce a plausible file missing exactly the letterhead it was asked for. DOCX output only.
Architecture
docparse/
├── types/document.ail # Block ADT (11 variants)
├── services/
│ ├── format_router.ail # Format detection (36 inline tests)
│ ├── zip_extract.ail # ZIP layer (9 inline tests)
│ ├── docx_parser.ail # DOCX XML → Blocks (6 inline tests)
│ ├── pptx_parser.ail # PPTX slides → Blocks
│ ├── xlsx_parser.ail # XLSX worksheets → Blocks
│ ├── direct_ai_parser.ail # PDF/image → Blocks (AI)
│ ├── layout_ai.ail # AI self-healing (optional)
│ ├── output_formatter.ail # JSON + markdown output
│ └── docparse_browser.ail # WASM browser adapter
└── main.ail # CLI entry point
91 contracts, 50+ inline tests. Of the 91, Z3 proves 14 outright; the rest are
checked at runtime under --prove/--verify-contracts in CI, and skip statically
because parser code is recursive and higher-order, which is outside Z3's
decidable fragment.
AI Configuration
AILANG Parse uses AILANG's AI effect — any model AILANG supports works:
docparse scan.pdf --ai gemini-3.5-flash-lite # Google (default; fast)
docparse scan.pdf --ai granite-docling # Local Ollama (free)
docparse scan.pdf --ai claude-haiku-4-5 # Anthropic
AI usage is bounded by capability budgets (AI @limit=200 on main), so costs are predictable.
Dev Commands
docparse --check # Type-check all modules
docparse --test # Run inline tests
docparse --prove # Static Z3 contract verification
Benchmarks
uv run benchmarks/run_benchmarks.py --suite office # Structural (no API, instant)
uv run benchmarks/run_benchmarks.py --suite pdf # PDF extraction (needs AI)
uv run benchmarks/run_benchmarks.py --competitors # Compare to Docling etc.
See benchmarks/ for details.
License
Apache 2.0
AILANG Parse MCP questions
How do I add AILANG Parse MCP to Claude Code?
Run claude mcp add --env 'DOCPARSE_API_KEY=<YOUR_DOCPARSE_API_KEY>' ailang-parse -- npx -y @ailang/parse in your terminal. Add --scope user to make it available in every project.
How do I add AILANG Parse MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What formats can AILANG Parse extract content from?
It supports 16 formats including DOCX, PPTX, XLSX, ODT, ODP, ODS, HTML, Markdown, CSV, EPUB, EML, MBOX, TEX, RTF, PDF, and images like JPG/PNG.
Can I generate documents using AILANG Parse?
Yes, you can write documents in Markdown and convert them into 9 different formats including DOCX, PPTX, XLSX, and HTML.
How does the parser handle scanned PDFs?
If the default backend finds no text layer, it automatically escalates to local docling OCR for scanned or image-only PDFs.
Does parsing require an internet connection or AI?
Office formats use deterministic XML parsing that requires no AI or cloud, providing instant local results.