Skip to main content
Glama
word-automation-mcp

word-automation-mcp

by sbsamarski

word-automation-mcp

A feature-rich MCP server for deep Microsoft Word .docx editing on Windows.

This server drives the installed Microsoft Word through COM automation. Word performs the edits. That gives the server native support for bookmarks, REF fields, content controls, dropdown lists, comments, tracked changes, tables, images, headers, footers, and page layout.

It was built after comparing several Word MCP servers. Those servers mostly edit OOXML directly. That approach is useful, but it is weak at Word-native objects such as dropdown content controls and updating fields. This server uses Word itself so those objects stay real Word objects.

Status

  • Version: 1.1.0

  • MCP tools: 139

  • Transport: stdio

  • Platform: Windows with Microsoft Word installed

  • Python: 3.10 or newer

  • MCP SDK: 2.x

A full smoke test ran against a real 14-table employment form. It exercised every major tool group, saved the DOCX, exported a PDF, and reopened the result in Word.

Related MCP server: KitchenSink4Word

Install

python -m pip install -r D:\Sergey\Development\Agent\word-automation-mcp\requirements.txt

For a package install:

python -m pip install -e D:\Sergey\Development\Agent\word-automation-mcp

After a package install, the server command is:

word-automation-mcp

Configure pi

The user-level pi MCP file is:

C:\Users\serge\.pi\agent\mcp.json

Add this entry:

{
  "mcpServers": {
    "word": {
      "command": "python",
      "args": ["D:\\Sergey\\Development\\Agent\\word-automation-mcp\\server.py"],
      "description": "Deep Microsoft Word .docx editing through Word COM automation",
      "exposure": "direct",
      "enabled": true
    }
  }
}

Use exposure: "direct" if you want the model to call the tools directly. Pi's default codemode exposure hides them from normal tool selection.

After editing the file, run /reload in pi. Then check the connection:

pi mcp list

The tools appear as mcp__word__word_<name>.

Basic workflow

  1. Call word_open_document with the full path to a .docx file.

  2. Use the returned doc_key in later calls. The default key is active.

  3. Call word_save_document or word_save_document with a new path.

  4. Call word_close_document.

The server keeps Word running while the MCP session is active. It closes documents and quits Word when the session ends.

Example:

{"tool": "word_open_document", "arguments": {"path": "D:\\Docs\\Form.docx", "doc_key": "form"}}
{"tool": "word_get_document_info", "arguments": {"doc_key": "form"}}
{"tool": "word_save_document", "arguments": {"doc_key": "form", "path": "D:\\Docs\\Form_edited.docx"}}

Anchors

Many editing tools accept an anchor object. This tells the tool where to edit.

Supported forms:

{"type": "start"}
{"type": "end"}
{"type": "text", "text": "First Name", "occurrence": 1, "include": true}
{"type": "paragraph", "index": 15, "include": true}
{"type": "bookmark", "name": "Candidate_First_Name", "include": true}
{"type": "cell", "table": 2, "row": 2, "column": 2}
{"type": "range", "start": 100, "end": 140}
{"type": "header", "section": 1, "index": 1}
{"type": "footer", "section": 1, "index": 1}

include controls whether the tool uses the whole found text or only the point before it.

Content-control selectors

Control tools accept:

  • 4 — control number 4.

  • "4" — the same.

  • "tag=driving_category" — by tag.

  • "title=Driving licence category" — by title.

  • "driving_category" — matches tag or title.

Picture selectors

Picture tools accept:

  • 1 — first inline picture if present, otherwise first floating shape.

  • "inline:1" — first inline picture.

  • "shape:1" — first floating shape.

Colours

Colour parameters accept a hex string such as #1F4E79 or a colour name such as blue, red, green, yellow, white, black, navy, or gray.

Feature groups

Document and inspection

  • Open, close, save, save-as, and export to PDF.

  • Read text, paragraphs, outline, styles, fields, bookmarks, comments, revisions, and XML.

  • Read page setup, sections, headers, footers, images, and custom properties.

