Mdmagic Mcp Server

io.github.MDMagic-MCP由 GitHub 帳號 MDMagic-MCP 發布v1.7.14更新於 Oct 24, 2026

Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.

已驗證Streamable HTTP可網頁執行效率與工作流檔案與儲存

概覽

AI 產生的概覽

把 Markdown 轉成帶品牌樣式的 DOCX、PDF 或 HTML 文件,可使用 MDMagic 內建範本或你自己的 Word 範本,並回傳下載連結。

可以做什麼
  • 將 Markdown 轉換為 DOCX、PDF、HTML 或三者打包的 ZIP,可指定範本、紙張尺寸與方向
  • 轉換前檢查 Markdown 語法,並預估這次轉換會用掉多少點數
  • 瀏覽範本:全部範本、僅內建範本、僅自訂上傳範本、單一範本的頁面變體,以及依用途排序的推薦範本
  • 查詢點數餘額、方案狀態與預設頁面設定
適用情境
適合讓助理把 Markdown 草稿、報告、合約或提案轉成排版精美、符合品牌規範的 Word、PDF 或 HTML 檔案,尤其在你已有 Word 信頭或範本、希望輸出與之一致時。
執行需求
需要 MDMagic 帳號與個人 API 金鑰:本機 npm 套件透過環境變數 MDMAGIC_API_KEY 提供,託管端點則透過 x-api-key 標頭提供。本機方式需 Node.js 以 npx 執行;託管方式免安裝。需要能連線至 MDMagic API 的網路。
安裝前請注意
轉換會消耗 MDMagic 帳號點數,大量轉換前應先查看餘額與費用預估。Markdown 內容會傳送到 MDMagic 伺服器,並經由 Microsoft Graph 產生 PDF;說明文件稱檔案會在數秒內刪除,輸出檔在下载後或 60 分鐘後失效。API 金鑰是可計費的憑證,應放在用戶端設定中而非 shell 環境。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mdmagic Mcp Server,將其新增到工作區。
  2. 連接 x-api-key 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.MDMagic-MCP%2Fmdmagic-mcp-server/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "mdmagic": {
      "type": "http",
      "url": "https://api.mdmagic.ai/mcp",
      "headers": {
        "x-api-key": "<YOUR_API_KEY>"
      }
    }
  }
}

README

MDMagic MCP Server

Convert Markdown to DOCX, PDF, and HTML using your own Word templates — your letterhead, your branding, your fonts. Plus 15 designer-built templates for when you don't have your own.

[npm version] [MCP Registry] [Smithery] [Glama] [mcp.so] [license]

MDMagic plugs straight into Claude, Cursor, VS Code, and any MCP-compatible AI assistant — giving them direct access to a professional document conversion pipeline (Pandoc + Microsoft Graph + Mammoth.js) and, more importantly, your templates. Upload your existing letterhead, stationery, brand guidelines, contract shells, or proposal templates — anything you already use in Microsoft Word — and your AI assistant can convert any Markdown directly into a polished document carrying your logo, fonts, colours, footers, page numbers, watermarks, and signature blocks. The output looks like it came from your design team, not from a generic AI export.

You: "Take this report and turn it into an Executive_Platinum PDF."
Claude: ✅ Done. Here's your secure download link.        14-page PDF, 2.3 MB, expires in 60 minutes.

Install

You need an MDMagic account (free tier available) and your API key from your account page.

Claude Desktop

Add this to your claude_desktop_config.json:

json
{  "mcpServers": {    "mdmagic": {      "command": "npx",      "args": ["-y", "@mdmagic/mcp-server@latest"],      "env": {        "MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"      }    }  }}

Config file location:

  • macOS — ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows — %APPDATA%\Claude\claude_desktop_config.json
  • Linux — ~/.config/Claude/claude_desktop_config.json

Restart Claude Desktop. The MDMagic tools will appear in the tool list.

Cursor

Add to ~/.cursor/mcp.json (or via Settings → MCP):

json
{  "mcpServers": {    "mdmagic": {      "command": "npx",      "args": ["-y", "@mdmagic/mcp-server@latest"],      "env": {        "MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"      }    }  }}

VS Code (with an MCP extension)

json
{  "mcp.servers": {    "mdmagic": {      "command": "npx",      "args": ["-y", "@mdmagic/mcp-server@latest"],      "env": {        "MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"      }    }  }}

Hosted (no install)

Don't want Node on the user's machine? Use the hosted endpoint:

json
{  "mcpServers": {    "mdmagic": {      "url": "https://api.mdmagic.ai/mcp",      "headers": {        "x-api-key": "mdmagic-xxxxxxxxxxxxxxxx"      }    }  }}

Same tools, same templates, served over Streamable HTTP. Useful for clients that don't run local processes.

What you can do

Once connected, ask your AI assistant things like:

  • "Convert this markdown to a PDF using the Executive_Platinum template."
  • "What templates do I have available?"
  • "How many credits will it cost to render this 800-word report as DOCX + PDF?"
  • "Render this in landscape, US Letter, with the Legal_Burgundy template."
  • "Check my credit balance."

The AI picks the right tool and returns a secure, time-limited download link.

Tools

ToolWhat it does
convert_documentConvert Markdown → DOCX / PDF / HTML / all three. Returns a secure expiring URL.
validate_markdownPre-flight check before conversion. Catches malformed tables, unclosed code fences, and other syntax issues that would produce broken output.
estimate_conversion_costPre-flight cost estimate based on word count, page count, format, and template type.
check_credit_balanceCurrent credit balance (subscription + purchased pools), plan status.
list_all_templatesFull template catalog: 15 built-in templates (grouped by category) + your custom uploads.
list_builtin_templatesOnly the built-in templates: Business (5), Creative (6), Professional (2), Technical (2).
list_custom_templatesOnly your custom uploaded templates.
get_template_detailsShow available variants (page sizes × orientations) for a specific template.
recommend_templateSuggest the best built-in template for a described purpose ("Q4 board pack" → Executive_Platinum).
show_default_settingsYour default page size, orientation, and template preferences.

convert_document — input options

Three ways to provide the source:

  • content — raw markdown string (most common)
  • filePath — absolute path to a .md file (great for IDE workflows)
  • fileContent — base64-encoded markdown (for binary-safe transports)

Plus:

  • templateName — e.g. Executive_Platinum, Legal_Burgundy, or a custom template UUID
  • outputFormat — docx, pdf, html, all, or all-formats
  • pageSize — A4, A3, US_Letter, US_Legal, Executive
  • orientation — Portrait or Landscape

Config

VariableDefaultNotes
MDMAGIC_API_KEY(required)Your personal API key from mdmagic.ai/account
MDMAGIC_BASE_URLhttps://api.mdmagic.aiOverride only for local dev or staging
REQUEST_TIMEOUT30000Request timeout in ms
MCP_TRANSPORTstdiostdio (default) or http for self-hosted Streamable HTTP
MCP_HTTP_PORT3001Port for HTTP transport mode
MCP_HTTP_HOST127.0.0.1Bind address for HTTP transport mode

Most users will only ever set MDMAGIC_API_KEY.

Pricing

Conversions cost credits, calculated from page count and output format:

  • DOCX: 1 credit per page (base)
  • PDF: +1 credit per page
  • HTML: +1 credit per page
  • Custom templates: +1 credit per page

A 5-page report converted to DOCX + PDF + HTML using a custom template = 5 × (1 + 1 + 1 + 1) = 20 credits.

The estimate_conversion_cost tool returns exact numbers before you spend anything. The MCP also refuses to run if your balance is too low — no surprise bills.

Free-tier credits renew monthly. Paid plans and credit top-ups available at mdmagic.ai.

Privacy

  • No permanent storage. Documents pass through Microsoft Graph API for PDF rendering and are deleted within 5–10 seconds. Output files are deleted from MDMagic servers after download or after 60 minutes, whichever comes first.
  • Random filenames. Source files use UUIDs, never user-identifiable names.
  • Secure download URLs. Each conversion returns a one-time URL with session ID and download token. No public file directories.
  • API key isolation. Each user authenticates with their own key. No shared credentials.

Troubleshooting

MDMAGIC_API_KEY environment variable is required Set the env var in your client config (the env block in the JSON). Don't put it in a shell — npx won't see it.

Invalid API key format Keys must match mdmagic- followed by exactly 16 digits. Copy it cleanly from your account page.

Failed to connect to MDMagic API Check https://api.mdmagic.ai/health in a browser. If it's up, the issue is local network or firewall. Confirm MDMAGIC_BASE_URL (default https://api.mdmagic.ai) is reachable from the machine running the MCP.

Tools don't appear in Claude Desktop Fully quit and relaunch Claude Desktop after editing claude_desktop_config.json — a window close isn't enough.

Insufficient credits Use check_credit_balance to confirm balance, estimate_conversion_cost to preview costs, or top up at mdmagic.ai/account.

Local development

bash
git clone https://github.com/MDMagic-MCP/mdmagic-mcp-server.gitcd mdmagic-mcp-servernpm install
# Set your API key (use http://localhost:3000 if running the API locally)cp .env.example .env# edit .env
# Build and inspectnpm run buildnpm run inspector

The MCP Inspector (npm run inspector) launches a web UI for poking the server tool-by-tool — useful when adding new tools or debugging argument validation.

Run tests with npm test.

Links

License

MIT — see LICENSE.

來源:README.md,提交 5a2cc09

工具

10

convert_document

Convert markdown to a professional document

