Microsoft Word MCP Server for DOCX Manipulation
Manipulate DOCX files with an MCP server to create, read, and edit Microsoft Word documents programmatically.
npx -y @GongRzhe/Office-Word-MCP-ServerOverview
The Microsoft Word MCP Server for DOCX Manipulation is a small HTTP service that exposes programmatic operations for creating, reading and editing DOCX files. It implements a Model Context Protocol (MCP) style interface so language models or other orchestrators can call document tools as discrete actions. The server is useful when you want deterministic, scriptable DOCX workflows (generate reports, extract text, perform template edits, assemble documents) without a full desktop Word installation.
The server focuses on common Word operations (create documents, insert paragraphs, add headings, images and tables, find-and-replace, merge documents, export to PDF) and provides simple REST endpoints and an MCP-compatible executor endpoint. That makes it easy to integrate with LLM chains, backend jobs, or developer scripts that need to manipulate .docx reliably.
Features
- Create and save DOCX documents programmatically
- Read and extract text or structured content (paragraphs, headings, tables)
- Edit existing DOCX: replace text, insert content, append sections
- Upload, download and list stored documents
- Merge multiple DOCX files into a single document
- Convert DOCX to PDF (if a converter is available)
- MCP-compatible tool execution endpoint for LLM-driven workflows
- Simple authentication and configuration options, Docker support
Installation / Configuration
Clone the repository and install dependencies with pip:
Set environment variables (example):
# where uploaded/docs are stored
# optional bearer token for simple auth
Run the server:
# or if the repository provides a cli entry:
# MCP_HOST=0.0.0.0 MCP_PORT=8080 python -m mcp_server
Docker example:
Available Tools
The server exposes a set of tools (available via a dedicated MCP endpoint that accepts a tool name plus JSON input). Typical tool names and their responsibilities:
- create_docx — create a new DOCX with content blocks (headings, paragraphs, tables, images)
- read_docx — extract full text or structured sections from an existing DOCX
- edit_docx — apply edits such as find-and-replace, insert paragraph, append section
- upload_docx — store an uploaded DOCX on the server
- download_docx — retrieve a stored DOCX file
- list_docs — list stored documents and metadata
- merge_docx — combine multiple DOCX files into one
- convert_docx — convert a DOCX to PDF (if supported by environment)
Common REST endpoints (typical layout):
| Endpoint | Method | Purpose |
|---|---|---|
| /mcp | POST | Execute an MCP tool invocation (tool + input JSON) |
| /docs/upload | POST | Upload a DOCX file |
| /docs/{id}/download | GET | Download a DOCX by id |
| /docs | GET | List stored docs |
| /health | GET | Health check |
Example MCP request body (JSON):
Use Cases
- Automated report generation:
- A scheduled job uses create_docx to generate weekly reports from analytics data; download_docx returns the final file which is emailed or archived.
- LLM-driven document editing:
- An LLM analyzes a contract and calls edit_docx via the MCP endpoint to apply requested changes (replace clause text, insert signature block).
- Template population:
- upload_docx stores a DOCX template; create_docx or edit_docx fills placeholders with form data to produce personalized letters.
- Document assembly:
- merge_docx combines multiple chapter DOCX files produced by different services into a single deliverable.
- Data extraction and indexing:
- read_docx extracts headings, paragraphs and tables for indexing into a search engine or knowledge base.
Quick examples
Create a DOCX via curl (MCP execution):
Python example (requests):
=
=
=
=
# structured text / extracted data
Resources
- Repository: https://github.com/GongRzhe/Office-Word-MCP-Server
- Look for README, examples and any provided API docs in the repo for concrete request/response schemas and authentication details.
This server is intended to be a straightforward programmatic bridge for DOCX workflows and to serve as a toolset easily callable from automation scripts or LLM toolchains.