Skip to main content

Word MCP (ms-word-mcp)

English (en) · 日本語 (ja)

PyPI Python License Platform

Real-time Microsoft Word control on Windows and macOS —
an MCP server with 108 tools that works in the document beside you.


An MCP (Model Context Protocol) server that gives AI agents control of a live Microsoft Word, over COM on Windows and Apple Events on macOS. Unlike file-based libraries such as python-docx, it works in the Word you have open, and you can keep typing while it writes elsewhere in the same document.

Status: early release (0.x). Tool names and arguments may still change.

✨ Key Features

  • Working beside you — Every write goes through a range, never your cursor or selection. The window scrolls to what changed
  • Read back after every write — A result says what Word actually holds now, and lists under warnings whatever did not take
  • Every script — Latin, East Asian (Chinese, Japanese, Korean) and complex-script (Arabic, Hebrew...) text each have their own font; grid spacing, ruby, emphasis marks, vertical text and full-width numbering are built in
  • Styles first — Every character and paragraph property can be set on a style as well as on text, so a document's look is defined once
  • Equations — From LaTeX or UnicodeMath, built by Word's own equation editor, numbered (1), (2)... at the right margin by fields that renumber themselves
  • Sees the page — word_get_page_image gives the model a picture of a page as Word lays it out, without capturing your screen
  • Safe by default — Macros stay off while a document opens, and fields that reach outside the document are refused unless you allow them
  • Windows and macOS — The same tools, arguments and answers; where Word for Mac cannot do something, the tool says so

📋 Requirements

  • Windows 10 or 11, or macOS
  • Microsoft Word (Microsoft 365 or 2021 and later)
  • uv

On macOS the first tool call raises the system's automation prompt, and Word has to be allowed there once. See macOS support for what differs.

🚀 Getting Started

Standard config — works in Claude Desktop, Cursor, .mcp.json, and most other MCP clients:

{
  "mcpServers": {
    "word": {
      "command": "uvx",
      "args": ["ms-word-mcp"]
    }
  }
}

Claude Code

User-scoped (available in all projects)

claude mcp add --scope user word uvx ms-word-mcp

Project-scoped (stored in .mcp.json, shared with your team)

claude mcp add --scope project word uvx ms-word-mcp

Cursor

Install in Cursor

Or add manually to ~/.cursor/mcp.json using the standard config above.

Claude Desktop

Edit claude_desktop_config.json using the standard config above. It is at %APPDATA%\Claude\ on Windows and ~/Library/Application Support/Claude/ on macOS.

Codex

Edit ~/.codex/config.toml:

[mcp_servers.ms-word-mcp]
command = "uvx"
args = ["ms-word-mcp"]

VS Code

code --add-mcp '{"name":"word","command":"uvx","args":["ms-word-mcp"]}'

From source

git clone https://github.com/ykuwai/ms-word-mcp.git
cd ms-word-mcp
uv sync
{
  "mcpServers": {
    "word": {
      "command": "uv",
      "args": ["--directory", "/path/to/ms-word-mcp", "run", "ms-word-mcp"]
    }
  }
}

🛠️ Tool Categories

Documents, reading, writing, formatting, styles, lists, tables, pictures, captions and cross-references, the page, equations, floating shapes and pictures, footnotes and endnotes, comments, spelling and a health check, hyperlinks and bookmarks, fields and tables of contents, the view, a picture of a page, and undo.

The full list of tools, by category, is in TOOLS.md. Comments are not here yet.

💡 Example Prompts

Just describe what you want in plain language — no code required.

Simple — topic only

"Write a one-page memo announcing the move to a four-day work week."

With a look — topic and style

"Write a two-page proposal for a new office library. Serif body text, navy headings, and a table of the costs."

Fixing what exists — an open document

"Open report.docx. The headings are only bold text and the bullets are typed by hand: turn them into real headings and lists, then add a table of contents."

Japanese layout

"Set this notice in vertical Japanese on A4, 40 characters by 30 lines, with ruby on the difficult names."

Mathematics

"Add the normal distribution's density as a numbered equation after the second paragraph, and refer to it by its number in the text."

Keywords that help:

Aspect Keywords / Phrases What it does
Structure real headings · table of contents · numbered sections Uses Word's styles and fields, so navigation and page numbers work
Look serif body · navy headings · Yu Mincho for Japanese Defines the look on styles, once for the document
Page A4 · two columns · 40 characters by 30 lines · page numbers at the foot Sets paper, margins, columns and the document grid
Tables table of the costs · merge the header · shade the first row Builds the table with all its cells at once, then formats it
Pictures and shapes caption each figure · wrap the text around it · behind the text Adds captions and cross-references, or floats pictures and shapes
Checking check how each page looks Has the model look at the page images and correct the layout

