# Ashlr MD > Open-source Markdown app for macOS, Windows, and Linux. Agents install one command, call a CLI that prints JSON, and drive the live document over MCP. This file is the agent manual. The same commands live in the README and in docs/EXAMPLES.md. The exhaustive per-tool notes live in docs/AGENTS.md. Tool order comes from `tool_registry()` in `src-tauri/bins/mdopener-mcp/src/lib.rs`. ## What it is Ashlr MD renders Markdown on macOS, Windows, and Linux. `mdopen` opens a file in the app. `mdopener-mcp` is the MCP server agents launch over stdio. `open_file` is the only tool that starts the app. The server talks to the app on `127.0.0.1` with a token in `~/.mdopener/`. People use the window to read, edit, and export. Agents use the CLI and the MCP tools. ## Install macOS or Linux, from a checkout. Needs git, curl, Rust (Cargo), and Bun; the script stops and names the first one missing. This builds the CLI and the MCP server and skips the desktop app. ```bash SKIP_APP_BUILD=1 bash scripts/install.sh ``` No checkout: ```bash SKIP_APP_BUILD=1 bash <(curl -fsSL https://raw.githubusercontent.com/ashlrai/ashlr-md/main/scripts/install.sh) ``` Run this way, the script clones into `~/ashlr-md` (set `CLONE_DIR` to change it), or fast-forwards that clone when it exists. The current directory does not matter. The script links `mdopen` and `mdopener-mcp` into `/usr/local/bin`, or into `~/.local/bin` when that directory is not writable. If the commands are missing: ```bash export PATH="$HOME/.local/bin:$PATH" ``` When `claude` is on `PATH`, the script registers the MCP server. The desktop app is a release download: https://github.com/ashlrai/ashlr-md/blob/main/docs/INSTALL.md Windows uses the NSIS installer, then the PowerShell commands in docs/EXAMPLES.md. The bash script is not the Windows install. ## JSON commands These exit without reading MCP stdin. `doctor` and `setup --local` do not download a model and do not write config. ```bash mdopener-mcp --version mdopener-mcp doctor --json mdopener-mcp doctor --fix --json mdopener-mcp setup --local --json mdopener-mcp --ashlr-handshake --json mdopener-mcp --export-tool-schema ``` | Command | Output | |---|---| | `doctor --json` | one JSON object, `"kind": "ashlr.doctor"` | | `doctor --fix --json` | one JSON object, `"kind": "ashlr.doctor"`, with `mode`, `plan`, and `outcome`. Dry run. Writes nothing | | `doctor --fix --apply --json` | the same shape, and it makes the repairs | | `setup --local --json` | one JSON object, `"kind": "ashlr.setup-local"`, `downloads` false, `writes` false | | `--ashlr-handshake --json` | one JSON object, `"kind": "ashlr.handshake"` | | `--export-tool-schema` | tool names and input schemas as JSON, sorted by name | | `--version --json`, `--help --json`, `--export-tool-schema --json` | one JSON object with a `kind` of `ashlr.version`, `ashlr.help`, or `ashlr.tool-schema`, `schema_version: 1`, and `tool: "ashlr-md"` | `--json` may come before or after the flag, and `-V` and `-h` work too. Check `kind` and `schema_version`, and allow extra fields in version 1. `doctor` and `setup --local` exit 0 whatever they find, so read the JSON, not the exit code. Fields: https://github.com/ashlrai/ashlr-md/blob/main/docs/local-ai.md#json-output `mdopener-mcp doctor --apply` without `--fix` exits 2 and writes nothing. Repair rules: https://github.com/ashlrai/ashlr-md/blob/main/docs/doctor-fix.md ## Connect MCP ```bash claude mcp add --scope user ashlr-md "$(command -v mdopener-mcp)" codex mcp add ashlr-md -- "$(command -v mdopener-mcp)" python3 scripts/connect-cursor.py ``` Restart Claude Code after the first command. Codex picks the server up on its next run. The Cursor script merges `ashlr-md` into `~/.cursor/mcp.json` and writes nothing if that file is not JSON, if `mcpServers` is not an object, or if `ashlr-md` already points at a different program that still exists. Reload MCP in Cursor Settings. In the desktop app: Preferences, AI agents (MCP), then Connect to Claude Code, Connect to Cursor, or Connect to Codex. ## Open a file ```bash mdopen samples/agent-plan.md mdopen --edit samples/agent-plan.md echo '# Hello' | mdopen - ``` | Flag | Effect | |---|---| | `--edit`, `-e` | open in edit mode | | `--read`, `-r` | open in read mode, the default; not with `--edit` | | `-` | read Markdown from stdin (up to 16 MiB) and open it from a temp file | | `--` | end of flags, for a file whose name starts with a dash | | `--hook` | Claude Code PostToolUse hook; reads the hook JSON on stdin | | `--help`, `-h` / `--version`, `-V` | help or version | `mdopen` exits 0 when the running app accepted the file, or when the app was not running and the `mdopener://` URL was handed to the OS launcher (if the launcher is still running after 10 s, it prints a note and the open is not confirmed). It exits 1 on bad usage, a missing, directory or non-Markdown path (`.md`, `.markdown`, `.mdown`, `.mkd`, `.mdx`, no dotfiles), empty stdin for `-`, a failed launcher, or when the running app refused the file or did not answer within 6 s; stderr says which. `mdopen --hook` exits 0 and prints nothing (another argument with it is bad usage, exit 1); it opens only the Markdown file that a successful Write, Edit or MultiEdit names. Preferences, AI agents (MCP), Auto-open agent Markdown adds that hook to `~/.claude/settings.json`. Rules: https://github.com/ashlrai/ashlr-md/blob/main/docs/AGENTS.md#auto-open-hook The window requires the desktop app. The JSON commands above do not. Deep link, when the app is installed: ```text mdopener://open?path=/absolute/path/to/file.md mdopener://open?path=/absolute/path/to/file.md&mode=edit ``` ## Tools `mdopener-mcp --export-tool-schema` is the source for arguments. Order in `tools/list`: 1. `open_file` starts the app. `path` is required. `mode` is `read` or `edit`. 2. `get_current_content` returns the open document. Error when none is open. 3. `list_recent` lists recent files. The app must already be running. 4. `request_review` blocks for a human verdict. Pass `path` or `content`, or a `review_id` to keep waiting. 5. `get_user_annotations` reads the latest verdict and task checkboxes. Works from disk when the app is closed. 6. `edit_document` replaces one exact `find` with `replace`. `save` defaults to false. 7. `search_vault` searches the watched folder and recents. When the app is closed, `vault` names a directory to search on disk instead. 8. `present_document` switches the open doc to a distraction-free read view. It does not start the app. 9. `list_ai_actions` lists editor AI actions. No app required. 10. `get_conversation_context` reads a saved chat session. No app required. 11. `save_conversation_message` appends one message to that session. No app required. 12. `diff_documents` diffs two Markdown files on disk. No app required. 13. `stream_edit` previews a find/replace as a diff. 14. `stream_edit_apply` applies a preview. 15. `export_text` returns plain text with Markdown syntax stripped. With `path` it reads that file from disk, no app required. 16. `export_metadata` returns headings, front matter, and wikilinks. With `path` it reads that file from disk, no app required. 17. `edit_canvas` edits a `.canvas` file. It writes by default. No app required. 18. `export` exports the open document. Formats: `pdf`, `docx`, `html`, `epub`. With `output_path` the document must be in Read view. PDF takes no `output_path`. 19. `replace_document` replaces the whole open document. 20. `set_content` is the same whole-document replace. Prefer `edit_document` over `set_content` and `replace_document`. The other tools act on the window and need the running app. `open_file` starts it; no other tool does. Details: https://github.com/ashlrai/ashlr-md/blob/main/docs/AGENTS.md#how-it-works-the-ipc-model `open_file` arguments: ```json {"path": "samples/agent-plan.md", "mode": "read"} ``` `edit_document` arguments. `find` must occur once: ```json {"find": "## Phase 1: Core", "replace": "## Phase 1: Foundation", "path": "samples/agent-plan.md", "save": false} ``` `request_review` arguments: ```json {"path": "samples/agent-plan.md", "blocking": true} ``` A blocking call returns `verdict` of `approved`, `changes_requested`, `dismissed`, `timeout`, or `superseded`, or `status` `pending` with a `reviewId` when the wait ends first. Call `request_review` again with that `review_id` to keep waiting. `export` arguments. HTML, DOCX, and EPUB can take `output_path` in an existing directory; the app then writes the file without a dialog, which needs Read view, so call `open_file` with `"mode": "read"` first. Without `output_path` the app opens its export dialog. PDF always opens the system print dialog. An existing file is replaced only with `"overwrite": true`. ```json {"format": "html", "output_path": "/tmp/agent-plan.html", "overwrite": false} ``` Prompts you can hand an agent: ```text Open samples/agent-plan.md in Ashlr MD with open_file, then show get_current_content. ``` ```text Call edit_document on the open document. find must match once. Then request_review and wait for my verdict. ``` ## Resources The server also answers `resources/list`, `resources/templates/list`, and `resources/read`. Order in `resources/list`: - `mdopener://current` is the open document as Markdown. Error `-32002` when none is open, `-32000` when the app is not running. - `text://vault-search` is `search_vault` as a resource. Read `text://vault-search?q=`, with optional `&limit=` (1 to 200), `&vault=`, and `&semantic=false` or `true`. Without `&vault=` it needs the running app. It is also the one template in `resources/templates/list`. - `mdopener://recent-documents` lists recent files that still exist, each with `path`, `title`, `mtimeMs`, and a 200-character `preview`. - `file://` entries follow, one per Markdown file in the app's watched folder. `resources/read` reads only paths the app lists in the vault or recents. Open any other file with `open_file` first. ## Prompts `prompts/list` and `prompts/get` serve three prompts. Each returns one `user` message: the instruction, then the open document. None takes arguments. With no document open, `prompts/get` returns `-32002`. - `summarize` asks for the document's key points as a short bulleted list. - `review_plan` reviews the document as a plan and flags risks, gaps, and unclear steps. - `improve_writing` tightens the prose without changing its meaning. Full rules: https://github.com/ashlrai/ashlr-md/blob/main/docs/AGENTS.md#resources-reference ## Local AI Nothing is sent to a cloud model unless the person opts in. - macOS 26 or later on Apple Silicon: Apple Foundation Models, after Apple Intelligence is on. No API key. - Other machines: Ollama, or a `localInference` block in `~/.ashlr/config.json`. - `ANTHROPIC_BASE_URL` defaults to `https://api.anthropic.com`. `https://` to any host is accepted. Plain `http://` is accepted only for `127.0.0.1` and `[::1]`. Refusals send no request and do not repeat the value. - `OLLAMA_HOST` for the app defaults to `http://localhost:11434`. A remote host needs `localInference.allowRemote: true` and `https://`. The environment cannot allow a remote host by itself. - The MCP sidecar's default, when `OLLAMA_HOST` is unset, is `http://127.0.0.1:11434`. It refuses `http://localhost`. - The default local model name is `qwen3.8:27b`. Names containing `abliterat` or `uncensored` are refused. No API key is sent to a `localInference` URL. - `"offline": true` on that block refuses cloud calls, including through a loopback gateway. Full rules: https://github.com/ashlrai/ashlr-md/blob/main/docs/local-ai.md ```bash mdopener-mcp doctor --json mdopener-mcp setup --local --json ``` ## Phantom Phantom calls `mdopen` for `phm inbox show --open` and `phm digest --open` when Ashlr MD is installed. The URL scheme is `mdopener://`. Under `phantom exec -- `, keys arrive as `phm_` placeholders. Set `ASHLR_MD_ANTHROPIC_KEY_FROM_ENV=1` to read `ANTHROPIC_API_KEY` from the environment. A `phm_` placeholder is honored only when the base URL is the session proxy. Contract: https://github.com/ashlrai/ashlr-md/blob/main/docs/PHANTOM.md ## Security, short The IPC server binds to `127.0.0.1`. The token file is `~/.mdopener/ipc-token`. Tools that take a path open Markdown documents that are not dotfiles. `mdopener-mcp doctor --fix` never changes `ipc-token`. Run `chmod 600 ~/.mdopener/ipc-token` yourself when doctor says to. Threat model: https://github.com/ashlrai/ashlr-md/blob/main/SECURITY.md ## Part of Ashlr Ashlr MD is the Markdown workbench in the AshlrAI open-source ecosystem (https://github.com/ashlrai#the-open-source-ecosystem). An agent can open, edit and export Markdown over MCP, then hand it to a person for review. Phantom (https://phm.dev) can open its inbox and digest in Ashlr MD. Ashlr MD also works without Phantom. Agents maintain this repository. Phantom (`phm improve`) and other coding agents open pull requests, merge them once the required checks pass, and fix `main` forward. Rules: https://github.com/ashlrai/ashlr-md/blob/main/AGENTS.md. Checks: https://github.com/ashlrai/ashlr-md/blob/main/CONTRIBUTING.md To contribute, as a person or with a coding agent: fork the repository, branch from `main`, run `bun install --frozen-lockfile` (it installs what `bun.lock` pins, as CI does), make one small change, then run `scripts/ci-local.sh upstream/main` (it always runs typecheck, Biome, the crypto policy, version sync, doc links and the conflict and selector tests, and uses `scripts/ci/select.mjs` to add Vitest on changed files and `cargo clippy` plus `cargo test` on affected crates when the diff needs them). It does not run the two diff secret scans (Gitleaks and the secret-shape scan), which both block the required check; the walkthrough shows how to run them locally. It also skips five steps of the required check's fast job: `bun run test:unit` (its punctuation test fails on an em or en dash, even in Markdown docs), the CI gate regression tests, the dependency plan parser tests, the npm script path test and `bun run check:workflow-bash`; the walkthrough lists the commands. Many docs double as test fixtures: a test checks their examples, headings, counts or lists against the code, and no pull request job runs those tests on a docs-only diff. After editing `README.md`, `ROADMAP.md`, `llms.txt`, the landing page or a guide in `docs/`, run the test that reads it (`src/docFacts.test.ts` reads most of them, via `bunx vitest run --project unit src/docFacts.test.ts`); the walkthrough has the full table. Push to your fork and open a pull request against `main`. `Check (Linux)` is the one required check; once it is green the pull request merges through auto-merge and the merge queue. On a fork pull request a maintainer or fleet agent arms auto-merge. Walkthrough: https://github.com/ashlrai/ashlr-md/blob/main/CONTRIBUTING.md#contribute-with-an-agent ## Repo map | Path | What | |---|---| | `src/` | React frontend | | `src-tauri/src/` | Rust app core | | `src-tauri/bins/` | `mdopen`, `mdopener-mcp`, macOS Swift sidecars | | `docs/AGENTS.md` | MCP tool contract | | `docs/EXAMPLES.md` | pasteable commands | | `landing/` | marketing site | License: MIT. https://github.com/ashlrai/ashlr-md