Key tools:

  • word_open_document

  • word_close_document

  • word_save_document

  • word_get_document_info

  • word_get_text

  • word_find_text

  • word_get_document_xml

  • word_get_page_setup

  • word_get_section_info

  • word_get_headers_footers

  • word_get_images

  • word_list_bookmarks

  • word_list_fields

  • word_list_comments

  • word_list_revisions

  • word_get_custom_properties

  • Exact-range bookmarks.

  • Bookmark text retrieval.

  • Rename and delete bookmarks.

  • Real updating REF cross-references.

  • Generic fields.

  • Field update and field-code display.

  • Internal and external hyperlinks.

Key tools:

  • word_insert_bookmark

  • word_get_bookmark_text

  • word_rename_bookmark

  • word_insert_cross_reference

  • word_insert_field

  • word_update_fields

  • word_delete_field

  • word_toggle_field_codes

  • word_insert_internal_link

  • word_insert_hyperlink

  • word_list_hyperlinks

Content controls and dropdowns

  • Insert text, plain text, combo box, dropdown, date, picture, checkbox, group, and rich text controls.

  • Replace dropdown choice lists.

  • Select dropdown values.

  • Set titles, tags, placeholders, and lock states.

  • Set checkbox state and date display format.

Key tools:

  • word_insert_dropdown

  • word_set_dropdown_choices

  • word_set_dropdown_value

  • word_insert_content_control

  • word_get_content_control

  • word_list_content_controls

  • word_set_content_control_properties

  • word_set_content_control_lock

  • word_set_checkbox_state

  • word_set_date_control_format

Tables

  • Create, read, and delete tables.

  • Add and delete rows and columns.

  • Merge and split cells.

  • Set cell text and read cell format.

  • Set styles, borders, widths, alignment, autofit, repeated headers, row height, padding, vertical alignment, shading, and fonts.

  • Sort tables.

  • Convert text to tables and tables to text.

Key tools:

  • word_insert_table

  • word_get_table

  • word_list_tables

  • word_delete_table

  • word_add_table_rows

  • word_add_table_columns

  • word_delete_table_row

  • word_delete_table_column

  • word_merge_cells

  • word_split_cell

  • word_format_table

  • word_set_table_borders

  • word_set_table_column_width

  • word_set_table_width

  • word_set_table_autofit

  • word_set_table_repeat_header

  • word_set_cell_shading

  • word_set_cell_border

  • word_set_cell_margins

  • word_set_cell_vertical_alignment

  • word_get_cell_format

  • word_sort_table

  • word_convert_text_to_table

  • word_convert_table_to_text

Headers and footers

  • Set and clear text.

  • Add page numbers, page count, and generic fields.

  • Format header and footer text.

  • Set first-page, odd/even, and link-to-previous options.

  • Read all header and footer stories.

Key tools:

  • word_set_header_footer

  • word_clear_header_footer

  • word_add_page_number

  • word_add_header_footer_field

  • word_format_header_footer

  • word_set_header_footer_options

  • word_get_headers_footers

Pictures and shapes

  • Insert pictures with size and wrap control.

  • Read picture details.

  • Resize, crop, rotate, position, wrap, border, and set transparency.

  • Replace or delete pictures.

  • Add and remove text watermarks.

Key tools:

  • word_insert_picture

  • word_get_images

  • word_get_picture_info

  • word_set_picture_size

  • word_set_picture_wrap

  • word_set_picture_alt_text

  • word_set_picture_border

  • word_rotate_picture

  • word_crop_picture

  • word_set_picture_position

  • word_set_picture_transparency

  • word_replace_picture

  • word_delete_picture

  • word_add_text_watermark

  • word_remove_watermark

Formatting

  • Basic and advanced character formatting.

  • Paragraph formatting and borders.

  • Styles and lists.

  • Page setup, columns, background colour, and language.

