The Mammoth MCP Server converts Microsoft Word DOCX files to various formats using mammoth.js.
Core Capabilities:
Convert DOCX to HTML - Transform Word documents into clean, semantic HTML while preserving headings, paragraphs, lists, tables, and text formatting (bold, italic, underline)
Convert DOCX to HTML with embedded images - Generate HTML with images included as base64 data URIs
Extract plain text - Extract raw, unformatted text content for indexing, search, or text analysis
Convert DOCX to Markdown - Transform Word documents to Markdown format (deprecated by mammoth.js but remains functional)
Customization Options:
Custom style mapping to control how Word styles convert to HTML/Markdown elements
Ignore empty paragraphs
Add ID prefixes
Control default and embedded style map inclusion
Provides tools for converting DOCX documents into Markdown format, preserving document structure such as headings, paragraphs, lists, and tables.
Click on "Install 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., "@Mammoth MCP Serverconvert my report.docx to HTML with images"
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.
mammoth-mcp
A Model Context Protocol (MCP) server for converting DOCX files to HTML using mammoth.js.
Features
convert_docx_to_html: Convert DOCX files to clean HTML with advanced styling options
convert_docx_to_html_with_images: Convert DOCX files to HTML with embedded base64 images
extract_raw_text: Extract plain text content from DOCX files
convert_docx_to_markdown: Convert DOCX files to Markdown format
Installation
Development
Usage
Configure MCP Client
Add the server to your MCP client configuration (e.g., Claude Desktop).
The configuration file is located at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Option 1: Using npx (Recommended)
This will automatically install and run the latest version:
Option 2: Using local installation
If you've cloned the repository locally:
After updating the configuration, restart Claude Desktop for the changes to take effect.
Available Tools
convert_docx_to_html
Convert a DOCX file to HTML.
Parameters:
filePath(string, required): Absolute path to the DOCX filestyleMap(string, optional): Custom style map to control Word styles to HTML conversionignoreEmptyParagraphs(boolean, optional): Whether to ignore empty paragraphs (default: true)idPrefix(string, optional): Prefix for generated IDs (bookmarks, footnotes, endnotes)includeDefaultStyleMap(boolean, optional): Whether to include default style map (default: true)includeEmbeddedStyleMap(boolean, optional): Whether to include embedded style map from document (default: true)
Example:
convert_docx_to_html_with_images
Convert a DOCX file to HTML with images embedded as base64 data URIs.
Parameters:
filePath(string, required): Absolute path to the DOCX filestyleMap(string, optional): Custom style map to control Word styles to HTML conversionignoreEmptyParagraphs(boolean, optional): Whether to ignore empty paragraphs (default: true)idPrefix(string, optional): Prefix for generated IDs (bookmarks, footnotes, endnotes)includeDefaultStyleMap(boolean, optional): Whether to include default style map (default: true)includeEmbeddedStyleMap(boolean, optional): Whether to include embedded style map from document (default: true)
Example:
extract_raw_text
Extract raw text from a DOCX file, ignoring all formatting. Useful for indexing, search, or text analysis.
Parameters:
filePath(string, required): Absolute path to the DOCX file
Example:
convert_docx_to_markdown
Convert a DOCX file to Markdown format. Note: This feature is deprecated by mammoth.js but remains functional.
Parameters:
filePath(string, required): Absolute path to the DOCX filestyleMap(string, optional): Custom style map to control Word styles to Markdown conversionignoreEmptyParagraphs(boolean, optional): Whether to ignore empty paragraphs (default: true)idPrefix(string, optional): Prefix for generated IDs (bookmarks, footnotes, endnotes)includeDefaultStyleMap(boolean, optional): Whether to include default style map (default: true)includeEmbeddedStyleMap(boolean, optional): Whether to include embedded style map from document (default: true)
Example:
How It Works
This MCP server uses mammoth.js to convert DOCX documents to clean, semantic HTML or Markdown. The conversion preserves:
Headings
Paragraphs
Lists
Tables
Bold/italic/underline formatting
Images (when using the
with_imagesvariant)Custom style mappings (via styleMap parameter)
Style Maps
Style maps allow you to control how Word styles are converted to HTML/Markdown. Each line in a style map represents a mapping from a Word style to an HTML/Markdown element.
Example style map:
For more information on style maps, see the mammoth.js documentation.
LICENSE
MIT