Document Converter MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Document Converter MCP Server Convert report.md to docx with table of contents"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Document Converter MCP Server
這是一個 Model Context Protocol (MCP) server,用於在 Markdown 和 Word 文件之間進行轉換。它使用 pandoc 作為底層轉換引擎。
功能特色
🔄 雙向轉換: 支援 Markdown 轉 Word 和 Word 轉 Markdown
⚙️ 豐富選項: 支援多種 pandoc 轉換選項
🔍 狀態檢查: 檢查 pandoc 安裝狀態和支援格式
🛠️ 易於整合: 遵循 MCP 協議,易於與其他工具整合
Related MCP server: Pandoc Document Conversion
安裝需求
1. 安裝 pandoc
在 macOS 上,您可以使用 Homebrew:
brew install pandoc或者從官方網站下載安裝程式: https://pandoc.org/installing.html
2. 安裝 Node.js 依賴
npm install建置與執行
建置 TypeScript 代碼
npm run build執行 MCP Server
npm start當 MCP server 成功啟動時,您會看到:
Document Converter MCP Server 已啟動開發模式(自動重建和重啟)
npm run dev驗證 MCP Server 運行狀態
您可以使用以下方法確認 MCP server 正常運行:
檢查進程:
ps aux | grep "node.*index.js"測試功能:
node test-conversion.js node simulate-mcp-client.js查看日誌:MCP server 會在 stderr 輸出狀態信息
可用工具
1. convert_markdown_to_word
將 Markdown 文件轉換為 Word (.docx) 文件。
參數:
inputPath(必需): Markdown 文件的完整路徑outputPath(可選): Word 文件的輸出路徑options(可選): 轉換選項standalone: 產生完整文件 (預設: true)toc: 產生目錄 (預設: false)numberSections: 自動編號章節 (預設: false)highlightStyle: 程式碼語法高亮樣式 (預設: "pygments")
2. convert_word_to_markdown
將 Word (.docx) 文件轉換為 Markdown 文件。
參數:
inputPath(必需): Word 文件的完整路徑outputPath(可選): Markdown 文件的輸出路徑options(可選): 轉換選項extractMedia: 提取媒體文件到指定目錄wrapText: 文字換行方式 ("auto", "none", "preserve")atxHeaders: 使用 ATX 樣式標題 (預設: true)
3. check_pandoc_installation
檢查 pandoc 是否已安裝並顯示版本信息。
4. list_supported_formats
列出 pandoc 支援的所有輸入和輸出格式。
使用範例
轉換 Markdown 到 Word
{
"tool": "convert_markdown_to_word",
"arguments": {
"inputPath": "/Users/alex/MCP_test/test.md",
"outputPath": "/Users/alex/MCP_test/test.docx",
"options": {
"toc": true,
"numberSections": true
}
}
}轉換 Word 到 Markdown
{
"tool": "convert_word_to_markdown",
"arguments": {
"inputPath": "/Users/alex/MCP_test/TDD 簡介拷貝.docx",
"outputPath": "/Users/alex/MCP_test/TDD_intro.md",
"options": {
"extractMedia": "./media",
"atxHeaders": true
}
}
}整合到 MCP 客戶端
Claude Desktop
在 Claude Desktop 中使用此 MCP server,請按照以下步驟:
找到配置文件位置:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
添加 MCP server 配置:
{
"mcpServers": {
"document-converter": {
"command": "node",
"args": ["/Users/alex/MCP_test/dist/index.js"],
"env": {}
}
}
}重啟 Claude Desktop 以載入新的 MCP server
其他 MCP 客戶端
此 MCP server 遵循標準的 MCP 協議,可以與任何支援 MCP 的客戶端整合:
命令:
node參數:
["/Users/alex/MCP_test/dist/index.js"]通訊協議: stdio
功能: 提供 4 個文件轉換工具
驗證整合
整合成功後,您應該能夠在 MCP 客戶端中看到以下 4 個可用工具:
convert_markdown_to_wordconvert_word_to_markdowncheck_pandoc_installationlist_supported_formats
支援的文件格式
此 MCP server 專門針對以下格式進行了優化:
輸入: Markdown (.md), Word (.docx)
輸出: Markdown (.md), Word (.docx)
pandoc 本身支援更多格式,您可以使用 list_supported_formats 工具查看完整列表。
故障診斷
常見問題
"pandoc: command not found"
確保已安裝 pandoc 並且在 PATH 中可用
執行
which pandoc檢查安裝位置
"找不到輸入文件"
確保文件路徑正確且文件存在
使用絕對路徑以避免路徑問題
轉換失敗
檢查輸入文件是否損壞
確保您有寫入輸出目錄的權限
MCP 服務相關問題
MCP server 無法啟動
確保已執行
npm run build建置項目檢查 Node.js 版本是否支援 ES modules
查看終端錯誤信息以了解具體問題
MCP 客戶端無法連接
確認配置文件路徑正確
檢查 MCP server 路徑
/Users/alex/MCP_test/dist/index.js是否存在重啟 MCP 客戶端(如 Claude Desktop)
工具無法使用
使用
node simulate-mcp-client.js測試 MCP server 功能檢查 pandoc 是否正確安裝
確認文件權限設置正確
調試方法
測試 MCP server:
cd /Users/alex/MCP_test npm start測試轉換功能:
node test-conversion.js模擬 MCP 客戶端:
node simulate-mcp-client.js
檢查安裝
使用 check_pandoc_installation 工具驗證 pandoc 是否正確安裝。
MCP 服務管理
快速服務管理
使用提供的服務管理腳本來管理 MCP server:
# 啟動 MCP server
./mcp-service.sh start
# 檢查服務狀態
./mcp-service.sh status
# 查看實時日誌
./mcp-service.sh logs
# 停止服務
./mcp-service.sh stop
# 重啟服務
./mcp-service.sh restart
# 測試功能
./mcp-service.sh test服務狀態檢查
執行 ./mcp-service.sh status 會顯示:
✅ 服務運行狀態
🔢 進程 ID (PID)
💾 內存使用情況
🔧 系統依賴檢查(pandoc、Node.js)
日誌管理
服務日誌存儲在
mcp-server.log使用
./mcp-service.sh logs查看實時日誌日誌包含啟動信息和錯誤詳情
詳細整合指南
查看 MCP_INTEGRATION_GUIDE.md 了解:
Claude Desktop 配置步驟
其他 MCP 客戶端整合
故障排除和調試技巧
授權
MIT License
貢獻
歡迎提交 Issues 和 Pull Requests!
Available Tools
4 toolscheck_pandoc_installationA
檢查 pandoc 是否已安裝並顯示版本信息
Inputs: no named parameters.
convert_markdown_to_wordB
將 Markdown 文件轉換為 Word (.docx) 文件
Inputs: inputPath (required), options, outputPath.
convert_word_to_markdownB
將 Word (.docx) 文件轉換為 Markdown 文件
Inputs: inputPath (required), options, outputPath.
list_supported_formatsA
列出 pandoc 支援的所有格式
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: two conversion tools reverse directions, and the two utility tools check installation and list formats. No ambiguity exists between any pair.
All tool names use lowercase snake_case with a consistent pattern: convert_markdown_to_word and convert_word_to_markdown follow verb_noun structure, while check_pandoc_installation and list_supported_formats are clear imperative verbs. The naming is uniform and predictable.
Four tools is well-scoped for a document converter server, covering both directions of conversion plus necessary utilities. The count is within the ideal 3-15 range and each tool earns its place.
The core conversion lifecycle (Markdown <-> Word) is fully covered, and the utility tools support setup and exploration. A minor gap is the lack of a generic conversion tool for other pandoc formats, but the server's explicit focus on Markdown and Word makes this acceptable.
Maintenance
Related MCP Connectors
Convert Markdown to PDF, DOCX, HTML or EPUB with formatting and display options.
Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.
Create Word .docx files from sections or markdown, fill templates, and read text from a .docx.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables creation and management of Word documents from markdown content, with support for multiple templates and conversion of chat conversations to formatted Word documents.-
- AlicenseAqualityDmaintenanceEnables document format conversion between various formats (Markdown, HTML, PDF, DOCX, LaTeX, EPUB, and more) using Pandoc, preserving formatting and structure while supporting both direct content transformation and file-based conversions.1MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables document format conversion between 40+ formats including Markdown, HTML, LaTeX, DOCX, and PDF using Pandoc, with support for both text and file-based conversions.1MIT
- AlicenseAqualityDmaintenanceConverts Markdown files to Word (.docx) and PDF documents. Supports .dotx templates for branded styling and batch conversion.363 PyPI1MIT