Plugs Pandoc and Microsoft Graph directly into Claude, Cursor, or any MCP client to convert Markdown into DOCX, PDF, and HTML using your own Word templates. Upload your letterhead, contract shells, or branded stationery once, then ask your AI to render documents that match your design system: your fonts, logos, footers, watermarks. Ships with 15 built-in templates if you don't have custom ones. Exposes tools for conversion, cost estimation, credit balance checks, and template discovery. Runs locally via npx or over a hosted Streamable HTTP endpoint if you don't want Node installed. Credits are metered per page and format. Useful when you need AI-generated content to land in professional documents without manual reformatting.
Public tool metadata for what this MCP can expose to an agent.
convert_documentConvert 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...8 paramsConvert 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...
contentstringfileNamestringfilePathstringpageSizestringA3 · A4 · Executive · US_Legal · US_LetterfileContentstringorientationstringPortrait · LandscapeoutputFormatstringdocx · pdf · html · alltemplateNamestringlist_all_templatesList 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_...2 paramsList 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_...
categorystringBusiness · Creative · Professional · TechnicalincludeDetailsbooleanlist_builtin_templatesList 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), Creat...2 paramsList 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), Creat...
categorystringBusiness · Creative · Professional · TechnicalincludeDetailsbooleanlist_custom_templatesList 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.1 paramsList 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.
includeDetailsbooleanshow_default_settingsShow 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.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.
No parameter schema in public metadata yet.
check_credit_balanceCheck 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...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...
No parameter schema in public metadata yet.
estimate_conversion_costEstimate 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 balanc...5 paramsEstimate 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 balanc...
contentstringpageSizestringA3 · A4 · Executive · US_Legal · US_LetterorientationstringPortrait · LandscapeoutputFormatstringdocx · pdf · html · all · all-formatstemplateNamestringvalidate_markdownPre-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...2 paramsPre-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...
contentstringfilenamestringget_template_detailsShow 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 siz...1 paramsShow 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 siz...
templateNamestringrecommend_templateSuggest 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 th...2 paramsSuggest 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 th...
topNintegerpurposestringConvert 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.
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.
You need an MDMagic account (free tier available) and your API key from your account page.
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"mdmagic": {
"command": "npx",
"args": ["-y", "@mdmagic/mcp-server@latest"],
"env": {
"MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"
}
}
}
}
Config file location:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonRestart Claude Desktop. The MDMagic tools will appear in the tool list.
Add to ~/.cursor/mcp.json (or via Settings → MCP):
{
"mcpServers": {
"mdmagic": {
"command": "npx",
"args": ["-y", "@mdmagic/mcp-server@latest"],
"env": {
"MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"
}
}
}
}
{
"mcp.servers": {
"mdmagic": {
"command": "npx",
"args": ["-y", "@mdmagic/mcp-server@latest"],
"env": {
"MDMAGIC_API_KEY": "mdmagic-xxxxxxxxxxxxxxxx"
}
}
}
}
Don't want Node on the user's machine? Use the hosted endpoint:
{
"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.
Once connected, ask your AI assistant things like:
The AI picks the right tool and returns a secure, time-limited download link.
| Tool | What it does |
|---|---|
convert_document | Convert Markdown → DOCX / PDF / HTML / all three. Returns a secure expiring URL. |
validate_markdown | Pre-flight check before conversion. Catches malformed tables, unclosed code fences, and other syntax issues that would produce broken output. |
estimate_conversion_cost | Pre-flight cost estimate based on word count, page count, format, and template type. |
check_credit_balance | Current credit balance (subscription + purchased pools), plan status. |
list_all_templates | Full template catalog: 15 built-in templates (grouped by category) + your custom uploads. |
list_builtin_templates | Only the built-in templates: Business (5), Creative (6), Professional (2), Technical (2). |
list_custom_templates | Only your custom uploaded templates. |
get_template_details | Show available variants (page sizes × orientations) for a specific template. |
recommend_template | Suggest the best built-in template for a described purpose ("Q4 board pack" → Executive_Platinum). |
show_default_settings | Your default page size, orientation, and template preferences. |
convert_document — input optionsThree 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 UUIDoutputFormat — docx, pdf, html, all, or all-formatspageSize — A4, A3, US_Letter, US_Legal, Executiveorientation — Portrait or Landscape| Variable | Default | Notes |
|---|---|---|
MDMAGIC_API_KEY | (required) | Your personal API key from mdmagic.ai/account |
MDMAGIC_BASE_URL | https://api.mdmagic.ai | Override only for local dev or staging |
REQUEST_TIMEOUT | 30000 | Request timeout in ms |
MCP_TRANSPORT | stdio | stdio (default) or http for self-hosted Streamable HTTP |
MCP_HTTP_PORT | 3001 | Port for HTTP transport mode |
MCP_HTTP_HOST | 127.0.0.1 | Bind address for HTTP transport mode |
Most users will only ever set MDMAGIC_API_KEY.
Conversions cost credits, calculated from page count and output format:
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.
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.
git clone https://github.com/MDMagic-MCP/mdmagic-mcp-server.git
cd mdmagic-mcp-server
npm install
# Set your API key (use http://localhost:3000 if running the API locally)
cp .env.example .env
# edit .env
# Build and inspect
npm run build
npm 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.
MIT — see LICENSE.
MDMAGIC_API_KEY*secretYour personal MDMagic API key (format: mdmagic-XXXXXXXXXXXXXXXX). Get yours at https://mdmagic.ai/account — the 'Connect to AI Assistants via MCP' card on your account page generates the key and pre-fills a copy-pasteable config block.
MDMAGIC_BASE_URLdefault: https://api.mdmagic.aiOverride the MDMagic API base URL. Defaults to https://api.mdmagic.ai. Only set this if you're running MDMagic against a local dev backend.
REQUEST_TIMEOUTdefault: 30000Request timeout in milliseconds. Increase for very large documents on slow connections. Default: 30000 (30s).
MCP_TRANSPORTdefault: stdioTransport mode: 'stdio' (default, for local clients like Claude Desktop) or 'http' (for self-hosted Streamable HTTP).
MCP_HTTP_PORTdefault: 3001Port for HTTP transport mode. Default: 3001. Only used when MCP_TRANSPORT=http.
MCP_HTTP_HOSTdefault: 127.0.0.1Bind address for HTTP transport mode. Default: 127.0.0.1. Only used when MCP_TRANSPORT=http.
csoai-org/pdf-document-mcp
xt765/mcp-document-converter
io.github.xjtlumedia/markdown-formatter
io.github.ai-aviate/better-notion
suekou/mcp-notion-server
meterlong/mcp-doc