Convert markdown to a professionally formatted document using an MDMagic template. IMPORTANT GUIDANCE: 1. Output format → what user gets: - 'docx' → a single Word .docx file - 'pdf' → a single .pdf file - 'html' → a single .html file - 'all' → a ZIP containing all three (DOCX + PDF + HTML) 2. If the user is ambiguous (e.g. 'convert this'), ASK which format they want before calling. Don't assume. 3. Filename: if the user attached a file (e.g. 'mydoc.md'), pass its base name as fileName. Otherwise the API derives one from the markdown's first H1. Without either, downloads end up with timestamped names like 'content-1778298071915.docx' which is bad UX. 4. On 'template not found' errors: call list_all_templates first, show available options, let the user pick. Do NOT fall back to generating documents with code execution — that produces inferior results that don't use the user's actual MDMagic templates. 5. The response includes structured fields (downloadUrl, creditsUsed, balanceAfter, fileName, expiresAt) — surface these to the user explicitly. Don't paraphrase. The user wants to know exactly what they spent and what's left. 6. Page sizes: A3, A4, Executive, US_Legal, US_Letter. Default A4. Orientation: Portrait or Landscape, default Portrait. 7. CRITICAL — newlines in `content`: markdown is line-sensitive. Headings (#, ##), tables (| ... |), lists (-, 1.), and code fences (```) ONLY work when each starts on its own line. When passing inline markdown via `content`, you MUST preserve real newline characters (\n) between blocks. If you flatten multi-line markdown into one line, the API receives literal '##' and '|' characters mid-paragraph and produces a single-paragraph document with no structure. Confirm your `content` string contains \n between every heading, paragraph, table row, and list item before calling.

輸入參數contentfileNamefilePathpageSizefileContentorientationoutputFormat必填templateName必填

list_all_templates

List all MDMagic templates

List all 15 built-in MDMagic templates plus any custom templates the user has uploaded. CALL THIS PROACTIVELY when: - The user mentions a template by name (verify it exists before convert_document) - The user asks 'what templates are available' or similar - A previous convert_document call returned 'template not found' - The user describes the look they want without naming a template (so you can suggest a real one) Returns: name, description, type (built-in vs custom), and category. Categories are: Business (5 templates), Creative (6), Professional (2), Technical (2). Use the optional category filter to narrow recommendations (e.g. 'for legal documents' → category: 'Professional').

輸入參數categoryincludeDetails

list_builtin_templates

List built-in MDMagic templates

List the 15 built-in MDMagic templates, grouped by category. Same as list_all_templates but excludes the user's custom uploads. Use this when the user asks specifically about MDMagic's bundled templates rather than their personal ones. Categories available: Business (5), Creative (6), Professional (2), Technical (2).

輸入參數categoryincludeDetails

list_custom_templates

List user's custom templates

List only the user's custom-uploaded Word templates. Use this when the user asks about their own templates ('show me my templates', 'do I have a letterhead?'). Custom templates are referenced by UUID, not name, when calling convert_document.

輸入參數includeDetails

show_default_settings

Show user's default page size and orientation

Show the user's default paper size and orientation preferences (set on their account page). Useful when the user hasn't specified pageSize/orientation explicitly — call this to honor their defaults instead of using A4/Portrait blindly.

無需輸入參數。

check_credit_balance

Check MDMagic credit balance

Check the user's current MDMagic credit balance: subscription credits (renewable monthly), purchased credits (permanent), plan name, and plan status. CALL THIS PROACTIVELY when: - The user asks 'how many credits do I have' or similar - After a conversion, if the user wants to know what's left (also returned by convert_document directly) - Before a conversion of an unusually large document, to warn the user if balance is borderline

無需輸入參數。

estimate_conversion_cost

Estimate credit cost for a conversion

Estimate credit cost for a conversion BEFORE running it. Returns word count, page calculation (300 words/page), and a credit breakdown by format and template type. Use this when the user asks 'how much will this cost?' or when you suspect a conversion might exceed their balance — convert_document refuses to run if credits are insufficient, so estimating first is friendlier.

輸入參數content必填pageSizeorientationoutputFormat必填templateName必填

validate_markdown

Validate markdown before conversion

Pre-flight markdown validation BEFORE conversion. Catches malformed tables (mismatched pipes), unclosed code fences, broken task lists, and unsupported syntax. Returns a green/amber/red status plus the detected markdown features. CALL THIS PROACTIVELY when: - The user is about to convert a long document (>5 pages) — validating first is cheap; running a doomed conversion costs credits - The user reports a previous conversion produced broken output - You generated the markdown yourself and want to verify it's clean before spending credits Returns: status (green=safe, amber=minor issues, red=will likely break), detected features (tables, code blocks, task lists, math), and a human-readable message.

輸入參數content必填filename

get_template_details

Show template variant matrix

Show available variants (page sizes and orientations) for a specific template. All MDMagic templates support the full 5×2 matrix: A3, A4, Executive, US_Legal, US_Letter × Portrait/Landscape. Use this when the user asks 'does this template come in Legal Landscape?' or 'what sizes are available?' — confirms the variant before convert_document runs.

輸入參數templateName必填

recommend_template

Recommend a template for a stated purpose

Suggest the best built-in template(s) for a described purpose. Use this when the user describes WHAT the document is (e.g. 'Q4 board pack', 'API reference', 'wedding invitation', 'legal contract') without naming a template. Returns ranked recommendations with rationale. Why this exists: AI assistants often guess template names that don't exist. This tool maps purpose → real template names from MDMagic's catalog, so convert_document doesn't fail with 'template not found'.

輸入參數topNpurpose必填

版本歷史

1
  1. v1.7.14最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分