🔍 Features in Detail

🎯 Document Targeting

word_activate_document chooses the document every later call works on, whichever window is in front. The choice is one value for the whole server, and a client such as Claude Desktop routes every conversation through one server, so pass document on each call when several conversations work at once. It applies to that call only and takes a full path or a file name. A document that is not open is an error, never a fallback to another one.

✍️ Working Beside You

Writes go through ranges, so your cursor and selection stay where they are. Each write scrolls the document's window to what it changed; with a second window on the document (View > New Window), the last one follows and the first stays where you are. To keep every window still, ask the assistant to stop following edits (it calls word_follow_edits), at any point of a conversation; WORD_FOLLOW_EDITS=off starts the server that way. On Windows on ARM (Word running as x64 under emulation), Word has been seen to end now and then in its own layout code after such scrolling in a document with section breaks (#44); it was not seen on an x64 PC in 18 rounds of the same steps. If Word ends that way for you, turn following off.

Each tool call is one Undo step in Word on Windows when the document is the active one; otherwise the result says so under undo.

✅ Answers You Can Trust

Each write reads back what Word now holds. A result with warnings landed only in part, and the warnings say what did not. A result with error changed nothing unless it says otherwise.

Every member and constant is checked against Microsoft's documentation (docs/reference), and what the documentation leaves unstated is measured on a real Word (docs/PROBES.md).

