SuperAPIAI Directory

md-vision-mcp

github.com · AI images

Read Markdown with inlined images and heading indexes for agentic RAG over local docs or allowed URLs.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose

md-vision-mcp is a stdio MCP server that provides two read-only tools for agentic RAG (retrieval-augmented generation) over Markdown documents. It is designed to help AI agents efficiently read and index Markdown documents that contain images, avoiding a separate tool call for each image.

Main capabilities

The server provides two tools:

  • read_md_with_images: Reads a Markdown file and returns referenced images as inline image blocks (MCP image content). The return value is an MCP content array, with text blocks and image blocks (PNG, base64-encoded) alternating in document order, and frontmatter preserved in the leading text. Each inline image is preceded by a short text block carrying the resolved image URL (omitted for data: URIs and other long references). Images beyond max_images are still preserved in the text as Markdown image syntax. Supports local filesystem paths and http(s):// URLs. Local paths must be under the configured --allow-path directory. Relative image paths are resolved relative to the Markdown file location or the document URL. Images may use Markdown syntax or HTML <img src="..."> tags. Optionally scoped to a specific section or line range.

  • index_md: Returns a compact heading index for a file, URL, or Markdown folder. Returns a Markdown string. For each file, includes: YAML frontmatter (if present); a fenced tsv code block with columns heading, line_start, n_images, char_count. Each file is wrapped in a specific structure. A folder URI value recursively scans *.md / *.markdown files, processing them in a stable sort order. Headings inside fenced code blocks are not indexed.

Typical flow: first call index_md to discover headings and structure, then call read_md_with_images for the required sections.

Usage

Installation: via MCP client configuration. Published package: md-vision on npm.

In agent configuration (such as .agents/mcp.json or similar file), point the MCP host at that server. The example configuration supports remote Markdown (allow all HTTP(S) hosts, or list specific domains).

The server exits at startup if --allow-path or --allow-domain is omitted. The MCP host must be restarted after changing the configuration.

Restricting allowed paths and domains: equivalent forms include --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 will expand it to filenames in the current directory. Use all or --allow-domain=all instead.

When to use

  • Agentic RAG over local documents or allowed URLs.
  • Scenarios that need to read Markdown documents containing inline images and want to reduce the number of tool calls.
  • Document navigation scenarios that need to index the heading structure first before targeted reading.

Limitations

  • The server exits at startup if --allow-path or --allow-domain is omitted.
  • Local paths must be under the configured --allow-path directory.
  • Do not pass a bare * as a separate shell argument.
  • Headings inside fenced code blocks are not indexed.
  • Images beyond max_images remain in the text as Markdown image syntax.

Deployment notes

A stdio MCP server runs as a child process of the agent runtime that invokes it. Two deployment patterns are common:

  • Agent-in-sandbox (the runtime shares the agent's filesystem): the server can read documents in place; scope --allow-path to the document tree you intend to expose.
  • Sandbox-as-tool (the runtime filesystem differs from the tool sandbox): the MCP process usually runs in the runtime environment, so Markdown must be copied or synced to a location the server can read.

Benchmark (in progress)

See the MMLongBench-Doc A/B testing framework in the benchmark/ directory, comparing filesystem-only agentic RAG with the same agent using the md-vision MCP tools.

Standalone indexing

md-vision can also be used as a library to index Markdown outside an MCP host—for example, an offline preprocessing pipeline for agentic RAG.

After installing the package, use indexMarkdownText to index Markdown content in memory, indexMarkdownFile to load and index a local Markdown file, and indexMarkdownFolder to recursively index *.md and *.markdown files (in stable sorted order). Each indexed file returns structured data. Indexing uses the Markdown AST rather than regex matching, so headings inside fenced code blocks are ignored.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools