This MCP Office Interop Word Server allows you to programmatically control Microsoft Word documents through the Model Context Protocol (MCP). It's a bridge between MCP clients and Word's COM automation capabilities on Windows.
npm install
npm run build
The server supports two different MCP transport methods:
This mode is suitable for local clients communicating via standard input/output:
npm start
or
node dist/index.js
Connect your MCP client using the stdio method, pointing to the node dist/index.js
command.
This mode uses HTTP and Server-Sent Events for web-based or remote clients:
PowerShell:
$env:MCP_TRANSPORT="sse"; npm start
Bash / Cmd:
MCP_TRANSPORT=sse npm start
The server starts an HTTP server on port 3001 (or the port specified by the PORT
environment variable) with:
http://localhost:3001/sse
http://localhost:3001/messages
filePath
(string): Absolute path to the documentfilePath
(string): Absolute path to save tofileFormat
(number, optional): Numeric WdSaveFormat
value (e.g., 16 for docx, 17 for pdf)saveChanges
(number, optional): WdSaveOptions
value (0=No, -1=Yes, -2=Prompt). Default: 0text
(string): Text to insertcount
(number, optional): Number of units to delete (default: 1). Positive=forward, negative=backwardunit
(number, optional): WdUnits
value (1=Char, 2=Word, etc.). Default: 1findText
(string): Text to findreplaceText
(string): Replacement textmatchCase
(boolean, optional): Default: falsematchWholeWord
(boolean, optional): Default: falsereplaceAll
(boolean, optional): Default: trueunderlineStyle
(number, optional): WdUnderline
value (default: 1=Single)alignment
(number): WdParagraphAlignment
value (0=Left, 1=Center, 2=Right, 3=Justify)indentPoints
(number): Indent value in pointsindentPoints
(number): Indent value in pointsindentPoints
(number): Indent value in points (positive=indent, negative=hanging)spacePoints
(number): Space value in pointsspacePoints
(number): Space value in pointslineSpacingRule
(number): WdLineSpacing
value (0=Single, 1=1.5, 2=Double, 3=AtLeast, 4=Exactly, 5=Multiple)lineSpacingValue
(number, optional): Value needed for rules 3, 4, 5numRows
(number): Number of rowsnumCols
(number): Number of columnstableIndex
(number): 1-based table indexrowIndex
(number): 1-based row indexcolIndex
(number): 1-based column indextext
(string): Text to settableIndex
(number): 1-based table indexbeforeRowIndex
(number, optional): Insert before this 1-based row index (or at end if omitted)tableIndex
(number): 1-based table indexbeforeColIndex
(number, optional): Insert before this 1-based column index (or at right end if omitted)tableIndex
(number): 1-based table indexformatName
(string | number): Style name or WdTableFormat
valuefilePath
(string): Absolute path to the image filelinkToFile
(boolean, optional): Default: falsesaveWithDocument
(boolean, optional): Default: trueshapeIndex
(number): 1-based index of the inline shapeheightPoints
(number): Height in points (-1 or 0 to auto-size)widthPoints
(number): Width in points (-1 or 0 to auto-size)lockAspectRatio
(boolean, optional): Default: truetext
(string): Text contentisHeader
(boolean): True for header, false for footersectionIndex
(number, optional): 1-based section index (default: 1)headerFooterType
(number, optional): WdHeaderFooterIndex
value (1=Primary, 2=FirstPage, 3=EvenPages). Default: 1topPoints
(number): Top margin in pointsbottomPoints
(number): Bottom margin in pointsleftPoints
(number): Left margin in pointsrightPoints
(number): Right margin in pointsorientation
(number): WdOrientation
value (0=Portrait, 1=Landscape)paperSize
(number): WdPaperSize
value (e.g., 1=Letter, 8=A4)To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "msoffice-interop-word" '{"command":"node","args":["dist/index.js"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"msoffice-interop-word": {
"command": "node",
"args": [
"dist/index.js"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"msoffice-interop-word": {
"command": "node",
"args": [
"dist/index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect