Mammoth MCP Server
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 "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., "@Mammoth MCP Server convert 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
Related MCP server: MCP Document Converter
Installation
$ pnpm installDevelopment
$ npm run dev
$ npm run buildUsage
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:
{
"mcpServers": {
"mammoth": {
"command": "npx",
"args": ["-y", "mammoth-mcp"]
}
}
}Option 2: Using local installation
If you've cloned the repository locally:
{
"mcpServers": {
"mammoth": {
"command": "node",
"args": ["/absolute/path/to/mammoth-mcp/dist/esm/index.js"]
}
}
}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:
{
"filePath": "/path/to/document.docx",
"styleMap": "p[style-name='Section Title'] => h1:fresh\nb[style-name='Emphasis'] => em",
"ignoreEmptyParagraphs": false,
"idPrefix": "doc-"
}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:
{
"filePath": "/path/to/document-with-images.docx",
"styleMap": "p[style-name='Code'] => pre:separator('\\n')"
}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:
{
"filePath": "/path/to/document.docx"
}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:
{
"filePath": "/path/to/document.docx",
"styleMap": "p[style-name='Heading 1'] => # "
}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:
p[style-name='Section Title'] => h1:fresh
p[style-name='Subsection Title'] => h2:fresh
p[style-name='Code'] => pre:separator('\n')For more information on style maps, see the mammoth.js documentation.
LICENSE
MIT
Available Tools
2 toolsconvert_docx_to_htmlC
Convert a DOCX file to HTML using mammoth. Supports reading from a file path and returns the HTML content.
Inputs: filePath (required).
convert_docx_to_html_with_imagesA
Convert a DOCX file to HTML with embedded images as base64 data URIs
Inputs: filePath (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have highly overlapping purposes—both convert DOCX to HTML—with the only difference being image handling. An agent could easily misselect between them, as the distinction is subtle and not clearly differentiated in the names alone. This creates ambiguity about which tool to use for a given conversion task.
Both tools follow a consistent verb_noun pattern with 'convert_docx_to_html' as the base, and the second tool adds a descriptive suffix '_with_images'. The naming is predictable and clear, using snake_case uniformly without any deviations or mixed conventions.
With only 2 tools, the server feels thin and under-scoped for a 'Mammoth MCP Server' that implies broader DOCX processing capabilities. This minimal set lacks basic operations like converting to other formats (e.g., Markdown, plain text) or handling DOCX metadata, making it inadequate for comprehensive document conversion tasks.
The tool surface is severely incomplete for a DOCX conversion server. It only covers HTML output with two variants, missing essential operations such as conversion to other formats (e.g., PDF, Markdown), extraction of text or images separately, or handling of DOCX properties. This will cause agent failures when broader document processing is needed.
Maintenance
Related MCP Connectors
Convert DOCX documents to and from PDF, TXT, HTML, ODT, JPG and RTF.
Convert HTML with PDF, DOCX, JPG, PNG, XML, XLSX and XLS conversion workflows.
Parse PDF/Word/PPT/HTML to Markdown; tables as JSON, image extraction, RAG chunking, page ranges.
Convert PDF, DOCX, XLSX and 25 other formats to clean Markdown for LLMs and RAG. No key or account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables seamless content conversion between multiple formats including Markdown, HTML, and DOCX directly within development environments.-
- FlicenseNot gradedqualityDmaintenanceConverts Markdown text to Word documents via HTTP API, providing temporary download links with automatic file cleanup after 2 hours.-
- AlicenseAqualityDmaintenanceConverts Microsoft Office documents (Word, Excel, PowerPoint) to Markdown format with intelligent image extraction and optimization, preserving document structure and metadata.65MIT
- AlicenseNot gradedqualityDmaintenanceConverts DOCX files to Markdown with formatting preservation and image extraction, and provides image analysis tools for document processing workflows.5 npmMIT