md-vision
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:
{
"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):
{
"mcpServers": {
"md-vision": {
"command": "npx",
"args": [
"md-vision",
"--allow-path",
"/absolute/path/to/docs",
"--allow-domain",
"all"
]
}
}
}{
"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
Flag | Required | Effect |
| Yes (at least one) | Local files must resolve under one of the allowed directories (repeatable). |
| Yes (at least one) | Controls HTTP(S) access. Use |
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+
Related MCP server: mcp-server-markdown
Tools
read_md_with_images
Read a markdown file and inline referenced images as MCP image content.
Parameter | Type | Description |
| string | Local path or |
| string, optional | Exact heading to read, e.g. |
|
| Inclusive 1-based document line range (used when |
| integer, optional | Max images to inline (default |
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.
Parameter | Type | Description |
| string | Markdown file, |
Returns: Markdown string. For each file:
YAML frontmatter when present.
A fenced
tsvcode block with columns:heading,line_start,n_images,char_count.
Each file is wrapped in:
<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-pathto 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:
npm install md-visionIndex markdown text
Use indexMarkdownText when you already have markdown content in memory.
import { indexMarkdownText } from "md-vision";
const markdown = `# Guide
Intro text.
## Setup

`;
const index = indexMarkdownText(markdown);
console.log(index.rows);Example result:
[
{
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.
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.
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:
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.
Available Tools
2 toolsindex_mdIndex markdown headingsARead-onlyIdempotent
Index headings in a markdown file, URL, or local folder. Returns frontmatter (if any) and a TSV table of headings, line_start, n_images, char_count; use read_md_with_images to read specific content.
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | Local path, HTTP(S) URL, or local folder to index for markdown headings. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations declare readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. The description adds detail about return format (frontmatter, TSV table) without contradicting annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences: first clearly states the purpose, second adds output details and sibling distinction. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one parameter, full annotations, and no output schema, the description covers purpose, usage guidelines, and return type adequately.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 100% coverage for the single parameter 'uri' with a clear description. The tool description does not add significant new meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states verb 'Index' on resource 'markdown headings', specifies sources (file, URL, folder), and differentiates from sibling tool read_md_with_images by indicating the latter is for reading content.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly indicates when to use this tool (to index headings) and provides an alternative for reading content: 'use read_md_with_images to read specific content.'
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_md_with_imagesRead markdown with imagesARead-onlyIdempotent
Read a markdown file or selected section/range and return the markdown with interleaved image blocks. Use section for an exact heading; if it is missing, line_range is used when provided. Optionally use index_md first to discover headings.
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | Local path or HTTP(S) URL of the markdown file to read. | |
| section | No | Exact heading to read, including marker, for example '## Introduction'. When matched, takes precedence over line_range. | |
| line_range | No | Inclusive 1-based document line range, for example [1, 10]. Used when section is omitted or not found. | |
| max_images | No | Maximum referenced images to inline as image blocks. Defaults to 10. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate the tool is read-only, non-destructive, idempotent, and open-world. The description adds behavioral detail: it interleaves image blocks and clarifies parameter precedence. However, it does not describe the output format in detail or error behavior, which would add further transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise: two sentences that cover purpose and usage guidance without redundancy. Every sentence contributes meaningful information, and it is well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers input parameters and behavior adequately. It mentions optional indexing with index_md. However, there is no output schema, and the description could be more specific about the output format and error handling, leaving some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema description coverage, the schema already documents each parameter. The description adds value by explaining the interaction between section and line_range (precedence) and hints at using index_md for heading discovery, which is not in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool reads a markdown file and returns it with interleaved image blocks. It specifies the resource (markdown file), action (read with images), and differentiates from the sibling tool index_md by mentioning its optional use for heading discovery.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly explains when to use section vs line_range parameters, including the precedence rule. It also recommends using index_md first to discover headings, providing clear context on tool selection and parameter use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
index_md - First observed
read_md_with_images
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one indexes headings and metadata, the other reads content with images. No overlap in functionality.
Both tools follow a consistent verb_noun pattern (index_md, read_md_with_images) using snake_case, making them predictable.
With only 2 tools, the server feels underdeveloped for typical markdown operations. While the tools are focused, a broader scope would justify more tools.
The server covers indexing and reading with images, but lacks essential operations like editing, deleting, or creating markdown content, leaving significant gaps.
Maintenance
Related MCP Connectors
MCP server (stdio): fetch web pages as clean readable markdown via the AgentForge API
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
URL to Markdown or structured JSON (schema.org/OG); renders SPA; batch reads. No signup/key.
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Related MCP Servers
- AlicenseDqualityDmaintenanceAn MCP server that converts Markdown to HTML, supporting both stdio and HTTP interfaces for easy integration with Cursor and other MCP clients.18 npmMIT
- AlicenseAqualityDmaintenanceMCP server for markdown files — search, extract sections, list headings, find code blocks across docs.6135 npm5MIT
- AlicenseNot gradedqualityBmaintenanceLocal-first Markdown vault retrieval for agents. Read-only MCP stdio server exposing search, get, status, and doctor over Obsidian-compatible Markdown with hybrid BM25/vector/wikilink/title retrieval and first-class CJK support.11MIT
- FlicenseNot gradedqualityBmaintenanceReusable, read-only MCP server that exposes a repo's knowledge files (backlog docs, decisions, design notes) as MCP resources over stdio.-