Key tools:

  • word_format_range

  • word_format_characters

  • word_format_paragraph

  • word_set_paragraph_border

  • word_set_paragraph_shading

  • word_clear_formatting

  • word_apply_style

  • word_create_style

  • word_modify_style

  • word_delete_style

  • word_get_style_info

  • word_apply_list_format

  • word_set_list_start

  • word_set_page_setup

  • word_set_section_columns

  • word_set_background_color

  • word_set_document_language

Comments and tracked changes

  • Add, list, reply to, resolve, and delete comments.

  • Turn tracking on and off.

  • List, accept, and reject revisions.

Key tools:

  • word_add_comment

  • word_reply_to_comment

  • word_resolve_comment

  • word_delete_comment

  • word_list_comments

  • word_set_track_changes

  • word_list_revisions

  • word_accept_revision

  • word_reject_revision

  • word_accept_all_revisions

  • word_reject_all_revisions

Document features

  • Tables of contents.

  • Footnotes and endnotes.

  • Custom properties.

  • Document protection.

  • PDF export.

Key tools:

  • word_insert_toc

  • word_update_toc

  • word_list_tocs

  • word_insert_footnote

  • word_insert_endnote

  • word_list_footnotes

  • word_list_endnotes

  • word_set_custom_property

  • word_delete_custom_property

  • word_protect_document

  • word_unprotect_document

  • word_export_pdf

COM escape hatch

These tools reach Word object-model paths that do not have a dedicated tool.

  • word_get_com_property — read a property, for example doc.Tables(10).Rows(1).HeadingFormat.

  • word_set_com_property — set a property.

  • word_call_com_method — call a COM method with JSON arguments.

Use these carefully. They are powerful and can change any part of the document.

Example: redesign a form

{"tool": "word_set_cell_text", "arguments": {"table_index": 2, "row": 2, "column": 2, "text": "Aisha"}}
{"tool": "word_insert_bookmark", "arguments": {"name": "Candidate_First_Name", "anchor": {"type": "cell", "table": 2, "row": 2, "column": 2}}}
{"tool": "word_insert_cross_reference", "arguments": {"bookmark_name": "Candidate_First_Name", "anchor": {"type": "cell", "table": 13, "row": 1, "column": 2}, "prefix": "Applicant: "}}
{"tool": "word_set_dropdown_choices", "arguments": {"control": "4", "choices": ["Choose", "Native", "Fluent", "Intermediate", "Basic"]}}
{"tool": "word_format_table", "arguments": {"table_index": 10, "style": "Table Grid", "borders": true, "repeat_header": true, "header_shading": "#1F4E79", "header_font_color": "#FFFFFF"}}
{"tool": "word_add_page_number", "arguments": {"which": "footer", "format": "page_of_n", "alignment": "center"}}

Tests

The repository includes an end-to-end smoke test:

python tests/smoke_test.py --source path\to\input.docx --output-dir path\to\output

It starts the server over stdio, registers 139 tools, edits a copy of the document, saves a DOCX, exports a PDF, and closes the document.

Known limitations

  • Microsoft Word must be installed on Windows. This is not a headless OOXML editor.

  • Word COM automation is single-threaded. The server keeps all COM calls on one thread.

  • The server is intended for one client session. Do not run two copies against the same document.

  • Some Word builds reject a few optional operations. In those cases a tool returns applied: false instead of failing the whole call. This affects custom-property writes, comment resolving, and some crop or rotate operations.

  • Text wrapped in a field can remain inside a tracked change until you accept revisions in Word.

  • Always save to a new path or keep a backup while you test a redesign.

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables full-featured editing of Word .docx files through natural language, including merge-aware table operations, bulk cell edits, footnotes/endnotes, TOC management, tracked changes, and document comparison.
      10
      18
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables controlling Microsoft Word desktop on Windows through COM, with tools for document management, content editing, formatting, tables, layout, references, review, and optional COM/VBA gateway operations.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to create, read, edit, format, and manage Microsoft Word .docx documents, including tables, images, headers and footers, styles, exports, page setup, and optional COM automation.
      MIT