MD-Easy server
MD-Easy serves .md files from a directory and exposes a refresh hook so when an agent (or any process) updates markdown, the browser view refetches without a full reload and keeps the user’s place. Links between .md files in written content are rewritten so they open in the doc viewer (working links).
When to use this skill
- •The user wants to browse project markdown (plans, CLAUDE.md, docs) while an AI edits them.
- •You are editing or creating
.mdfiles and the user may have the MD-Easy UI open. - •The user asks how to run the doc server or how to trigger a refresh after changes.
Running the server
From repo (serve project root as doc root):
pip install -r src/requirements.txt cd src && DOC_ROOT=.. python server.py # Open http://localhost:8765
Custom doc root and port:
DOC_ROOT=/path/to/docs PORT=8765 python src/server.py
Docker:
docker run -p 8765:8765 -v /path/to/docs:/docs md-easy
Host and API key: By default the server binds to localhost (127.0.0.1) and the refresh hook can be open. If the user sets HOST (e.g. HOST=0.0.0.0 to accept LAN connections), the server binds to that address and requires REFRESH_API_KEY to be set; startup fails otherwise. So: localhost = no key required; non-local binding = API key required.
Key env: DOC_ROOT, PORT (default 8765), THEME, HOST (optional; if set, bind there and require REFRESH_API_KEY), BASE_URL (optional; default http://localhost:PORT — used for link generation), REFRESH_API_KEY (see below).
Calling the refresh hook (after editing markdown)
After you create or modify any .md file under the server’s DOC_ROOT, call the refresh hook so the UI refetches and stays in sync.
If REFRESH_API_KEY is not set (e.g. local only):
curl -X POST http://localhost:8765/refresh
If REFRESH_API_KEY is set (recommended for exposed instances), send the key in one of these headers:
- •
X-API-Key: <key> - •
Authorization: Bearer <key>
# Prefer using env so the key is not in command history
curl -X POST http://localhost:8765/refresh -H "X-API-Key: $REFRESH_API_KEY"
# Optional JSON body
curl -X POST http://localhost:8765/refresh -H "X-API-Key: $REFRESH_API_KEY" \
-H "Content-Type: application/json" -d '{"reason": "Updated CLAUDE.md"}'
# Refresh and point the viewer at a specific doc/section (navigate + highlight)
curl -X POST http://localhost:8765/refresh -H "X-API-Key: $REFRESH_API_KEY" \
-H "Content-Type: application/json" -d '{"reason": "Updated plan", "navigate_path": "docs/plan.md", "navigate_fragment": "implementation", "highlight": true}'
Optional body fields: reason (string); navigate_path (doc path to open after refresh); navigate_fragment (heading ID to scroll to and highlight); highlight (boolean, default true). When navigate_path is set, the viewer opens that doc and, if navigate_fragment is set, scrolls to that section and briefly highlights it. Use this after updating a doc so the user is taken to the relevant section.
Use the same host/port the user runs the server on (default http://localhost:8765). Without a valid key when REFRESH_API_KEY is set, the server returns 401.
Working links to other .md files
When you write markdown that links to other docs, use relative paths so the server can turn them into working doc-viewer links:
- •Same directory:
[Other doc](other.md)or[Other](./other.md). - •Subdirectory:
[Guide](subdir/guide.md). - •Parent / root:
[README](../README.md)or[Index](/README.md).
The server rewrites such links to {baseUrl}/#/{path} so they open in the same viewer. By default baseUrl is http://localhost:{PORT}; if the user runs with a different host (e.g. HOST=0.0.0.0 and BASE_URL=http://192.168.1.5:8765), get the base from GET /api/config (baseUrl) and use it when you need to output a shareable doc URL. Do not hardcode localhost in shareable links when the server is not on localhost.
Section links (in-doc and cross-doc)
Headings get slugified IDs (e.g. ## API Reference → #api-reference). Use them so the viewer scrolls to a section and briefly highlights it:
- •In-doc:
[Section name](#section-id)— same file (e.g.[API Reference](#api-reference)). - •Cross-doc:
[Section](path/to/doc.md#section-id)— opens that doc and scrolls to the section.
Use lowercase, hyphenated IDs. Shareable URLs: {baseUrl}/#/path/to/doc.md#section-id.
Workflow for AI agents
- •User has MD-Easy running (or you help them start it with the commands above).
- •You edit or create
.mdfiles under the server’sDOC_ROOT. Use relative.mdlinks and section fragments (e.g.doc.md#section-id) so they work in the viewer. - •After saving changes, call
POST /refresh(withX-API-KeyorAuthorization: Bearerif the server usesREFRESH_API_KEY). Optionally sendnavigate_pathandnavigate_fragmentso the viewer opens that doc and scrolls to that section with a brief highlight (e.g. after updating a plan, point the user at the “Implementation” section). - •The browser view updates; the user’s current file and scroll position are preserved unless that file was removed or you set
navigate_path.
For full API, env vars, and Docker details, see README.md.