io.github.trsdn/mcp-server-word
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@io.github.trsdn/mcp-server-wordCreate a new Word document, add a table with 5 rows and 3 columns, and export it as a PDF."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WordMcp — Microsoft Word MCP Server
An MCP server that lets AI assistants drive Microsoft Word for Windows through COM automation: open documents, read and edit text, manage paragraphs and tables, set document properties and export to PDF.
Windows only. A local installation of Microsoft Word is required — this server automates the real application, it does not parse
.docxfiles.
Requirements
OS | Windows 10/11 |
Runtime | .NET 9 SDK or runtime |
Office | Microsoft Word 2016 or newer (desktop, not Microsoft Store version) |
Related MCP server: Word Document MCP Server
Installation
dotnet tool install --global WordMcp.McpServerThe tool is then available as mcp-word.
mcp-word --version
mcp-word --helpTo update or remove it later:
dotnet tool update --global WordMcp.McpServer
dotnet tool uninstall --global WordMcp.McpServerTo run an unreleased build instead, pack it locally and install from the output folder:
dotnet pack src\WordMcp.McpServer\WordMcp.McpServer.csproj -c Release -o artifacts
dotnet tool install --global --add-source .\artifacts WordMcp.McpServerWithout installing
The server is listed in the MCP registry as io.github.trsdn/mcp-server-word. Clients that resolve packages themselves can run it through dnx, which fetches the version on demand instead of keeping a global tool around:
{
"servers": {
"word": {
"type": "stdio",
"command": "dnx",
"args": ["WordMcp.McpServer@0.1.0", "--yes"]
}
}
}Client configuration
The server speaks stdio.
VS Code / GitHub Copilot
.vscode/mcp.json:
{
"servers": {
"word": {
"type": "stdio",
"command": "mcp-word"
}
}
}Claude Desktop
%APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"word": {
"command": "mcp-word"
}
}
}Copilot CLI
copilot mcp add word --command mcp-wordConcepts
Every operation runs inside a session. A session owns one Word instance and one open document, identified by a session_id such as word-a1b2c3d4e5f6g.
file(open|create) ──► session_id ──► text / paragraph / table / document ──► file(save) ──► file(close)Paths must be absolute (
C:\Users\me\Documents\report.docx).Supported input formats:
.docx,.docm,.doc,.dotx,.dotm,.rtf.The document must not be open in Word already — WordMcp needs exclusive access.
Word runs invisibly in the background and is terminated when the session closes.
The session service
Sessions normally live inside the MCP server process and disappear with it. WordMcp.Service.exe
is an optional background daemon that holds them instead, so a session survives a restarted client
and can be shared by several of them:
WordMcp.Service.exe --daemon [--idle-minutes 30] # listen until idle or stopped
WordMcp.Service.exe --status # what is it doing?
WordMcp.Service.exe --stop # save open documents and exitStarting it by hand is rarely necessary — a client configured to use it starts it on demand. The pipe it listens on embeds your SID and is ACL'd to it, so sessions are never shared between accounts. It exits on its own once no session has been open for the idle timeout.
To use it, set WORDMCP_SERVICE_MODE=daemon for the MCP server. Every tool call then travels to
the daemon instead of running in the server's own process. Without it the server keeps sessions to
itself, which is what a single client wants: no second process and no startup wait.
Tools
Fifteen tools, each with an action parameter.
file — session lifecycle
Action | Purpose |
| Open an existing document and start a session |
| Create a new document at |
| Save the open document |
| Save (optionally) and close the session |
| List all active sessions |
| Check whether Word can be automated on this machine |
file(action: "open", path: "C:\\Users\\me\\Documents\\report.docx")
// → { "sessionId": "word-a1b2c3d4e5f6g", "fileName": "report.docx", ... }text — content
Action | Purpose |
| Read the whole text or a character range ( |
| Append text, optionally as a new paragraph |
| Find a term; returns positions and surrounding context |
| Replace occurrences ( |
| Apply |
Character positions come from get and find and are Word range offsets.
paragraph — structure
Action | Purpose |
| List paragraphs with index, text, style, alignment and outline level |
| Append a paragraph, optionally with |
| Insert a paragraph before a given index |
| Delete a paragraph by index |
| Apply a style such as |
|
|
Paragraph indices are 1-based, matching Word.
table — tables
Action | Purpose |
| List tables with dimensions and style |
| Create a table with |
| Read all cells of a table as a row/column matrix |
| Write a single cell ( |
| Append a row |
| Delete a row |
| Apply a table style such as |
document — metadata and export
Action | Purpose |
| Word, character, paragraph, page, table and section counts |
| Title, author, subject, keywords, comments, company |
| Update those built-in properties |
| Export to PDF without touching the open document |
| Save a copy in another format |
image — pictures
Action | Purpose |
| List inline images with index, size, alt text and link state |
| Insert a picture, optionally with |
| Resize by |
| Swap the picture behind an index, keeping its size by default |
| Delete an image by index |
| Set the alternative text for accessibility |
field — fields and tables of contents
Action | Purpose |
| List all fields with index, type and field code |
| Insert a table of contents ( |
| Recalculate every table of contents |
| Update all fields, including those in headers and footers |
| Add a page number to the header or footer |
section — sections and page setup
Action | Purpose |
| List all sections with start type, margins, page size and orientation |
| Insert a section break ( |
| Set margins, |
header-footer — headers and footers
Action | Purpose |
| Read the header or footer of one section or of all sections |
| Write text, optionally with an |
| Empty the header or footer |
kind selects header or footer, type selects primary, first-page or even-pages.
style — styles
Action | Purpose |
| List styles; by default only the ones the document uses |
| Add a custom style, optionally based on an existing one |
| Change font and paragraph formatting of a style |
| Remove a custom style |
style_type selects paragraph, character, table or list. Pass in_use_only: false to
list for the full set, which is over 370 entries on a localized Word.
style(action: "create", session_id: "...", name: "Callout", base_style: "Normal")
style(action: "modify", session_id: "...", name: "Callout",
font_size: 11, bold: true, color: "#C00000", space_after: 12)list — bullets and numbering
Action | Purpose |
| Report the list formatting of the paragraphs, including the rendered bullet or number |
| Format a paragraph range as a |
| Set the list level of a paragraph range (1–9) |
| Start the numbering over at a paragraph |
| Strip the list formatting |
Omitting end_index applies the action to start_index alone.
list(action: "apply", session_id: "...", start_index: 2, end_index: 5, list_type: "number")
list(action: "set-level", session_id: "...", start_index: 3, end_index: 4, level: 2)
list(action: "restart", session_id: "...", start_index: 6)comment — review notes
Action | Purpose |
| List the comments with author, date, text and the commented-on text |
| Attach a comment to a paragraph or to a phrase inside it |
| Mark a comment as done, or reopen it |
| Remove a comment |
add comments the whole paragraph unless anchor_text names a phrase inside it. Indexes shift
after delete, so list again before deleting a second comment.
comment(action: "add", session_id: "...", paragraph_index: 4,
text: "Source?", anchor_text: "fifteen percent")
comment(action: "list", session_id: "...", unresolved_only: true)revision — tracked changes
Action | Purpose |
| List the tracked changes and report whether tracking is on |
| Accept one revision, or all of them |
| Reject one revision, or all of them |
| Turn change tracking on or off |
Omitting index on accept/reject handles the whole document, headers and footers included.
revision(action: "set-tracking", session_id: "...", enabled: true)
revision(action: "accept", session_id: "...")bookmark — stable references
Action | Purpose |
| Bookmarks with name, paragraph index and a preview of the marked text |
| Bookmark a paragraph, a paragraph range or a phrase inside a paragraph |
| Read the full bookmarked text |
| Remove a bookmark; the text stays |
Names must start with a letter and may only contain letters, digits and underscores. Bookmarks survive edits elsewhere in the document, which makes them the reliable way to refer back to a passage once paragraph indexes have shifted.
bookmark(action: "add", session_id: "...", name: "Intro", paragraph_index: 2)
bookmark(action: "add", session_id: "...", name: "Growth",
paragraph_index: 4, anchor_text: "fifteen percent")
bookmark(action: "get-text", session_id: "...", name: "Intro")screenshot — see the page
Action | Purpose |
| Render a page as a PNG |
Layout questions — page breaks, table widths, image placement, header positions — are far easier
to answer from the rendered page than from measurements. The PNG is written to a file and the path
returned; include_image: true additionally returns it inline as base64, which is only worth the
context when the image is going to be looked at.
dpi defaults to 150. Use 96 for a quick layout check and 300 for something close to print.
screenshot(action: "page", session_id: "...", page: 2)
screenshot(action: "page", session_id: "...", page: 1,
output_path: "C:/temp/page1.png", dpi: 300, include_image: true)Responses
Every tool returns JSON. Failures are reported as structured payloads, never as a transport error:
{
"success": false,
"isError": true,
"tool": "text",
"action": "Replace",
"errorType": "KeyNotFoundException",
"errorMessage": "Session 'word-unknown' not found."
}Known behaviour and pitfalls
document(save-as)also saves the original. Word has no format-changing "save a copy" API. For any target other than PDF the server callsSaveAs2(target)and thenSaveAs2(original), which persists pending changes to the original file as a side effect. Useexport-pdfwhen you need a side-effect-free export.Colours are hex RGB (
#0078D4). The server converts to the BGR value Word expects.Rights-protected documents (IRM/AIP) are rejected before Word is launched.
A document open in Word blocks the session — close it first.
Word dialogs stall automation. If a call times out, check for an open dialog on the desktop.
Style names are English. Built-in styles (
Heading 1,Title,Table Grid, …) are translated to Word's language-independent style ids, so they work on localized installations. Any other name is passed to Word as-is, which is how custom and localized styles are addressed. Note that Word reports styles under their localized name (Überschrift 1on a German install), which is whystyle(list)returns bothnameandenglish_name— sendenglish_nameback when it is present.Built-in styles cannot be deleted.
style(delete)rejects them with a clear message instead of passing Word's generic COM error through. A custom style that is still applied to a paragraph cannot be deleted either; set those paragraphs to another style first.New documents are written directly, not via Word.
file(create)writes an empty.docx/.docmpackage itself and then opens it. Creating documents through Word instead is unreliable on machines signed in to Microsoft 365, because AutoSave claims the new document for OneDrive and silently ignores the requested local path.Merged table cells are returned as empty strings by
table(read).Image sizes are in points, not pixels (72 pt = 1 inch).
image(insert)andimage(resize)keep the aspect ratio unlesslock_aspect_ratiois set tofalse, so passing onlywidthscales the height along with it.imageonly covers inline pictures. Floating shapes, text boxes and charts are left untouched and do not appear inimage(list), so their presence does not shift image indexes.A table of contents only lists heading paragraphs.
field(insert-toc)returnsentry_count: 0for a document without heading styles — applyHeading 1/Heading 2viaparagraph(add|set-style)first, then runfield(update-toc).field(update-all)also walks headers and footers. Word'sDocument.Fieldscovers the body only, which is why page numbers would otherwise never refresh.image(insert)with a caption uses Word's caption numbering, so the caption readsFigure 1 <your text>(localized on non-English installations) and participates in a table of figures.All measurements are in points, including page margins (1 cm = 28.35 pt, 1 inch = 72 pt).
section(page-setup)appliespaper_sizebefore the margins, because changing the paper size resets them in Word. Without asection_indexthe setup is applied to every section.Headers and footers are inherited between sections. A new section shows the previous section's header until something is written to it.
header-footer(set)with asection_indexbreaks that link automatically, so section 1 keeps its own text.first-pageandeven-pagesheaders need a section switch.header-footer(set)turns onDifferentFirstPagerespectivelyDifferentOddEvenPagesfor you — without it Word stores the text but never renders it.list(apply)starts a new list by default.continue_previous_listis off, because picking up the numbering of an unrelated earlier list is rarely what was meant. Two numbered lists separated by plain paragraphs stay independent; uselist(restart)when Word merges them anyway.Only outline-number lists render distinct levels.
list(set-level)works on any list, but a plainbulletornumberlist shows the same marker on every level — the paragraphs are merely indented.comment(resolve)often fails on Microsoft 365. Word's modern comments treat every comment added through the API as an unposted draft, and a draft cannot be marked as done. The server reports that as a clear message; delete the comment instead.comment(list)returnsresolved: nullon installations that do not expose the state at all.Comment and revision indexes shift. Deleting a comment or accepting a single revision renumbers everything after it, so run
listagain between two such calls instead of reusing the old indexes.revision(accept|reject)without an index also walks headers and footers. Word'sDocument.AcceptAllRevisions()covers the body only, the same gap as withfield(update-all).Tracked changes are recorded only while tracking is on.
revision(set-tracking)does not apply retroactively — turn it on before the edits you want recorded.Bookmark names are restricted by Word. They must start with a letter, may contain only letters, digits and underscores, and are limited to 40 characters. Spaces, hyphens, dots and non-ASCII letters are rejected before the call reaches Word, which would otherwise fail with a generic COM error.
Bookmarks are the stable way to refer to a passage. Paragraph indexes shift with every insertion, bookmarks do not. Bookmark a passage once and use
bookmark(get-text)to re-read it later.bookmark(add)on a paragraph excludes the paragraph mark, soget-textreturns the text without a trailing newline. A bookmark over several paragraphs keeps the marks in between.screenshot(page)renders through a PDF. Word has no API that returns a page as an image, so the server exports the single page withExportAsFixedFormatand rasterizes it. Unsaved changes are included, and the temporary PDF is deleted afterwards.Page numbers come from a fresh repagination. A document that was only ever edited through automation reports a stale page count, so
screenshotrepaginates first. That also means the page count reflects the current layout, not the one at open time.
Building from source
git clone https://github.com/trsdn/mcp-server-word.git
cd mcp-server-word
dotnet build WordMcp.sln -c Release
dotnet test WordMcp.sln --filter "Category!=RequiresWord"Project layout
Project | Purpose |
| Word COM lifecycle: STA threading, sessions, OLE message filter, file validation |
| Command interfaces, command implementations and result models |
| Source files shared by the generators; not a project of its own |
| Roslyn source generator that emits the MCP tool classes |
| stdio MCP server exposing the fifteen tools |
| Unit tests plus integration tests against a real Word |
| Tool-layer unit tests, no Word required |
Generated tool layer
Fourteen of the fifteen tools are generated at build time. The command interfaces in
src/WordMcp.Core/Commands are the single source of truth for the wire contract:
[ServiceCategory("section", "Section")]names the tool class,WordSectionTool.[McpTool("section", Title = ..., Description = ...)]supplies the tool name and the prompt the model reads.[ServiceAction("page-setup")]on each method becomes a value of the generatedWordSectionActionenum.XML documentation on the interface parameters becomes the parameter descriptions in the MCP schema.
The generator merges the parameters of all actions into one method, so a parameter used by only
some actions is emitted as optional. To change the API, edit the interface — never the generated
code. file stays hand-written because it manages sessions rather than operating on one.
Inspect the emitted code under src/WordMcp.McpServer/obj/generated. The tests in
GeneratedToolContractTests compare the generated surface against the interfaces, so a mismatch
fails the build rather than reaching a client.
Tests that need a real Word installation are marked [Trait("Category", "RequiresWord")] and are excluded in CI. Failed integration runs can leave orphaned WINWORD.EXE processes behind, which slow down or block later runs — clean them up with Get-Process WINWORD | Stop-Process -Force before re-running.
Further reading
Document | Covers |
The layers, the request flow and how the tool layer is generated | |
STA threading, releasing COM objects and the Word behaviour behind the pitfalls above | |
Building, testing, adding a tool, cutting a release | |
An agent-facing guide to using the tools in the right order |
Troubleshooting
Symptom | Cause and fix |
| Install Word desktop; the Microsoft Store version cannot be automated |
|
|
Operation times out | A Word dialog is waiting for input; close it and retry |
| Close the document in the Word UI |
Contributing
Bug reports and feature requests go through the issue templates. Pull requests are welcome; CONTRIBUTING.md covers how to build, how to run the two halves of the test suite, and what it takes to add a tool.
Please read the Code of Conduct first.
Do not file a public issue for a security problem — report it privately as described in the security policy.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseBqualityNot gradedmaintenanceEnables AI assistants to create, read, and manipulate Microsoft Word documents with comprehensive formatting, table creation, content management, and document protection capabilities. Supports advanced operations like merging documents, PDF conversion, and rich text formatting through a standardized interface.32
- AlicenseBqualityDmaintenanceEnables AI assistants to create and manipulate Microsoft Word documents programmatically with support for rich text formatting, tables, lists, headings, and find-and-replace operations.1031MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to directly read, edit, and manipulate Word documents, supporting image and table operations, paragraph editing, and search/replace.202MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to create, edit, and extract data from Microsoft Word documents programmatically, supporting document creation, content editing, table manipulation, parameter extraction, and template generation.1MIT
Related MCP Connectors
Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.
AI document editing for agents: draft, edit, export .docx/PDF. 37 MCP tools; agent self-signup.
Generate PDFs from templates via AI chat. Works with Claude, ChatGPT, Cursor, and any MCP client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/trsdn/mcp-server-word'
If you have feedback or need assistance with the MCP directory API, please join our Discord server