docx
A MCP server for Microsoft Word documents using the python-docx library
claude mcp add --transport stdio rookie0x80-docx-mcp python -m docx_mcp.server
How to use
DOCX-MCP is a Python-based MCP server focused on Word document operations using the python-docx library. It exposes a suite of table management capabilities, including creating and deleting tables, adding or removing rows and columns, merging and unmerging cells, and retrieving both table data and styling information. The server is designed to be efficient for AI model workflows, enabling batch updates to cells with rich formatting, while preserving existing styles when updating content. You can run the server in standard input/output mode or via HTTP/SSE transports, making it compatible with a variety of orchestration and integration patterns.
To use the server, start it with the recommended Python module invocation and then interact with the available tools via JSON parameters. Core operations include open_document and save_document for document lifecycle, and a range of table-oriented tools such as create_table, delete_table, add_table_rows, add_table_columns, delete_table_rows, merge_cells, and unmerge_cells. For data work, set_cells_value supports batch updates with individual formatting per cell, while get_table_data_and_structure returns data in array/object/CSV formats and get_table_styles exposes formatting details. For analysis and search, you can run search_table_content and search_table_headers to locate content or headers across tables.
Typical usage flows include opening or creating a document, performing table operations (creating tables with optional headers, modifying structure, and populating cells with content and styles), and then saving the document. The interface is designed for efficiency: batch operations minimize API calls, and range-based data and style retrieval supports large tables without sacrificing performance.
How to install
Prerequisites:
- Python 3.8+ installed on your system
- Git available to clone the repository (or download the source)
Step-by-step installation:
-
Clone the repository: git clone <repository-url> cd docx_table
-
Create and activate a Python virtual environment (optional but recommended): python -m venv venv
On Windows:
venv\Scripts\activate
On macOS/Linux:
source venv/bin/activate
-
Install dependencies: pip install -r requirements.txt
-
Install the package in editable mode (development mode): pip install -e .
-
Run the MCP server: python -m docx_mcp.server
Optional HTTP/SSE transports: python -m docx_mcp.server --transport sse --host localhost --port 8000 python -m docx_mcp.server --transport streamable-http --host localhost --port 8000
Additional notes
Tips and notes:
- Ensure you have Microsoft Word-compatible environment for python-docx to manage tables and formatting correctly.
- When performing batch updates with set_cells_value, you can specify per-cell formatting such as font_family, font_size, bold, italic, alignment, background color, borders, and more.
- Use get_table_data_and_structure to retrieve a table's content alongside its structural metadata; use get_table_styles to inspect cell formatting across ranges.
- If you encounter issues with document paths, ensure file_path is accessible by the service process and use absolute paths when possible.
- The MCP interface is designed for efficiency: prefer batch operations over repeated single-cell updates to minimize IPC/transport overhead.
Related MCP Servers
TexMCP
A small FastMCP-based Microservice that renders LaTeX to PDF. The server exposes MCP tools to render raw LaTeX or templates and produces artifacts
simple
A python implementation of the Model Context Protocol (MCP) server with fastmcp, fastapi and streamablehttp.
ardupilot -sandbox
ArduPilotドローンをAIエージェントから操作するMCPサーバーです。
fastmcp-builder
A comprehensive Claude Code skill for building production-ready MCP servers using FastMCP. Includes reference guides, runnable examples, and a complete implementation with OAuth, testing, and best practices.
REI3-Tickets
A simple FastMCP server for the REI3 Tickets application. Designed to supercharge ticket management with AI!
math -learning
Educational MCP server with math operations, matrix algebra, data visualization, and persistent workspace using FastMCP 3.0