ZM

zcaceres/markdownify-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

2998 stars 255 forks 质量 81 趋势 46MIT

一个模型上下文协议服务器,几乎可以将任何内容转换为Markdown。

概览

Markdownify 是一款模型上下文协议(MCP)服务器,可将各种文件类型和网页内容转换为 Markdown 格式。它提供一套工具,将 PDF、图片、音频文件、网页等转换为易于阅读和共享的 Markdown 文本。 - 将多种文件类型转换为Markdown:- PDF - 图片 - 音频(含转录)- DOCX - XLSX - PPTX - 将网页内容转换为Markdown: - YouTube视频转录 - 必应搜索结果 - 一般网页 - 检索现有的Markdown文件 1. 克隆该仓库 2.安装依赖: 预安装步骤在 .venv 创建 Python 虚拟环境并安装 markitdown[all]。 3. 构建项目:4. 启动服务器: - 使用 bun run dev 在监控模式下启动 TypeScript 编译器 - 修改 src/server.ts 以自定义服务器行为 - 在 src/tools 中添加或修改工具。

概述(AI 翻译)

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

特色

  • 将多种文件类型转换为Markdown:
  • PDF
  • 图片
  • 音频(含转录)
  • DOCX
  • XLSX
  • PPTX
  • 将网页内容转换为Markdown:
  • YouTube视频文字记录
  • 必应搜索结果
  • 综合网页
  • 检索现有的 Markdown 文件

开始

  1. 克隆此仓库
  2. 安装依赖:

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

  1. 建设项目:

  2. 启动服务器:

发展

  • 使用 bun run dev 以观察模式启动 TypeScript 编译器
  • 修改src/server.ts以定制服务器行为
  • 添加或修改[src/tools.ts中的工具

桌面应用的使用

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

环境变量

所有路径默认使用合理的数值;只有当默认值不符合你的安装布局时才会覆盖。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Markdownify MCP Server

Markdownify is a Model Context Protocol (MCP) server that converts various file types and web content to Markdown format. It provides a set of tools to transform PDFs, images, audio files, web pages, and more into easily readable and shareable Markdown text.

Features

  • Convert multiple file types to Markdown:
    • PDF
    • Images
    • Audio (with transcription)
    • DOCX
    • XLSX
    • PPTX
  • Convert web content to Markdown:
    • YouTube video transcripts
    • Bing search results
    • General web pages
  • Retrieve existing Markdown files

Getting Started

  1. Clone this repository

  2. Install dependencies:

    bun install
    

    The preinstall step creates a Python virtual environment at .venv and installs markitdown[all].

  3. Build the project:

    bun run build
    
  4. Start the server:

    bun start
    

Development

  • Use bun run dev to start the TypeScript compiler in watch mode
  • Modify src/server.ts to customize server behavior
  • Add or modify tools in src/tools.ts

Usage with Desktop App

To integrate this server with a desktop app, add the following to your app’s server configuration:

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

Environment variables

All paths default to sensible values; override only when the defaults don’t fit your install layout.

Variable Default Purpose
MARKITDOWN_PATH /.venv/bin/markitdown, then markitdown on PATH Absolute path to the markitdown executable. Set this when you’ve installed markitdown system-wide (e.g. pipx install "markitdown[pdf]") instead of using the bundled venv.
REPOMIX_PATH /node_modules/.bin/repomix, then repomix on PATH Absolute path to the repomix executable used by git-repo-to-markdown.
MD_ALLOWED_PATHS unset (unrestricted) Path-delimiter-separated list (: on POSIX, ; on Windows) of directories the server is allowed to read. When set, all file-input tools (pdf-to-markdown, get-markdown-file, etc.) reject paths outside these directories.
MD_SHARE_DIR unset Deprecated alias for MD_ALLOWED_PATHS (single directory). Still honored for backward compatibility.

Usage with Docker

Build and run:

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

Notes for the Docker MCP catalog (mcp/markdownify):

  • Mount any host directories you want the server to read into the container, then pass the container paths to the tools (e.g. /data/foo.pdf, not /Users/you/Documents/foo.pdf).
在 GitHub 查看完整 README

安装

docker run --rm -i \
新手?先看 mcpskill.org 教程 →

配置

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