Skip to main content
Glama

Office-Word-MCP

License Python

Enterprise-Grade Document Automation Protocol for Amazon Q & Kiro

Overview

Office-Word-MCP is a robust Model Context Protocol (MCP) server designed to enable advanced document processing capabilities for AI assistants like Amazon Q Developer, Kiro, and other MCP-compliant clients.

It provides a standardized interface for AI agents to programmatic create, read, manipulate, and analyze Microsoft Word documents (.docx). By abstracting complex document object models into clean API tools, it empowers AI assistants to generate professional reports, contracts, and documentation workflows autonomously.

Key Benefits

  • Seamless Integration: Optimized for Amazon Q and Kiro environments.

  • Rich Formatting: Support for complex tables, styling, and layout controls.

  • Enterprise Ready: Includes document protection, comment analysis, and structured data handling.

  • Secure: Runs locally with explicit permission controls.

Related MCP server: Claude Document MCP Server

Architecture

Architecture

Features

1. Document Management

  • Lifecycle Control: Create, copy, merge, and convert documents (to PDF).

  • Structure Analysis: Extract outlines, metadata, and statistics.

  • Security: Apply password protection and manage restricted editing.

2. Content Engineering

  • Advanced Tables: Create complex layouts with merges, shading, and custom borders.

  • Rich Text: precision control over fonts, colors, and paragraph styles.

  • Media: Insert images with proportional scaling.

  • Dynamic Lists: XML-compliant bulleted and numbered lists.

3. Review & Collaboration

  • Comment Mining: Extract and filter comments by author or content.

  • Track Changes: (Future roadmap) Support for revision tracking.

Getting Started

Prerequisites

  • Python 3.10 or higher

  • uv (recommended) or pip package manager

Installation

Option 1: Using uvx (Recommended for ephemeral use)

No installation required. You can run the server directly using uvx.

uvx --from office-word-mcp-server word_mcp_server

Option 2: Local Installation

Clone the repository and install dependencies:

git clone https://github.com/GongRzhe/Office-Word-MCP-Server.git
cd Office-Word-MCP-Server
pip install -r requirements.txt

Integration Guide

Amazon Q Developer (VS Code / JetBrains)

To integrate Office-Word-MCP with Amazon Q Developer:

  1. Open your IDE settings and navigate to Amazon Q > MCP Servers.

  2. Add a new server configuration:

    • Name: word-automation

    • Command: uvx

    • Args: --from, office-word-mcp-server, word_mcp_server

  3. Restart your IDE. Amazon Q will now have access to Word tools.

Kiro

Configure the server in your Kiro settings or configuration file:

{
  "mcpServers": {
    "office-word": {
      "command": "uvx",
      "args": ["--from", "office-word-mcp-server", "word_mcp_server"]
    }
  }
}

Other MCP Clients (Claude Desktop, etc.)

Add the following to your MCP configuration file (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "word-server": {
      "command": "uvx",
      "args": ["--from", "office-word-mcp-server", "word_mcp_server"]
    }
  }
}

API Reference

The server exposes the following tools to the AI assistant.

Core Operations

Tool Name

Description

create_document

Create a new blank or template-based document.

get_document_text

Extract all text content from a file.

list_available_documents

Scan directory for valid Word files.

convert_to_pdf

Export .docx to PDF format.

Content & Formatting

Tool Name

Description

add_heading

Insert structured headings (Levels 1-9).

add_paragraph

Add text blocks with style support.

add_table

Create a new table structure.

format_text

Apply bold, italic, color, etc., to text ranges.

Table Management

Tool Name

Description

format_table

Apply styles, borders, and shading to tables.

merge_table_cells

Merge cells horizontally or vertically.

set_table_column_width

Precise control over column dimensions.

(See full tool list in word_mcp_server.py source)

Troubleshooting

Common Issues

Permission Denied

  • Cause: The server cannot access the file system.

  • Fix: Ensure the running process has R/W access to the target directory. On Windows, ensure the file isn't open in Microsoft Word.

Styling Not Applied

  • Cause: Using a style name that doesn't exist in the base template.

  • Fix: Use create_custom_style to define the style before using it, or use standard Word styles (e.g., "Normal", "Heading 1").

Image Insertion Failures

  • Cause: Relative paths may be ambiguous.

  • Fix: Always use absolute paths for images.

Debugging

Set the MCP_DEBUG environment variable to 1 to enable verbose logging:

# Windows (PowerShell)
$env:MCP_DEBUG = "1"

License

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


Built for the Agentic Era.

Available Tools

54 tools
add_endnote_to_documentAdd EndnoteC

Add an endnote to a specific paragraph in a Word document.

Inputs: filename (required), paragraph_index (required), endnote_text (required).

add_footnote_after_textAdd Footnote After TextC

Add a footnote after specific text with proper superscript formatting. This enhanced function ensures footnotes display correctly as superscript.

Inputs: filename (required), search_text (required), footnote_text (required), output_filename.

add_footnote_before_textAdd Footnote Before TextC

