md-vision

io.github.japlete由 GitHub 账号 japlete 发布v0.2.1更新于 Oct 24, 2026

Read markdown with inlined images and index headings for agentic RAG workflows.

已验证STDIO仅桌面文件与存储知识与记忆

概览

AI 生成的概览

只读的 stdio MCP 服务器,让助手为 markdown 建立标题索引,并在读取时把引用的图片内联为图像块。

可以做什么
  • 索引标题:为 markdown 文件、URL 或文件夹生成紧凑的标题索引,含 frontmatter、起始行、图片数与字符数。
  • 读取带图 markdown:把文档返回为交替的文本块与图像块,可限定某个章节或行范围。
  • 按需导航:先索引结构,再只读取需要的章节,便于定向检索。
适用场景
适合助手处理含图表或截图的 markdown 文档,且希望不必为每张图片单独调用工具的场景。也适合需要先建立标题索引再做定向读取的 agentic RAG 流程。
运行要求
通过 npx 从 npm 包 md-vision 在本地运行,需要 Node.js 20 或更高版本。必须至少传入一个 --allow-path 目录和一个 --allow-domain 值(all、none 或具体主机),否则服务器启动即退出。修改配置后需重启 MCP 主机。
安装前请注意
工具为只读,但会读取本地文件并可抓取远程 URL。请把 --allow-path 限定为打算暴露的文档目录;--allow-domain all 会允许任意 HTTP(S) 主机,建议改为列出具体域名。远程 markdown 及其图片来自第三方主机。

安装

在 SourceWeft 中

  1. 打开 控制台中的 md-vision,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

md-vision MCP server

stdio MCP server with two read-only tools for agentic RAG over markdown documentation:

  • read_md_with_images — return markdown with referenced images as interleaved image blocks. Avoids an extra tool call for each image to read. Optionally scoped to a specific section or line range.
  • index_md — return a compact heading index for a file, URL, or folder of markdown files. Used to dynamically index files for targeted reads.

Typical flow: call index_md to discover headings and structure, then read_md_with_images on the sections you need.

Install: MCP client configuration

Published package: md-vision on npm

In your agent config (.agents/mcp.json or similar), point your MCP host at the server. Example:

json
{  "mcpServers": {    "md-vision": {      "command": "npx",      "args": [        "md-vision",        "--allow-path",        "/absolute/path/to/docs",        "--allow-domain",        "none"      ]    }  }}

With remote markdown (allow all HTTP(S) hosts, or list specific domains):

json
{  "mcpServers": {    "md-vision": {      "command": "npx",      "args": [        "md-vision",        "--allow-path",        "/absolute/path/to/docs",        "--allow-domain",        "all"      ]    }  }}
json
{  "mcpServers": {    "md-vision": {      "command": "npx",      "args": [        "md-vision",        "--allow-path",        "/absolute/path/to/docs",        "--allow-domain",        "raw.githubusercontent.com"      ]    }  }}

The server exits on startup if --allow-path or --allow-domain is omitted.

Restart the MCP host after changing configuration.

Restricting allowed paths and domains

FlagRequiredEffect
--allow-path <dir>Yes (at least one)Local files must resolve under one of the allowed directories (repeatable).
--allow-domain <host>Yes (at least one)Controls HTTP(S) access. Use all to allow any host, none to disable URLs (local files only), or list specific hosts (repeatable; suffix match supported, e.g. example.com allows docs.example.com).

Equivalent forms: --allow-path=/path, --allow-domain=host.example, --allow-domain=all, --allow-domain=none.

Do not pass a bare * as a separate shell argument — the shell expands it to filenames in the current directory. Use all or --allow-domain=all instead.

Requirements

  • Node.js 20+

Tools

read_md_with_images

Read a markdown file and inline referenced images as MCP image content.

ParameterTypeDescription
uristringLocal path or http(s):// URL
sectionstring, optionalExact heading to read, e.g. ## Introduction (used when matched; otherwise falls back to line_range)
line_range[start, end], optionalInclusive 1-based document line range (used when section is omitted or not found)
max_imagesinteger, optionalMax images to inline (default 10, max 50)

Returns: MCP content array — alternating text and image blocks (PNG, base64) in document order; frontmatter preserved in the leading text. Before each inlined image, a short text block carries the resolved image URL (omitted for data: URIs and other long references). Images beyond max_images stay as markdown image syntax in text.

URI forms: local filesystem paths and http(s):// URLs. Local paths must fall under a configured --allow-path directory. Relative image paths resolve against the markdown file location or document URL. Images may use markdown ![](...) syntax or HTML <img src="..."> tags.

index_md

Index headings for navigation before targeted reads.

ParameterTypeDescription
uristringMarkdown file, http(s):// URL, or local folder

Returns: Markdown string. For each file:

  1. YAML frontmatter when present.
  2. A fenced tsv code block with columns: heading, line_start, n_images, char_count.

Each file is wrapped in:

xml
<file path="..." lines=X chars=Y>...</file>

Folder uri values are scanned recursively for *.md / *.markdown in stable sorted order. Headings inside fenced code blocks are not indexed.

Note on deploying agents with this MCP server

stdio MCP servers run as subprocesses of the agent runtime that invokes them. There are two deployment patterns commonly used:

  • Agent-in-sandbox (runtime shares the agent’s filesystem): the server can read docs in-place; scope --allow-path to the documentation tree you intend to expose.
  • Sandbox-as-tool (runtime filesystem differs from the tool sandbox): the MCP process usually runs in the runtime environment, so markdown must be copied or synced where the server can read it.

Benchmark (WIP)

See benchmark/ for the MMLongBench-Doc A/B harness comparing filesystem-only agentic RAG against the same agent with md-vision MCP tools.

Standalone indexing

md-vision can also be used as a library when you want to index markdown outside an MCP host — for example in an offline preprocessing pipeline for agentic RAG.

Install the package:

bash
npm install md-vision

Index markdown text

Use indexMarkdownText when you already have markdown content in memory.

ts
import { indexMarkdownText } from "md-vision";
const markdown = `# Guide
Intro text.
## Setup
![diagram](./setup.png)`;
const index = indexMarkdownText(markdown);
console.log(index.rows);

Example result:

ts
[  {    heading: "# Guide",    lineStart: 1,    imageCount: 1,    charCount: 42  },  {    heading: "## Setup",    lineStart: 5,    imageCount: 1,    charCount: 24  }]

Index a file

Use indexMarkdownFile to load and index a local markdown file.

ts
import { indexMarkdownFile } from "md-vision";
const index = await indexMarkdownFile("./docs/guide.md");
await saveToVectorStoreMetadata({  path: index.path,  frontmatter: index.frontmatter,  headings: index.rows,});

Index a folder

Use indexMarkdownFolder to recursively index *.md and *.markdown files in stable sorted order.

ts
import { indexMarkdownFolder } from "md-vision";
const files = await indexMarkdownFolder("./docs");
for (const file of files) {  console.log(file.path, file.rows);}

Output shape

Each indexed file returns structured data:

ts
type MarkdownFileIndex = {  path?: string;  frontmatter: string;  lineCount: number;  charCount: number;  rows: HeadingIndexRow[];};
type HeadingIndexRow = {  heading: string;  lineStart: number;  imageCount: number;  charCount: number;};

Headings inside fenced code blocks are ignored because indexing uses the markdown AST rather than regex matching.

来源:README.md,提交 4445673

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分