Skip to main content

Word MCP Server

High-performance Model Context Protocol (MCP) server for programmatic Word (.docx) document generation and manipulation

PyPI Version Python Version uv CodeQL Security Policy Rules for AI License MCP Compatible

Word MCP Server (word-mcp, PyPI: luiccian-word-mcp) is a high-performance Python server implementing the Model Context Protocol (MCP) to provide token-optimized Word document (.docx) creation, batch synthesis, and inspection capabilities for AI assistants (Claude Desktop, Claude Code, Cursor, VS Code / GitHub Copilot, Antigravity, Windsurf, Cline).

Designed from the ground up for maximum token efficiency, it replaces chatty micro-iterations with single-pass document construction, saving over 90% of model tokens and conversational turns.


Key Architectural Highlights

  • Compound Mode by Default (v3.0.0): Registers 9 tools by default (build_document, create_from_markdown, batch_add_content, plus 6 action-dispatched domain tools: word_document, word_content, word_format, word_protection, word_footnote, word_property) to reduce tool-schema context overhead by 77.5%. Set WORD_MCP_TOOLS=full (or granular) to expose all 40 individual tools.
  • Single-Pass Document Builder: Create complete, publication-ready documents (headers, footers, dynamic PAGE numbers, margins, headings, markdown styling, styled callout boxes, tables, TOCs, images, and lists) in one single MCP call (build_document).
  • Markdown Direct Generation: Turn structured Markdown into styled Word documents in one pass (create_from_markdown), including tables, nested lists, inline links, and GitHub-style alert callouts (> [!NOTE], > [!TIP], > [!IMPORTANT], > [!WARNING], > [!CAUTION]).
  • Visual Design Presets: Built-in typography and spacing standards (modern, formal, academic, compact, report, apa) with optional font_name, font_size, and page_size overrides.
  • Lightweight Outline Inspection: Extract paragraph previews and table counts without dumping full body text (get_document_outline), saving thousands of context tokens.
  • Batch Content Ingestion: Append multiple sections, tables, callouts, and lists to existing documents in a single atomic operation (batch_add_content).
  • Protection & Security: Password encryption, editing restrictions, file integrity checks, and headless PDF export.
  • Complete Tool Reference: See docs/TOOLS.md for every tool signature, return shape, and parameter contract.
  • Zero-Install Execution: Instant launch with uvx luiccian-word-mcp.

No manual clone or virtual environment management required. Run the server directly using Astral uv:

# Run with stdio transport (default for AI IDEs)
uvx luiccian-word-mcp

# Or run with SSE transport
uvx luiccian-word-mcp --transport sse --host 127.0.0.1 --port 8000

MCP Client Configuration

Configure your AI client by passing environment variables directly in the client's env block (no .env file is required). By default, the server starts in compound mode (9 tools); set "WORD_MCP_TOOLS": "full" in env to expose all 40 granular tools.

1. Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "word-mcp": {
      "command": "uvx",
      "args": ["luiccian-word-mcp"],
      "env": {
        "WORD_MCP_DIRS": "/path/to/your/documents"
      }
    }
  }
}

2. Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "word-mcp": {
      "command": "uvx",
      "args": ["luiccian-word-mcp"],
      "env": {
        "WORD_MCP_DIRS": "${workspaceFolder}"
      }
    }
  }
}

3. VS Code / GitHub Copilot (.vscode/mcp.json)

VS Code uses a top-level "servers" key and explicit "type": "stdio":

{
  "servers": {
    "word-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": ["luiccian-word-mcp"],
      "env": {
        "WORD_MCP_DIRS": "${workspaceFolder}"
      }
    }
  }
}

4. Antigravity / Windsurf (mcp_config.json)

{
  "mcpServers": {
    "word-mcp": {
      "command": "uvx",
      "args": ["luiccian-word-mcp"],
      "env": {
        "WORD_MCP_DIRS": "/path/to/your/documents"
      }
    }
  }
}

5. Cline / Roo Code (cline_mcp_settings.json)

{
  "mcpServers": {
    "word-mcp": {
      "command": "uvx",
      "args": ["luiccian-word-mcp"],
      "env": {
        "WORD_MCP_DIRS": "/path/to/your/documents"
      }
    }
  }
}

6. Claude Code CLI

claude mcp add word-mcp \
  -e WORD_MCP_DIRS="/path/to/your/documents" \
  -- uvx luiccian-word-mcp

Environment Variables

All runtime configuration is supplied via standard OS environment variables or the MCP client's env object:

Variable Default Description
WORD_MCP_DIRS (current directory) Comma-separated list of allowed root directories for reading, writing, and listing .docx files. Legacy MCP_ALLOWED_DIRECTORIES remains supported as a fallback.
WORD_MCP_TOOLS compound Tool surface mode: compound (9 tools: 3 single-pass + 6 domain dispatchers) or full (or granular, all 40 tools). Legacy WORD_MCP_TOOL_MODE remains supported as a fallback.
WORD_MCP_LOG_LEVEL INFO Logging verbosity (DEBUG, INFO, WARNING, ERROR, CRITICAL) written strictly to stderr.
WORD_MCP_DEV_MODE false Set to true to default logging to DEBUG and log full exception tracebacks to stderr.

Token Optimization: Single-Pass vs. Legacy

Metric Legacy Micro-Calls Word MCP Single-Pass
Tool Calls 15 - 35 calls per document 1 single call (build_document)
Token Usage ~15,000 - 30,000 tokens ~800 - 1,500 tokens (90%+ savings)
Disk Operations Multiple file writes Single in-memory assembly and write
Generation Time 30 - 60 seconds Single in-memory assembly

Visual Design Presets

Preset Font Family Body Size Line Spacing Margins Best For
modern (Default) Calibri 11.0 pt 1.15 2.5 cm Executive summaries, business proposals, corporate reports
formal Times New Roman 12.0 pt 1.50 Top/Bottom 2.5 cm, Left 3.0 cm Legal contracts, official letters, meeting minutes
academic Times New Roman 12.0 pt 2.00 (Double) 2.54 cm (1 inch) University papers, research articles, theses (APA/MLA)
compact Arial 10.0 pt 1.00 (Single) 2.0 cm Invoices, datasheets, internal memos

Modular Skills Ecosystem

The repository provides 3 modular, specialized skills in skills/ for LLMs:

  • word-document-creator: Instructs the model to build complete documents in 1 single pass with headers, footers, pagination, tables, callouts, and presets.
  • word-document-editor: Focuses on lightweight outline inspection, batch mutations, search and replace, and document merging.
  • word-document-security: Handles password locking, editing restrictions, and PDF export for distribution.

Security

  • Security Policy: See SECURITY.md for vulnerability disclosure, protection metadata, and threat modeling.
  • Rules for AI Assistants: See AGENTS.md for official development directives, coding standards, and token optimization rules.
  • Directory Isolation: Set WORD_MCP_DIRS to restrict document operations strictly to designated folders. Path canonicalization prevents directory traversal.
  • Trusted Publishing: Tag-driven PyPI releases (v*.*.*) use GitHub Actions OIDC and PEP 740 artifact attestation.

Development

# Clone the repository
git clone https://github.com/LuiccianDev/word-mcp.git
cd word-mcp

# Install dependencies with Astral uv
uv sync --all-groups

# Run server locally
uv run luiccian-word-mcp

# Run linting and type checking
uv run ruff check src tests scripts
uv run mypy src

# Run test suite
uv run pytest

License

This project is licensed under the MIT License. See the LICENSE file for details.

Word MCP Server • Maintained by LuiccianDev

Metadata

Release files for luiccian-word-mcp 3.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for luiccian-word-mcp 3.2.0
File Size Uploaded Provenance Actions
luiccian_word_mcp-3.2.0.tar.gz 62.0 kB Without provenance Details for luiccian_word_mcp-3.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for luiccian-word-mcp 3.2.0
File Interpreter ABI Platform Actions
luiccian_word_mcp-3.2.0-py3-none-any.whl Python 3 none any Details for luiccian_word_mcp-3.2.0-py3-none-any.whl

Total release size: 141.6 kB

Release files / luiccian_word_mcp-3.2.0.tar.gz

Download URL luiccian_word_mcp-3.2.0.tar.gz
Size 62.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3c62d06cdd5bfa39823840643cc584951adeceebb3c9638c06bb15bb486ad30f
BLAKE2b-256 checksum
How to use checksums
19db0e74a74650d9390a461a4a503032ad9f968757def60bc7f72a7bbfffb429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / luiccian_word_mcp-3.2.0-py3-none-any.whl

Download URL luiccian_word_mcp-3.2.0-py3-none-any.whl
Size 79.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76e47ddb8422e064b6920823aac0e5f280e0b2725f1a262d40dd41d75272c3b6
BLAKE2b-256 checksum
How to use checksums
70f3ed6eac842fbcca6d688eb6daa49eeaa69654e910ff720176e18af29895de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for luiccian-word-mcp 3.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page