Add a footnote before specific text with proper superscript formatting. This enhanced function ensures footnotes display correctly as superscript.

Inputs: filename (required), search_text (required), footnote_text (required), output_filename.

add_footnote_enhancedAdd Footnote EnhancedC

Enhanced footnote addition with guaranteed superscript formatting. Adds footnote at the end of a specific paragraph with proper style handling.

Inputs: filename (required), paragraph_index (required), footnote_text (required), output_filename.

add_footnote_robustAdd Footnote RobustC

Add footnote with robust validation and Word compliance. This is the production-ready version with comprehensive error handling.

Inputs: filename (required), search_text, paragraph_index, footnote_text, +2 more.

add_footnote_to_documentAdd FootnoteC

Add a footnote to a specific paragraph in a Word document.

Inputs: filename (required), paragraph_index (required), footnote_text (required).

add_headingAdd HeadingC

Add a heading to a Word document with optional formatting.

Inputs: filename (required), text (required), level, font_name, +4 more.

add_page_breakAdd Page BreakC

Add a page break to the document.

Inputs: filename (required).

add_paragraphAdd ParagraphB

Add a paragraph to a Word document with optional formatting.

Inputs: filename (required), text (required), style, font_name, +4 more.

add_pictureAdd PictureC

Add an image to a Word document.

Inputs: filename (required), image_path (required), width.

add_tableAdd TableC

Add a table to a Word document.

Inputs: filename (required), rows (required), cols (required), data.

apply_table_alternating_rowsApply Alternating Row ColorsC

Apply alternating row colors to a table for better readability.

Inputs: filename (required), table_index (required), color1, color2.

auto_fit_table_columnsAuto-Fit Table ColumnsC

Set table columns to auto-fit based on content.

Inputs: filename (required), table_index (required).

convert_to_pdfConvert to PDFC
Destructive

Convert a Word document to PDF format.

Inputs: filename (required), output_filename.

copy_documentCopy Word DocumentC
Destructive

Create a copy of a Word document.

Inputs: source_filename (required), destination_filename.

create_custom_styleCreate Custom StyleC

Create a custom style in the document.

Inputs: filename (required), style_name (required), bold, italic, +4 more.

create_documentCreate Word DocumentC
Destructive

Create a new Word document with optional metadata.

Inputs: filename (required), title, author.

customize_footnote_styleCustomize Footnote StyleC

Customize footnote numbering and formatting in a Word document.

Inputs: filename (required), numbering_format, start_number, font_name, +1 more.

delete_footnote_from_documentDelete FootnoteC
Destructive

Delete a footnote from a Word document. Identify the footnote either by ID (1, 2, 3, etc.) or by searching for text near it.

Inputs: filename (required), footnote_id, search_text, output_filename.

delete_footnote_robustDelete Footnote RobustC
Destructive

Delete footnote with comprehensive cleanup and orphan removal. Ensures complete removal from document.xml, footnotes.xml, and relationships.

Inputs: filename (required), footnote_id, search_text, clean_orphans.

delete_paragraphDelete ParagraphC
Destructive

Delete a paragraph from a document.

Inputs: filename (required), paragraph_index (required).

find_text_in_documentFind TextB
Read-only

Find occurrences of specific text in a Word document.

Inputs: filename (required), text_to_find (required), match_case, whole_word.

format_tableFormat TableC

Format a table with borders, shading, and structure.

Inputs: filename (required), table_index (required), has_header_row, border_style, +1 more.

format_table_cell_textFormat Cell TextC

Format text within a specific table cell.

Inputs: filename (required), table_index (required), row_index (required), col_index (required), +7 more.

format_textFormat TextC

Format a specific range of text within a paragraph.

Inputs: filename (required), paragraph_index (required), start_pos (required), end_pos (required), +6 more.

get_all_commentsGet All CommentsA
Read-only

Extract all comments from a Word document.

Inputs: filename (required).

get_comments_by_authorGet Comments by AuthorA
Read-only

Extract comments from a specific author in a Word document.

Inputs: filename (required), author (required).

get_comments_for_paragraphGet Comments for ParagraphA
Read-only

Extract comments for a specific paragraph in a Word document.

Inputs: filename (required), paragraph_index (required).

get_document_infoGet Document InfoD
Read-only

Get information about a Word document.

Inputs: filename (required).

get_document_outlineGet Document OutlineC
Read-only

Get the structure of a Word document.

Inputs: filename (required).

get_document_textGet Document TextB
Read-only

Extract all text from a Word document.

Inputs: filename (required).

get_document_xmlGet Document XMLC
Read-only

Get the raw XML structure of a Word document.

Inputs: filename (required).

get_paragraph_text_from_documentGet Paragraph TextB
Read-only

Get text from a specific paragraph in a Word document.

Inputs: filename (required), paragraph_index (required).

highlight_table_headerHighlight Table HeaderC

Apply special highlighting to table header row.

Inputs: filename (required), table_index (required), header_color, text_color.

