markdown2pdf-mcp

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Converts Markdown documents to PDF files with support for syntax highlighting, custom styling, and optional watermarking. Handles standard Markdown elements including headers, lists, tables, code blocks, and images.

  • Uses Puppeteer and Chrome's rendering engine to generate high-quality PDFs from Markdown content with reliable resource loading and rendering of modern web features and fonts.

Markdown2PDF MCP サーバー (markdown2pdf-mcp)

Markdown文書をPDFファイルに変換するためのMCPサーバーです。このサーバーは、構文のハイライトとカスタムスタイルをサポートし、MarkdownコンテンツからPDFを生成するためのシンプルかつ効率的な方法を提供します。また、1ページ目に透かしを入れることも可能です。

Alan Shaw のmarkdown-pdfに触発されました。

特徴

  • 1つのコマンドでMarkdownをPDFに変換する
  • コードブロックの構文強調表示
  • PDF出力のカスタムCSSスタイル
  • 標準的なMarkdownフォーマットのサポート
  • Chrome のレンダリング エンジンを使用した最新の PDF 生成
  • 最新のWeb機能とフォントの優れたサポート
  • 信頼性の高いリソースの読み込みとレンダリング

制限事項

次のマークダウン要素はサポートされていません。

  • LaTeXの数式(例: $x^2$または$$\sum_{i=1}^n x_i$$
  • 複雑な数式や科学的記法

サポートされている次のマークダウン要素に従ってください。

  • ヘッダー(全レベル)
  • テキストの書式設定(太字、斜体、取り消し線)
  • リスト(順序付きと順序なし)
  • 構文強調表示付きのコードブロック
  • テーブル
  • 引用ブロック
  • リンク
  • 画像(ローカルファイルと外部 URL の両方)
  • タスクリスト

インストール

# Clone the repository git clone https://github.com/2b3pro/markdown2pdf-mcp.git # Navigate to the project directory cd markdown2pdf-mcp # Install dependencies npm install # Build the project npm run build

使用法

サーバーの起動

npm start

MCPツールの使用

サーバーは、次のパラメータを持つ単一のツールcreate_pdf_from_markdownを提供します。

{ // Required parameters markdown: string; // Markdown content to convert // Optional parameters with defaults outputFilename?: string; // Filename for the PDF (e.g., "output.pdf") paperFormat?: string; // 'letter' (default), 'a4', 'a3', 'a5', 'legal', 'tabloid' paperOrientation?: string; // 'portrait' (default), 'landscape' paperBorder?: string; // '2cm' (default), accepts decimal values with CSS units (e.g., '1.5cm', '2.5mm', '0.5in', '10.5px') watermark?: string; // Optional watermark text (max 15 characters, uppercase) }

オプション付きの例:

await use_mcp_tool({ server_name: "markdown2pdf", tool_name: "create_pdf_from_markdown", arguments: { markdown: "# Hello World\n\nThis is a test document.", outputFilename: "output.pdf", paperFormat: "a4", paperOrientation: "landscape", paperBorder: "1.5cm", watermark: "DRAFT", }, });

最小限の使用例:

await use_mcp_tool({ server_name: "markdown2pdf", tool_name: "create_pdf_from_markdown", arguments: { markdown: "# Hello World\n\nThis is a test document.", outputFilename: "output.pdf", }, });

構成

出力ディレクトリ

ClineやClaudeなど、MCPを使用するアプリでは、MCP設定ファイルで出力ディレクトリを設定できます。設定されていない場合は、ファイルは$HOMEに保存されます。

{ "mcpServers": { "markdown2pdf": { "command": "node", "args": ["path/to/markdown2pdf-mcp/build/index.js"], "env": { "M2P_OUTPUT_DIR": "/path/to/output/directory" } } } }

ツールは、増分番号を追加することでファイル名の競合を自動的に処理します (例: output.pdf、output-1.pdf、output-2.pdf)。

依存関係

Chromeバージョン

このパッケージは、すべてのインストールで一貫したPDF生成を実現するために、Chrome v131.0.6778.204を使用しています。このバージョンは、 npm install実行すると自動的にインストールされます。

  • tmp - 一時ファイルの処理

発達

# Build the project npm run build # Start the server npm start

ライセンス

マサチューセッツ工科大学

貢献

  1. リポジトリをフォークする
  2. 機能ブランチを作成します( git checkout -b feature/amazing-feature
  3. 変更をコミットします ( git commit -m 'Add some amazing feature' )
  4. ブランチにプッシュする ( git push origin feature/amazing-feature )
  5. プルリクエストを開く

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Markdown ドキュメントを PDF ファイルに変換するための MCP サーバー。

  1. Features
    1. Limitations
      1. Installation
        1. Usage
          1. Starting the Server
          2. Using the MCP Tool
        2. Configuration
          1. Output Directory
        3. Dependencies
          1. Chrome Version
            1. Development
              1. License
                1. Contributing
                  ID: t13rjduffx