mdmirror
Turn any folder into Claude-optimal Markdown context with one command.
mdmirror repo # → ./repo.claude.md
mdmirror repo --stdout | pbcopy # paste-ready clipboard
What it does
- Recursively walks a folder.
- Converts office docs / PDFs / HTML via markitdown.
- Source code (
.py,.ts,.go, …) is fenced with the right language tag — no mangling. - Each file gets a
source:frontmatter so the LLM always knows where a chunk came from. - Output is sorted by path: deterministic, diffable across runs.
- Token count is exact (via
tiktoken), not a heuristic. - Aggressive default ignore list:
.git,node_modules,dist, lockfiles, fonts, images, archives. Honors.gitignore.
Install
pipx install mdmirror # recommended — isolated env
# or
uv tool install mdmirror
# or
pip install mdmirror
Office formats (docx, xlsx, pptx, pdf, outlook) ship in the base install. For audio transcription via whisper:
pipx install '.[audio]' # adds whisper, youtube-transcription
pipx install '.[all]' # everything
Modes
Default — Claude bundle
mdmirror repo # → ./repo.claude.md
mdmirror repo bundle.md # → ./bundle.md
mdmirror repo --stdout # stream to stdout
The bundle is a single .md with a header, a complete file tree, then every file in alphabetical order:
# Context bundle: repo
Source root: `/path/to/repo`
## File tree
```
README.md
src/lib/foo.ts
src/main.py
```
---
source: README.md
bytes: 312
---
# Hello
…
<!-- ────────────────────────────── -->
---
source: src/lib/foo.ts
bytes: 412
---
```ts
// file contents
```
Tree mirror
For when you want one .md per file on disk:
mdmirror repo --tree # → ./repo_md/
mdmirror repo out --tree # → ./out/
mdmirror repo out --tree --bundle # tree AND ./repo.claude.md
Flags
| Flag | Purpose |
|---|---|
--tree |
Mirror as a folder of .md files instead of one bundle |
--bundle |
With --tree, also emit a bundle at ./<input>.claude.md |
--stdout |
Stream the bundle to stdout (great for | pbcopy) |
--overwrite |
Replace existing output files |
--dry-run |
Report planned actions, write nothing |
--workers N |
Parallel worker processes |
--skip-pattern PAT |
Extra gitignore-style pattern (repeatable) |
--include-hidden |
Don't skip dotfiles / dotdirs |
--follow-symlinks |
Follow symlinks (cycle-safe) |
--no-default-ignore |
Disable the built-in skip list |
--no-gitignore |
Don't honor a root .gitignore |
--no-frontmatter |
Strip the source: YAML header |
--no-fence |
Disable code fencing (everything goes through markitdown) |
-q, -v |
Quiet / verbose logging |
Behaviors worth knowing
- Naming (tree mode):
report.docxbecomesreport.docx.mdso a siblingreport.pdfdoesn't collide.*.mdfiles pass through unchanged. - Output safety: refuses to run if the output dir is inside the input dir.
- Failures don't crash the run. Each failed file is logged and counted; everything else still gets converted.
- Logs go to stderr. Stdout stays clean for
--stdoutpiping.
Develop
uv pip install -e '.[dev]'
.venv/bin/pytest -q -m "not integration" # fast (~0.5s)
.venv/bin/pytest -q # incl. real markitdown roundtrip
Metadata
Release files for mdmirror 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mdmirror-0.2.2.tar.gz | 53.8 kB | With provenance | Details for mdmirror-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mdmirror-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for mdmirror-0.2.2-py3-none-any.whl |
Total release size: 70.1 kB
Release files / mdmirror-0.2.2.tar.gz
| Download URL | mdmirror-0.2.2.tar.gz |
|---|---|
| Size | 53.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad965c59fcc400c893b99cfcbccc4b8e03bcadd4762ea429da2195494dc07194
|
|
BLAKE2b-256 checksum How to use checksums |
7df4998733e33573ed3c0090a65f540a6ce433c6881b03fa0f6d6814dba1eed5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 26, 2026.
Transparency logRelease files / mdmirror-0.2.2-py3-none-any.whl
| Download URL | mdmirror-0.2.2-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
563677e95abce8cbb1b30cb477115479d6c54a426a16b53541109e91ecea1670
|
|
BLAKE2b-256 checksum How to use checksums |
4b6f918e0924725ce347de485f6ee39570155b2dd073101b63b10014ab87a0eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 26, 2026.
Transparency logSecurity for mdmirror 0.2.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mdmirror-0.2.2.tar.gz
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 Apr 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.