Skip to main content

HiraraReader

Self-hosted Office-document reader for AI agents — docx, pptx, xlsx → text. No API keys.

Part of the Hirara tool hub. Pure-Python — python-docx, python-pptx, and openpyxl. URL fetches route through the hub's shared SSRF guard, hirara-core.

License Python MCP


One tool, three formats

office_read takes a Word, PowerPoint, or Excel file and returns clean markdown (plus the plain text). The format is auto-detected from the file contents — they are all ZIP containers, told apart by what's inside — so the agent never has to pick; it just says "read this file."

Format What comes out
.docx Headings (#), bullet lists (-), and tables preserved as markdown
.pptx Per-slide text under ## Slide N, plus speaker notes
.xlsx One markdown table per sheet, under ## Sheet: <name>

It pairs with the hub's other readers: hirarapdf for PDFs and hiraraocr for images and scans. This one owns the Office formats.

Legacy binary formats (.doc / .xls / .ppt) are recognized and rejected with a clear message — save as the modern OOXML format instead.


Quick start

pip install -e ../hirara-core        # shared SSRF guard (repo-local)
pip install -e ".[service,mcp]"

As an HTTP service:

uvicorn hirarareader.service:app --host 127.0.0.1 --port 8500

Read a document (base64, path, or URL) → markdown + text:

curl -X POST localhost:8500/office_read -H 'content-type: application/json' \
  -d '{"file_path":"/path/to/report.docx"}'

Or upload it directly:

curl -X POST localhost:8500/office_read/upload -F file=@deck.pptx

As an MCP server over stdio (Claude Desktop / Cursor / agent runtimes):

python -m hirarareader.mcp_server

With Docker (loopback-bound, nothing to download at boot):

docker compose up -d --build

API

Endpoint Purpose
POST /office_read Read one document. file_path / file_url / file_base64, filename
POST /office_read/upload Same, multipart file upload
GET /schemas Tool definition, ready for an LLM tools array
GET /health Liveness + supported formats

Response carries kind (docx/pptx/xlsx), markdown, text, meta (paragraph/slide/sheet counts), truncated, source, and error. Errors come back in the body, not as HTTP status codes: the caller is an agent loop, and "unrecognized document" is a result to reason about.


Security

  • file_url is off by default. When enabled (CRDR_ALLOW_URL_FETCH=true), the fetch goes through hirara-core's safe_download — resolve-then-pin, every redirect hop re-validated, streamed under a byte cap — never a bare httpx.get.
  • Local file access is gated. file_path lets a caller name any file on the host; fine for a local/MCP server, off in the Docker image. Set CRDR_ALLOW_LOCAL_PATH=true only for a trusted, local deployment.
  • Everything is size-capped — input by CRDR_MAX_BYTES, output by CRDR_MAX_CHARS (flags truncated), spreadsheet rows by CRDR_MAX_ROWS.

Configuration

All via environment variable.

Variable Default Notes
CRDR_MAX_BYTES 26214400 Cap on an input file (25 MB)
CRDR_MAX_CHARS 500000 Cap on output text/markdown; flags truncated
CRDR_MAX_ROWS 2000 Per-sheet row cap for spreadsheets
CRDR_ALLOW_URL_FETCH false Enable file_url (through the SSRF guard)
CRDR_ALLOW_LOCAL_PATH true (lib) / false (image) file_path reads

Testing

pip install -e ".[dev]"
pytest -q

The suite builds tiny real .docx/.pptx/.xlsx files in memory and reads them back — so it exercises the actual libraries end-to-end, no fixtures checked in. Verified on a live server: all three formats read to the expected markdown.


License

Apache License 2.0 — see LICENSE and NOTICE.

Copyright 2026 Lucas D Marshall (Kaung Myat San).

Release files for hirarareader 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hirarareader 0.1.0
File Size Uploaded
hirarareader-0.1.0.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hirarareader 0.1.0
File Interpreter ABI Platform
hirarareader-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.7 kB

Release files / hirarareader-0.1.0.tar.gz

Download URL hirarareader-0.1.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
afa4e7d58bfba1ceaf530f572150fb9bad77e0eaca90d10f1feead93f978cfbe
BLAKE2b-256 checksum
How to use checksums
10c8bcadcad82f58532344c5fee47531aec52bac8a5236e80806f90c4aff0259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / hirarareader-0.1.0-py3-none-any.whl

Download URL hirarareader-0.1.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e20c6a9effebc385472ef12ad65cf23f800670821655f9f16a25b1c1ac276dcf
BLAKE2b-256 checksum
How to use checksums
9d012cb6d707d99034378db3e45a948b229d5dbe90c47694078e86bc479b9782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release 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