insert_header_near_textInsert Header Near TextB

Insert a header (with specified style) before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), header_title (str), position ('before' or 'after'), header_style (str, default 'Heading 1'), target_paragraph_index (int, optional).

Inputs: filename (required), target_text, header_title, position, +2 more.

insert_line_or_paragraph_near_textInsert Line Near TextB

Insert a new line or paragraph (with specified or matched style) before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), line_text (str), position ('before' or 'after'), line_style (str, optional), target_paragraph_index (int, optional).

Inputs: filename (required), target_text, line_text, position, +2 more.

insert_numbered_list_near_textInsert List Near TextA

Insert a bulleted or numbered list before or after the target paragraph. Specify by text or paragraph index. Args: filename (str), target_text (str, optional), list_items (list of str), position ('before' or 'after'), target_paragraph_index (int, optional), bullet_type ('bullet' for bullets or 'number' for numbered lists, default: 'bullet').

Inputs: filename (required), target_text, list_items, position, +2 more.

list_available_documentsList Available DocumentsA
Read-only

List all .docx files in the specified directory.

Inputs: directory.

merge_table_cellsMerge Table CellsC

Merge cells in a rectangular area of a table.

Inputs: filename (required), table_index (required), start_row (required), start_col (required), +2 more.

merge_table_cells_horizontalMerge Cells HorizontallyC

Merge cells horizontally in a single row.

Inputs: filename (required), table_index (required), row_index (required), start_col (required), +1 more.

merge_table_cells_verticalMerge Cells VerticallyC

Merge cells vertically in a single column.

Inputs: filename (required), table_index (required), col_index (required), start_row (required), +1 more.

protect_documentProtect DocumentB

Add password protection to a Word document.

Inputs: filename (required), password (required).

replace_block_between_manual_anchorsReplace Block Between AnchorsC

Replace all content between start_anchor_text and end_anchor_text (or next logical header if not provided).

Inputs: filename (required), start_anchor_text (required), new_paragraphs (required), end_anchor_text, +2 more.

replace_paragraph_block_below_headerReplace Block Below HeaderC

Reemplaza el bloque de párrafos debajo de un encabezado, evitando modificar TOC.

Inputs: filename (required), header_text (required), new_paragraphs (required), detect_block_end_fn.

search_and_replaceSearch and ReplaceC
Destructive

Search for text and replace all occurrences.

Inputs: filename (required), find_text (required), replace_text (required).

set_table_alignment_allSet Table AlignmentC

Set text alignment for all cells in a table.

Inputs: filename (required), table_index (required), horizontal, vertical.

set_table_cell_alignmentSet Cell AlignmentC

Set text alignment for a specific table cell.

Inputs: filename (required), table_index (required), row_index (required), col_index (required), +2 more.

set_table_cell_paddingSet Cell PaddingC

Set padding/margins for a specific table cell.

Inputs: filename (required), table_index (required), row_index (required), col_index (required), +5 more.

set_table_cell_shadingSet Table Cell ShadingC

Apply shading/filling to a specific table cell.

Inputs: filename (required), table_index (required), row_index (required), col_index (required), +2 more.

set_table_column_widthSet Column WidthC

Set the width of a specific table column.

Inputs: filename (required), table_index (required), col_index (required), width (required), +1 more.

set_table_column_widthsSet Column WidthsC

Set the widths of multiple table columns.

Inputs: filename (required), table_index (required), widths (required), width_type.

set_table_widthSet Table WidthC

Set the overall width of a table.

Inputs: filename (required), table_index (required), width (required), width_type.

unprotect_documentUnprotect DocumentC

Remove password protection from a Word document.

Inputs: filename (required), password (required).

validate_document_footnotesValidate FootnotesB
Read-only

Validate all footnotes in document for coherence and compliance. Returns detailed report on ID conflicts, orphaned content, missing styles, etc.

Inputs: filename (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.4/5.0

    Scored across 54 tools

    Disambiguation2/5

    Multiple footnote tools (e.g., add_footnote_enhanced, add_footnote_robust) have overlapping purposes, causing confusion. Similarly, there are many very similar table manipulation tools. The boundaries between tools are often unclear.

    Naming Consistency3/5

    Overall follows verb_noun pattern but with inconsistencies like 'add_footnote_enhanced' vs 'add_footnote_to_document' and 'delete_footnote_robust'. Some tools use vague suffixes like '_robust' that break consistency.

    Tool Count2/5

    54 tools is excessive for a Word document server. Many tools are redundant (e.g., 5+ footnote adding methods) and could be consolidated. The count suggests poor scoping and duplication.

    Completeness3/5

    Covers basic CRUD, text manipulation, tables, footnotes, comments, and protection. However, lacks common features like track changes, mail merge, headers/footers (document headers), and more advanced layout options.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      A comprehensive Model Context Protocol server that processes Microsoft Word documents with full formatting support, enabling text extraction, HTML/Markdown conversion, structure analysis, and image extraction.
      5
      2
      -