MD

Md2doc MCP Server: Markdown to DOCX Converter

Convert Markdown to DOCX with an MCP server using an external conversion service for fast, reliable document generation.

Quick Install
uvx md2doc

Overview

Md2doc MCP Server is a small Model Context Protocol (MCP) server that converts Markdown content into DOCX documents by delegating the heavy lifting to an external conversion service. It is designed for developers and workflow automations that need fast, reliable generation of Word files from Markdown—whether for reports, templates, or translated documents.

The server integrates with any MCP-compatible client (desktop assistants, custom tooling, or CI jobs). Locally it saves generated DOCX files into the user’s Downloads folder for immediate access; when run in cloud or headless environments it can return temporary download links instead. Templates, language options, and a simple programmatic API make it easy to fit md2doc into different pipelines.

Features

  • Convert Markdown content to DOCX (.docx) files
  • Support for custom templates and template listing per language
  • Multi-language handling (e.g., English, Chinese)
  • Automatic save to user’s Downloads directory (local) or temporary download link (remote/cloud)
  • Simple MCP-compatible server: works with Cherry Studio, Claude Desktop, or any MCP client
  • Lightweight CLI and Python client library for programmatic use

Installation / Configuration

Install and run via the uvx launcher (recommended) or include in your MCP client configuration.

Quick CLI start:

# Run the server locally (requires uvx)
uvx md2doc

# With API key
DEEP_SHARE_API_KEY="your-api-key-here" uvx md2doc

Environment variables

# Required to use the conversion service
export DEEP_SHARE_API_KEY="your-api-key-here"

# For cloud deployments: return a temporary download link instead of saving locally
export MCP_SAVE_REMOTE=true

MCP client configuration example (JSON)

{
  "mcpServers": {
    "md2doc": {
      "command": "uvx",
      "args": ["md2doc"],
      "env": {
        "DEEP_SHARE_API_KEY": "your-api-key-here"
      }
    }
  }
}

Where to add this JSON:

  • Cherry Studio: Settings → MCP
  • Claude Desktop configuration file:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json

Restart the client after changing MCP settings.

Available Tools / Resources

The server exposes a small set of conversion tools through its MCP API and included Python client:

  • convert_markdown_to_docx — convert Markdown text to a DOCX file
  • list_templates — return available templates for a given language

Python client example (async)

import asyncio
from md2doc.api_client import ConversionAPIClient
from md2doc.models import ConvertTextRequest

async def example():
    client = ConversionAPIClient()
    req = ConvertTextRequest(
        content="# Title\n\nThis is **markdown**.",
        filename="report",
        language="en",
        template_name="default",
        remove_hr=False,
        compat_mode=True
    )
    res = await client.convert_text(req)
    if res.success:
        print("Saved to:", res.file_path)
    else:
        print("Conversion failed:", res.error)

asyncio.run(example())

Repository and code:

  • GitHub: https://github.com/Yorick-Ryu/md2doc-mcp

Free test API key (for evaluation)

f4e8fe6f-e39e-486f-b7e7-e037d2ec216f

(Consider replacing with a purchased key for production usage. Purchase links are available from the conversion service provider.)

Use Cases

  • Automated report generation: render analytics or CI summaries written as Markdown into DOCX for stakeholders who prefer Word.
  • Templated documents: maintain reusable DOCX templates (headers, styles) and populate them from Markdown content for consistent branding.
  • Translated or localized documents: produce Word files in various languages by selecting the language parameter and template.
  • Meeting notes and minutes: quickly convert transcribed Markdown notes into a downloadable, shareable DOCX.
  • Headless/cloud workflows: run md2doc on a server (set MCP_SAVE_REMOTE=true) to generate a temporary download link for clients that cannot access a remote filesystem.

Example — create a templated invoice:

  1. Maintain a DOCX template with placeholders and a template name (e.g., “invoice”).
  2. Send Markdown content that includes structured sections (items, totals).
  3. The conversion returns a styled .docx invoice ready for distribution.

Deployment notes

  • Local mode: files are normally written into the Downloads directory of the machine running the MCP server.
  • Cloud mode: set MCP_SAVE_REMOTE=true to return a temporary URL instead of saving locally (suitable for VPS/Docker deployments).
  • Ensure DEEP_SHARE_API_KEY (or your conversion service key) is configured in the environment or MCP client environment block before starting.

License

Md2doc MCP Server is provided under the MIT license. See the repository for source code and contribution details.