Skip to main content
Glama

Markdownify MCP 服务器

markdownify mcp logo

Markdownify 是一个模型上下文协议 (MCP) 服务器,它将各种文件类型和网页内容转换为 Markdown 格式。它提供了一套工具,可以将 PDF、图像、音频文件、网页等转换为易于阅读和共享的 Markdown 文本。

功能

  • 将多种文件类型转换为 Markdown:

    • PDF

    • 图像

    • 音频(带转录)

    • DOCX

    • XLSX

    • PPTX

  • 将网页内容转换为 Markdown:

    • YouTube 视频转录

    • 必应搜索结果

    • 常规网页

  • 获取现有的 Markdown 文件

Related MCP server: Markdownify MCP Server

入门指南

  1. 克隆此仓库

  2. 安装依赖:

    bun install

    preinstall 步骤会在 .venv 中创建一个 Python 虚拟环境并安装 markitdown[all]。

  3. 构建项目:

    bun run build
  4. 启动服务器:

    bun start

开发

  • 使用 bun run dev 以监视模式启动 TypeScript 编译器

  • 修改 src/server.ts 以自定义服务器行为

  • 在 src/tools.ts 中添加或修改工具

在桌面应用中使用

要将此服务器与桌面应用集成,请将以下内容添加到应用的服务器配置中:

{
  "mcpServers": {
    "markdownify": {
      "command": "node",
      "args": [
        "{ABSOLUTE PATH TO FILE HERE}/dist/index.js"
      ]
    }
  }
}

环境变量

所有路径均默认为合理的值;仅在默认值不符合您的安装布局时才进行覆盖。

变量

默认值

用途

MARKITDOWN_PATH

<project>/.venv/bin/markitdown,然后在 PATH 中查找 markitdown

markitdown 可执行文件的绝对路径。当您在系统范围内安装了 markitdown(例如 pipx install "markitdown[pdf]")而不是使用捆绑的 venv 时,请设置此项。

REPOMIX_PATH

<project>/node_modules/.bin/repomix,然后在 PATH 中查找 repomix

git-repo-to-markdown 使用的 repomix 可执行文件的绝对路径。

MD_ALLOWED_PATHS

未设置(无限制)

服务器允许读取的目录列表,以路径分隔符分隔(POSIX 上为 :,Windows 上为 ;)。设置后,所有文件输入工具(pdf-to-markdown、get-markdown-file 等)将拒绝这些目录之外的路径。

MD_SHARE_DIR

未设置

MD_ALLOWED_PATHS(单个目录)的弃用别名。为了向后兼容,仍然有效。

在 Docker 中使用

构建并运行:

docker build -t markdownify-mcp .
docker run --rm -i \
  -v "$HOME/Documents:/data:ro" \
  -e MD_ALLOWED_PATHS=/data \
  markdownify-mcp

关于 Docker MCP 目录 (mcp/markdownify) 的说明:

  • 将您希望服务器读取的任何主机目录挂载到容器中,然后将容器路径传递给工具(例如 /data/foo.pdf,而不是 /Users/you/Documents/foo.pdf)。

  • 将 MD_ALLOWED_PATHS 设置为挂载目录的冒号分隔列表,以便服务器强制执行与绑定挂载相匹配的读取边界。

  • 已发布的 Docker 镜像仅安装 markitdown[pdf] — 音频转录和图像 OCR(audio-to-markdown、image-to-markdown)需要 [all] 额外功能,在精简镜像中会失败。请使用本地安装 (bun install) 以获得完整功能集。

可用工具

  • youtube-to-markdown:将 YouTube 视频转换为 Markdown

  • pdf-to-markdown:将 PDF 文件转换为 Markdown

  • bing-search-to-markdown:将必应搜索结果转换为 Markdown

  • webpage-to-markdown:将网页转换为 Markdown

  • image-to-markdown:将图像转换为带元数据的 Markdown

  • audio-to-markdown:将音频文件转换为带转录的 Markdown

  • docx-to-markdown:将 DOCX 文件转换为 Markdown

  • xlsx-to-markdown:将 XLSX 文件转换为 Markdown

  • pptx-to-markdown:将 PPTX 文件转换为 Markdown

  • get-markdown-file:获取现有的 Markdown 文件。文件扩展名必须以:*.md, *.markdown 结尾。

    可选:设置 MD_ALLOWED_PATHS 以将每个文件输入工具限制为目录列表,例如 MD_ALLOWED_PATHS=/data/in:/data/out bun start。

贡献

欢迎贡献!请随时提交拉取请求 (Pull Request)。

许可证

本项目采用 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。

Available Tools

10 tools
audio-to-markdownC

Convert an audio file to markdown, including transcription if possible

Inputs: filepath (required).

bing-search-to-markdownC

Convert a Bing search results page to markdown

Inputs: url (required).

docx-to-markdownC

Convert a DOCX file to markdown

Inputs: filepath (required).

get-markdown-fileC

Get a markdown file by absolute file path

Inputs: filepath (required).

image-to-markdownC

Convert an image to markdown, including metadata and description

Inputs: filepath (required).

pdf-to-markdownC

Convert a PDF file to markdown

Inputs: filepath (required).

pptx-to-markdownC

Convert a PPTX file to markdown

Inputs: filepath (required).

webpage-to-markdownC

Convert a webpage to markdown

Inputs: url (required).

xlsx-to-markdownC

Convert an XLSX file to markdown

Inputs: filepath (required).

youtube-to-markdownC

Convert a YouTube video to markdown, including transcript if available

Inputs: url (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose focused on converting a specific input format (audio, Bing search, DOCX, etc.) to markdown. The descriptions specify unique source types, making it impossible to confuse which tool to use for a given conversion task.

    Naming Consistency5/5

    All tools follow a consistent pattern of 'source-to-markdown' (e.g., audio-to-markdown, docx-to-markdown). This uniform naming convention makes it easy to predict tool names and understand their functions at a glance.

    Tool Count5/5

    With 10 tools, the server covers a comprehensive range of common input formats (audio, documents, web content, spreadsheets, presentations, etc.) for markdown conversion. This count is well-scoped for the domain, providing thorough coverage without being overwhelming.

    Completeness5/5

    The tool set offers complete coverage for converting various media and file types to markdown, including audio, images, documents, webpages, and videos. There are no obvious gaps; each tool handles a distinct input format, ensuring agents can convert any supported source without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Converts various file types (documents, images, audio, web content) to markdown format without requiring Docker, supporting PDF, Word, Excel, PowerPoint, images, audio files, web URLs, and more.
      397 npm
      14
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Converts documents, webpages, and media files into markdown for AI assistants using Microsoft's MarkItDown and Crawl4AI. It enables tools to read PDFs, Office files, and JavaScript-rendered websites with support for OCR and image extraction.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Converts files (PDF, images, audio, DOCX, XLSX, PPTX) and web content (YouTube transcripts, Bing search, general pages) to Markdown via the Model Context Protocol.
      Apache 2.0