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 分