🌏 Every Script

  • Three fonts on all text — Latin, East Asian and complex script are set separately
  • East Asian layout — spacing in grid lines, indents in character widths, line breaking rules, hanging punctuation, emphasis marks, vertical text, tate-chu-yoko (numbers set across in vertical text, word_format_text's horizontal_in_vertical) and ruby (furigana) with word_add_ruby, taken off again with word_remove_ruby
  • List numbering — full-width digits, ①, 一, ア, 가, א, α, а and more

🎨 Styles

word_set_style defines any character and paragraph property on a style; word_format_text and word_set_paragraph_format take the same properties for the exceptions. The English built-in names ("Normal", "Heading 1", "TOC 1"...) work in every language of Word.

Right-to-left text (Hebrew, Arabic): direction: "right_to_left" on paragraphs or on a style. Word keeps a paragraph's start or end alignment when its direction changes, so give alignment in the same call to choose the side; the result says when the side flipped. A style's new direction reaches the paragraphs that only have the style (Word keeps them as they were, writing the old direction on each; the server gives them the new one). Their language is marked with word_set_language, which sets Word's complex-script language for Hebrew and Arabic; a style cannot have one. A paragraph that starts with a number can lose the space after it: a right-to-left mark (U+200F) at the start of the text keeps it.

🧮 Equations

word_insert_equation takes LaTeX or UnicodeMath and has Word's own equation editor build it. With numbered, the number sits at the right margin and is a field, so inserting an equation renumbers the rest. word_insert_inline_equation puts one among a paragraph's words, at the start or end of its text or in place of a placeholder; word_get_equation and word_set_equation reach it by its place in the paragraph (nth). With chapter, numbered equations and captions (word_insert_caption) count within each chapter, (2.1) and Figure 2.1, the chapter's number taken from the numbered heading before them.

🗂️ Content Controls

word_list_content_controls, word_insert_content_control, word_set_content_control and word_delete_content_control read and write the tagged boxes that templates, forms and add-ins keep in a document: their text, tag, title and locks. A tag of tens of thousands of characters, as add-ins keep their data in, goes through whole. word_insert_content_control with around makes text already in the document a control's, formatting and all. On the Mac they go through the VBA bridge, since Word for Mac's scripting has no content controls.

word_unlink_fields turns fields into the text they show, formatted as it is: those of a type (kind) or whose code holds a text (contains), in the main text, the footnotes and the endnotes.

🖼️ Shapes and Floating Pictures

word_insert_shape, word_insert_text_box, word_insert_line and word_insert_floating_picture add objects with text wrapping, position, layer order, fill, line and text. word_set_shape changes them afterwards, crops and fades pictures, moves a picture between floating and in line, and anchors a shape to another paragraph (anchor_to). With header_footer they go in a header or footer instead, as a logo or a rule on every page (on the Mac a floating picture there goes through the VBA bridge).

📄 Seeing a Page

word_get_page_image returns a page as Word lays it out, so the model can check a layout that reading the text back cannot show. On Windows the page comes from Word directly. On macOS Word saves a PDF for a moment and the page is drawn from it. Neither captures the screen.

⚙️ Advanced Configuration

Variable Default What it does
WORD_TOOL_MODE catalog catalog lists three tools that reach the rest; full lists every tool.
WORD_FOLLOW_EDITS on Scroll the document's window to each change. word_follow_edits turns it on or off while the server runs.
WORD_ALLOW_ACTIVE_FIELDS off Allow fields that reach outside the document: INCLUDETEXT, INCLUDEPICTURE, INCLUDE, LINK, IMPORT, RD, EMBED, DATABASE, DDE, DDEAUTO, MACROBUTTON, PRINT, ASK, FILLIN. Off, word_insert_field refuses them and word_update_fields leaves the ones already in a document as they are. On, Word may stop and ask you about them in a dialog of its own, and the tool waits until you answer.
WORD_ALLOW_NETWORK_PATHS off Allow files named by a network path (\\server\share\...). Off, they are refused: saving to one sends the document to that server, and even checking for the file connects to it with your credentials.
WORD_VBA_BRIDGE on Load the server's VBA bridge into Word: a few macros that read paragraphs and find and replace in one call, and on the Mac give comments their replies and done state. Off, everything is read as before, more slowly, and on the Mac replying to or resolving a comment is refused. See The VBA Bridge.
WORD_MAC_FILES_DIR the document's folder macOS: where Word writes the PDF a page picture is drawn from, for a moment. By default the document's own folder, or Word's own folder for a document never saved.

Set them in the server's env:

{
  "mcpServers": {
    "word": {
      "command": "uvx",
      "args": ["ms-word-mcp"],
      "env": { "WORD_FOLLOW_EDITS": "off" }
    }
  }
}

The Tool List: Catalog Mode

A client sends the description of every tool it lists with every request, and the descriptions of these tools come to about 180,000 characters. By default the server lists three tools instead, about 2,500 characters, and the model reaches the rest through them:

Tool What it does
word_describe With no names, the list of all the tools, one line each. With names, their full description and arguments.
word_run Runs one tool: {"tool": "word_insert_paragraphs", "params": {...}}.
word_run_steps Runs several in order, in one call. A step can use what an earlier one answered: "$prev.key" is the previous step's key, "$2.inserted.0.index" the second step's. The first step that fails ends the run and says why.

The tools themselves are the same. What catalog mode gives up is per-tool control in the client: approving or blocking a tool by its name applies to the three tools above rather than to each one. A client that relies on that sets WORD_TOOL_MODE=full.

When Word Is Busy

Calls reach Word one at a time, in the order they were asked for. When Word has a dialog or menu open, a call waits up to 15 seconds for it to close and then answers that Word is busy. A call that is still running after 45 seconds on Windows or 69 on macOS is given up, and the server carries on with the next one. Tools that may take longer, a large find and replace for instance, stop in time and answer complete: false with a warning, so they can be called again.

If Word is not running, word_create_document and word_open_document start it; other tools answer that it is not running.

The VBA Bridge

Reading a paragraph over COM or Apple Events asks Word once for each property, and 200 paragraphs took 8 to 27 seconds. The server ships a Word template, ms-word-mcp-bridge.dotm, whose macros read them inside Word in one call. The macros are the source in WordMcpBridge.bas, and a test checks the template was built from it.

word_get_paragraphs, 200 paragraphs Without the bridge With it
Windows 8.1 s; 11.7 s with detail 0.28 s; 0.30 s with detail
macOS 6.9 s; 26.9 s with detail 0.45 s; 0.53 s with detail

word_find_replace goes through it too: 3,000 matches are replaced in one call, in 2.4 s on Windows and 7.4 s on macOS, where one call used to get through 740 and 1,249 of them. On macOS it also brings wildcard searches, and the whole replacement becomes one Undo step.

The answers are the same, and on the Mac detail now gives what Windows gives (a mixed paragraph's bold reads as mixed, theme and automatic colors as none). On the Mac the bridge also reaches what Word for Mac's scripting lacks: comments' replies and done state, adding table columns, creating a style, paragraph direction and tab stops, a complex-script size and an underline color, and a shape's alt text and vertical anchor.

The first call that needs the template makes it a global template of the Word the server talks to, and the server takes it out again when it stops, so your Word is left as it was. On Windows it is added from the package with AddIns.Add. Word for Mac's scripting cannot add one, so the template is copied to Word's own folder, opened for a moment (which makes a new document from it), and that document's macro adds the template and is closed. If the bridge cannot be used, for instance because macros are turned off by policy, the tools read as before and word_get_app_info says why in vba_bridge.

On macOS 14 and later, writing in another app's folder needs the user's leave: the app the server runs under (a terminal for Claude Code, Claude itself for the Claude desktop app) needs Full Disk Access (System Settings > Privacy & Security > Full Disk Access), then a restart. Without it the bridge cannot be loaded, and vba_bridge says so and names the app.

🔒 Security

The server runs on your computer with your permissions and talks to one local client over stdio; it opens no port and makes no network request of its own.

An AI using these tools can read and change any document open in Word, open any file Word can open, and save or embed files wherever your account can write or read. Text inside a document, a web page or another tool's answer can try to steer the AI, so check what it does with documents you received from someone else, and approve its tool calls where that matters.

What the server does about it:

  • Macros are disabled while it opens a document or creates one from a template. Word would otherwise run them. The document stays open with macros off.
  • The only macros it runs are its own, from the bridge template in the package, and they only do what the tools ask: read paragraphs, find and replace, work with comments, and on the Mac set the formatting its scripting cannot reach. WORD_VBA_BRIDGE=off leaves them out.
  • Fields that reach outside the document are refused and left alone unless you set WORD_ALLOW_ACTIVE_FIELDS.
  • Network paths are refused unless you set WORD_ALLOW_NETWORK_PATHS.
  • A new link goes to http, https, mailto or tel, or to a path relative to the document. A link the document already has is left as it is.

What it does not do: a document opened through these tools does not get Word's Protected View, so open only documents you would open yourself.

To report a vulnerability, see SECURITY.md.

🍎 macOS Support

The same tools, the same arguments, the same answers. What differs is what Word for Mac's scripting can reach, and where it cannot reach something the tool says so.

Through the VBA bridge only, since Word for Mac's scripting cannot reach them (without it the tools say so):

  • word_insert_table_columns, creating a style, and linking a style to numbering
  • Paragraph direction (right to left) and tab stops
  • The size of complex-script text and the color of an underline
  • A style's quick_style and priority
  • Alt text on a floating shape, and where text sits from top to bottom in one
  • Grouping shapes and ungrouping them (word_group_shapes, word_ungroup_shape), and a group's members in word_list_shapes
  • A floating picture in a header or footer
  • Content controls (word_list_content_controls and the rest)
  • Fields in footnotes and endnotes, turned into their text (word_unlink_fields)
  • Replies to comments and their done state, wildcard searches, and text added after an equation that ends the document

Smaller differences:

  • Each change is its own Undo step, because Word for Mac's scripting cannot group them. Tools say so in their results. A replacement through the VBA bridge is one step.
  • Loading the VBA bridge the first time opens a document made from its template for about a second, and leaves the template and a lock file in Word's own folder.
  • Word for Mac is sandboxed: it writes without asking only inside ~/Library/Containers/com.microsoft.Word/Data/Documents, and saving elsewhere may make Word ask for access.
  • Word asks you about each file outside its own folder, so word_insert_picture puts a copy in Word's folder for a moment and reads it there. The first time, macOS may ask once whether the app the server runs in may use Word's data.
  • word_get_page_image has Word save a PDF next to the document for a moment. For a document never saved, the PDF goes in Word's own folder, and macOS may ask the same question.
  • Word for Mac makes a table only in the active document, so inserting a table brings its document forward for a moment and then gives the previously active one back.

🤝 Contributing

Pull requests are welcome. Base them on develop, one topic each, with tests.

uv run pytest -q                    # no Word needed
uv run python scripts/live_check.py # runs every tool on a real Word, in a scratch document

The live check creates a document, runs the tools on it, prints PASS or FAIL for each step, exports a PDF and closes the document. It touches no other document.

On Windows, while a client has the server running, uv sync cannot replace .venv\Scripts\ms-word-mcp.exe; run the tests with uv run --no-sync, or stop the server first.

📄 License

MIT

🙏 Credits

Metadata

Release files for ms-word-mcp 0.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 ms-word-mcp 0.2.0
File Size Uploaded Provenance Actions
ms_word_mcp-0.2.0.tar.gz 648.7 kB With provenance Details for ms_word_mcp-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 962.7 kB

Release files / ms_word_mcp-0.2.0.tar.gz

Download URL ms_word_mcp-0.2.0.tar.gz
Size 648.7 kB
Tags Source
SHA-256 checksum
How to use checksums
713cb44c40e8a2d9da9bbcbff708c941c1ad0ea13d30c4fe65b196e5e01be547
BLAKE2b-256 checksum
How to use checksums
a1a96d70d7ac8392fcc99c3401e63b385395c033644a48045d546ff74fdb14b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / ms_word_mcp-0.2.0-py3-none-any.whl

Download URL ms_word_mcp-0.2.0-py3-none-any.whl
Size 314.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
917ac610601393d5fb2e7ada0f15df129c11dad0dc607c08f9f136dfa2c625f9
BLAKE2b-256 checksum
How to use checksums
a2d850e6fdcdcd5377ef849d11b74ca41da86f99507bd8ec9831d2b0af9991f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for ms-word-mcp 0.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ms_word_mcp-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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