Get the FREE Ultimate OpenClaw Setup Guide →

mcp-docx

MCP server to manipulate DOCX file

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio h4ck4life-mcp-docx-server uv run --with mcp[cli],python-docx,docx2pdf mcp run <your local path>/mcp-docx-server/server_runner.py

How to use

The MCP docx server is designed to manipulate DOCX files, including creating and editing documents. It relies on the Python ecosystem (python-docx for DOCX manipulation and docx2pdf for optional PDF conversion) and is wired into the MCP CLI workflow via the mcp tool. To use it, start the server with the provided configuration and then interact with the MCP framework to pass documents and commands that modify or generate DOCX files. The server is available through the WordDocServer entry point in the example configuration and will process requests as part of your MCP workflow.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • pip available for installing Python packages
  • The MCP CLI tool (mcp) and the uv runner binary (uv) installed on your system

Step-by-step installation:

  1. Install Python and pip if they are not already installed.

    • macOS/Linux: use your package manager (e.g., brew install python3 or apt install python3).
    • Windows: download and install Python from the official site, ensuring that Add Python to PATH is checked.
  2. Install the uv runner tool (uv) which will be used to run the MCP server.

    • Example (via pipx):
      pipx install uv
      
    • Alternatively, install according to your preferred method for the uv tool.
  3. Prepare the MCP docx server configuration.

    • Create a JSON configuration (example uses WordDocServer as the server name):
      {
        "mcpServers": {
          "WordDocServer": {
            "command": "uv",
            "args": [
              "run",
              "--with",
              "mcp[cli],python-docx,docx2pdf",
              "mcp",
              "run",
              "<your local path>/mcp-docx-server/server_runner.py"
            ]
          }
        }
      }
      
  4. Ensure Python dependencies are available when the server runs:

    • The configuration requests python-docx for DOCX manipulation and docx2pdf for PDF conversion. These will be installed as part of the MCP workflow when you deploy or run the server.
  5. Run the server using the MCP config:

    • Example command (as shown in the README):
      uv run --with mcp[cli],python-docx,docx2pdf mcp run <path-to>/mcp-docx-server/server_runner.py
      

Notes:

  • Adjust <your local path> to the actual location of your mcp-docx-server directory.
  • If you run behind a firewall or in a restricted environment, ensure Python, uv, and MCP have network access as needed.

Additional notes

Tips and considerations:

  • The server relies on python-docx for document manipulation; ensure that the package is accessible in the environment where the server_runner.py executes.
  • docx2pdf is optional but included in the example to enable PDF exports; ensure that a compatible headless PDF backend is available on your system if you plan to use it.
  • The configuration uses a single server named WordDocServer. You can rename it as needed, but keep the command and args consistent.
  • Environment variables are not required by the example configuration, but you can set paths or debug options in server_runner.py if you need more control.
  • If you encounter issues with paths, verify that the path to server_runner.py is correct and that Python can access the file without permission errors.

Related MCP Servers

Sponsor this space

Reach thousands of developers