md-redline
md-redline
用于 Markdown 规范、提示词和设计文档的行内审阅评论。
在渲染文档中高亮文本并留下评论,您的 AI 智能体可以直接读取并处理这些评论。评论以不可见的 HTML 标记形式存储在 .md 文件本身中。无需附属文件,无需数据库,无需外部服务。Markdown 文件始终是事实的唯一来源。
借助内置的 MCP 服务器,您的智能体可以在任务中途请求审阅,并暂停直到您点击 发送审阅 (Send review)。您留下反馈后,智能体将从中断处继续工作。无需复制粘贴,无需切换上下文。

30 秒了解完整的审阅工作流:
https://github.com/user-attachments/assets/7f493201-3aca-489c-86f0-3a7df454f693
适用于 Claude Code、Claude Desktop、Codex CLI、Gemini CLI 以及任何支持 stdio 服务器的 MCP 客户端。正如 Sean Grove 在 specs are the new code 中所言,规范正成为智能体开发中的主要工作单元。mdr 为该工作流提供了类似于代码审查的审阅工具。
快速开始
前提条件:Node 20 或更高版本。
npx md-redline /path/to/spec.md如果需要,这将启动本地应用程序并在浏览器中打开它。
或者全局安装:
npm install -g md-redline
mdr /path/to/spec.md # Open a file
mdr /path/to/dir # Open a directory
mdr --stop # Stop the running servermd-redline 也可以作为 mdr 的别名使用。
Related MCP server: pad-core
MCP 设置
向您的智能体注册 MCP 服务器,以便它可以在任务中途请求审阅。
Claude Code 或 Claude Desktop
mdr mcp install # register with both clients (default)
mdr mcp install --claude-code # just Claude Code (via `claude mcp add`)
mdr mcp install --claude-desktop # just Claude Desktop (JSON config file)Codex CLI
codex mcp add md-redline -- mdr mcpGemini CLI
gemini mcp add --scope user md-redline mdr mcp--scope user 标志很重要。Gemini 默认为项目级作用域,这只会为当前目录注册 mdr。
其他 MCP 客户端
将此服务器条目添加到客户端的 MCP 配置文件中:
{
"mcpServers": {
"md-redline": {
"command": "mdr",
"args": ["mcp"]
}
}
}前提条件:mdr 必须在您的 PATH 中(例如通过 npm install -g md-redline)。如果您的客户端在生成子进程时没有继承 shell 的 PATH,请使用 which mdr 得到的绝对路径作为 command 的值。
审阅工作流
使用 MCP(推荐)
注册后,要求您的智能体请求审阅:
"在继续之前,请让我先在 mdr 中审阅 docs/specs/feature-x.md。"
智能体调用 mdr_request_review,mdr 打开文件,您高亮文本并留下评论,然后点击 发送审阅 (Send review)。智能体将以结构化提示词的形式接收您的反馈,并开始处理您的评论。审阅是按需选择的。智能体仅在您要求时才会暂停。
不使用 MCP
使用
mdr /path/to/spec.md打开 markdown 文件。高亮文本并留下行内评论。
复制移交提示词 (hand-off prompt)。
将提示词粘贴到您的 AI 智能体中。
智能体编辑文件,处理反馈,并删除它已处理的评论标记。
在差异视图中查看结果。
可选:解决工作流
在设置中启用解决模式,以进行具有明确 open(打开)和 resolved(已解决)状态的人工审阅。
适用人群
在本地编写规范、提示词或设计文档并使用基于文件的 AI 智能体的人员
在提交或发送进行更广泛审阅之前审阅文档的团队
任何处于人机协作编辑循环中,希望在纯文本文件中获得结构化行内反馈的人
非目标
不是协作式多用户编辑工具。
不是 GitHub PR 审查的替代品(文件进入 git 后请使用 PR 审查)。
不适用于不受信任的内容。这是一个供您个人文件使用的本地开发工具。
评论如何存储
评论以不可见的 HTML 标记形式直接存储在 markdown 中,位于它们所引用的文本之前,因此人类和智能体都可以基于同一个文件工作。
Some text <!-- @comment{
"id":"uuid",
"anchor":"highlighted text",
"text":"Rewrite this section to be clearer.",
"author":"User",
"timestamp":"2026-03-26T12:00:00.000Z",
"replies":[]
} -->highlighted text continues here.这使得反馈:
通过纯文件读取对 AI 智能体可见
可随 markdown 文件携带
在普通渲染器(GitHub、VS Code 预览)中不可见
功能
审阅与评论
锚定到渲染文本的行内评论,包括重叠评论
线程化回复和可选的
open/resolved审阅状态带有拖动句柄的可调整锚点
渲染视图、原始视图和差异视图
用于单个或多个文件的移交提示词复制
导航与编辑
具有会话持久性和标签页上下文菜单的多标签页编辑
文件资源管理器、最近文件和原生 OS 文件选择器
文档内查找 (
Cmd+F) 及匹配导航带有滚动跟踪的目录
命令面板 (
Cmd+K)、键盘快捷键和设置面板 (Cmd+,)可调整大小的面板和右键上下文菜单
渲染与集成
当文件在外部更改时,通过 SSE 实现实时重载
带有可评论文本的 Mermaid 图表渲染
本地图片嵌入和 markdown 文件之间的可点击链接
可自定义的评论模板
8 种主题:浅色、深色、棕褐色、Nord、Solarized、GitHub、Rosé Pine、Catppuccin
支持的平台
macOS:支持
Linux:支持;系统文件选择器需要
zenityWindows:支持;系统文件选择器使用 PowerShell
权限
默认情况下,md-redline 可以读取您主目录中的任何 markdown 文件。您第一次运行 mdr 时(或在从没有 trusted-roots 功能的版本升级后的第一次),您的主文件夹会被添加到 ~/.md-redline.json 中的受信任根目录列表中。主目录之外的文件(/tmp、挂载的卷、系统路径)在您第一次打开它们时,需要通过 OS 文件夹选择器明确授予权限。授予的文件夹会在重启后被记住。
若要改用严格的按文件夹模型,请在安装后运行一次 mdr --restrict。这将创建一个没有默认信任的 ~/.md-redline.json,您将在第一次打开其中的文件时明确授予每个文件夹权限。
文件保存使用原子写入后重命名和基于 mtime 的冲突检测,以防止并发编辑导致的数据丢失。Mermaid SVG 输出在渲染前会通过 DOMPurify 进行清理。请仅在您信任的环境中运行 md-redline。
开发
从源码构建
git clone https://github.com/dejuknow/md-redline.git
cd md-redline
npm install
npm run dev打开 Vite 打印的本地 URL(通常是 http://localhost:5188)。
脚本
npm run dev # Start dev server
npm run lint # Lint
npm test # Production build + unit tests
npm run test:e2e # Playwright E2E tests
npm run build # Production build智能体评估
评估工具集用于测试 AI 智能体是否正确读取、处理和删除行内评论。
npm run eval:dry验证评估夹具npm run eval运行完整的评估工具集详情请参阅 eval/README.md
架构
bin/md-redline CLI entry point (invoked as `mdr` or `md-redline`)
server/index.ts Hono server for file I/O, browsing, SSE, and local integrations
src/App.tsx Main application shell
src/components/ Viewer, sidebar, raw view, diff view, TOC, explorer, settings, etc.
src/hooks/ State, persistence, selection, file watching, drag handles, tabs
src/lib/comment-parser.ts Inline comment parsing and mutation helpers
src/markdown/pipeline.ts Markdown rendering pipeline
eval/ Eval harness for agent behavior against inline comments
e2e/ Playwright end-to-end coverage许可证
Available Tools
6 toolsmdr_add_filesA
Add markdown files to a review session that is already open in mdr (md-redline), without starting a new one. Use it when the reviewer asks for another file mid-review, or when you need to comment on a file the session does not cover yet. Works for sessions from mdr_request_review and mdr_comment alike. The reviewer's mdr tab opens the new files. Returns immediately; carry on with the same sessionId as before. A session that has ended cannot take more files: start a new review instead.
Inputs: filePaths (required), sessionId (required).
mdr_askA
Ask the user one or more questions anchored to specific text in a file inside an active review session. Each question becomes an inline marker the user sees and can reply to in the md-redline UI. Returns with the reply text as soon as the user has answered every question, or with whatever partial replies exist when they finish the review (Done / Finish review), or empty-handed if the session ends another way. Replies also land in the marker threads on disk, so when this tool returns without reply text you should re-read the file(s) before concluding the user did not answer. Use this when a comment is unclear, or when you hit a planning fork while editing. Prefer asking over guessing when the right answer would meaningfully change your edit.
Only one mdr_ask can be pending per session at a time. If this returns "a previous mdr_ask is still pending", post a reply to the prior question via mdr_comment — pass this same sessionId plus a replies: payload targeting that commentId, which resolves the pending ask in-place without opening a second session — and then retry mdr_ask with your new questions.
Inputs: questions (required), sessionId (required).
mdr_baselineA
Call this BEFORE you edit markdown files the user will later review in mdr (md-redline). It saves a copy of each file as it is right now so the reviewer's diff can show exactly what you changed. Returns immediately. Include files you are about to create (their folder must already exist); they are saved as empty. Do not call it after you have already edited a file: the copy would already contain your changes. Workflow: mdr_baseline (before editing) -> edit the files -> mdr_request_review. At most 64 files per call. If the reviewer already has a before point for a file from an earlier handoff or review, that one is kept.
Inputs: filePaths (required), agentName.
mdr_commentA
Post YOUR OWN comments into markdown files for the user to read. Use this when the user asks YOU to review a doc and leave feedback on it.
If instead the user wants to review a doc THEMSELVES and have you address what they write ("I want to review X in mdr", "let me review X", "open X so I can comment"), call mdr_request_review, NOT this tool. The word "review" in those requests describes what the user is about to do, not what you should do. This tool writes your comments into their file, which is the opposite of what they asked for.
Returns IMMEDIATELY after posting (never blocks). In the filePaths form the returned sessionId MUST be passed to mdr_wait afterward to block until the user clicks Done — that is a two-tool flow: mdr_comment (post) → mdr_wait (block). This does NOT apply to the sessionId form below, which posts into a session you did not open; mdr_wait rejects user-origin sessions. Skipping mdr_wait leaves a banner on the user's screen until they click Done; you will not see their replies or edits before continuing, and any user feedback will be invisible to you for this turn.
The comments appear as inline markers anchored to specific text, which the user can then address.
Comments are anchored to exact text in the rendered document (not the raw markdown). For text inside Mermaid diagrams or markdown-formatted spans, the renderer will fall back to label/stripped matching.
Include author on each comment/reply identifying yourself (e.g. 'Claude', 'Codex', 'Gemini'). This appears in the mdr UI so the user knows which agent left the feedback.
To reply inside a review the user already has open — the session from an mdr_request_review handoff, or one this tool returned earlier — pass sessionId instead of filePaths. The batch lands in that session and no second tab or banner appears. Use it whenever you are replying as you work rather than posting a fresh review; the filePaths form always opens its own session.
Inputs: replies, comments, filePaths, sessionId, +1 more.
mdr_request_reviewA
Open markdown files in mdr (md-redline) so the USER can review them and leave comments for you to address, or continue an existing review session. Use this whenever the user wants to read, review, or comment on a doc themselves, including phrasings like "I want to review X in mdr", "open X so I can comment", or "let me look at X". The user is the reviewer here; you wait and then address what they write. To start a new review, pass filePaths. If you are about to edit or create files the user will review, call mdr_baseline before touching them so the user can see a diff of your changes. Calling it after you have edited does not help: the copy would already include your edits. To continue after addressing a batch of comments, or to re-poll while the user is still reviewing, pass the sessionId from the previous result (without filePaths). If the result says the user has not finished yet, call again with the same sessionId to keep waiting. IMPORTANT: while this tool is waiting (no "batch" or "done" result has arrived yet, or you are between batches), you do not have permission to read, open, edit, or otherwise act on the files under review using other tools. The user is actively writing @comment markers into those files; reading them yourself will surface unsubmitted markers you must not address. Once a "batch" or "done" result arrives you may read/edit the files, but only to address the comments listed in that result — ignore any other @comment markers you encounter in the file.
Inputs: filePaths, sessionId, enableResolve.
mdr_waitA
Block until the user has finished engaging with an mdr_comment session. Call this once after you have posted all your feedback batches via mdr_comment. Returns when the user clicks Done in the mdr UI. If the wait times out (90s), returns {status:"pending"} — call mdr_wait again with the same sessionId to keep waiting. After this returns {status:"done"}, read the file(s) to see the user's replies, deletions, and resolutions.
Inputs: sessionId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
The tools are mostly distinct: mdr_request_review is for user-led review, mdr_comment for agent-led feedback, mdr_ask for questions, and the others each have a clear single purpose. mdr_request_review and mdr_comment could be confused at a glance since both involve 'review', but the descriptions explicitly and thoroughly disambiguate them.
All tools share the mdr_ prefix and snake_case convention, which gives a strong cohesive feel. However, the suffixes mix patterns: verb_noun (request_review, add_files), a noun used as verb (baseline), and bare verbs (ask, comment, wait), so the verb_noun pattern is not uniform.
Six tools is well-scoped for a review-collaboration domain. Each tool covers a distinct step in the workflow—starting/continuing reviews, adding files, baselining, asking, commenting, and waiting—without redundancy or bloat.
The tool set covers the full lifecycle of both review directions: user reviewing with agent addressing (request_review, baseline, add_files, ask, comment) and agent reviewing for the user (comment, wait). No obvious dead ends or missing operations for the stated purpose.
Maintenance
Related MCP Connectors
Agents publish Markdown docs; people comment inline; agents revise. Open source (AGPL).
MarkupBase turns AI-generated Markdown and HTML into durable, versioned artifacts that people can review and discuss. Its MCP server lets agents publish new versions, preserve contextual comments, include hosted images, and respond to feedback through secure account-linked identities, creating a clear human review boundary without requiring real-time editing.
Human-in-the-loop document review: an agent pushes a draft, a person comments, the agent revises.
MEOK AGENTS.md Linter MCP — validates the cross-vendor coding-agent spec (Cursor / Claude Code /
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA local-first markdown review tool with MCP integration, enabling AI and humans to collaboratively annotate documents inline and generate revision prompts.1MIT
- AlicenseNot gradedqualityFmaintenanceMCP server for collaborative markdown editing, allowing agents to write documents and humans to comment, with comments fed back as agent input.MIT
- AlicenseNot gradedqualityDmaintenanceEnables sharing Markdown documents for collaborative review with inline annotations and structured change requests.16 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables anchored comments in Markdown files that AI agents can propose changes for, with human approval before application, all managed via an MCP server.4MIT