AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Docx Redline Mcp

mcp-ansonlai-docx-redline-mcp · by AnsonLai

An MCP server for inspecting and editing Microsoft .docx files with support for real tracked changes and comments.

— No reviews yet
0 installs
28 views
0.0% view→install

Install

$ agentstack add mcp-ansonlai-docx-redline-mcp

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ✓ Network access No
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ✓ Environment & secrets No
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-ansonlai-docx-redline-mcp)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
○ 6mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Docx Redline Mcp? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

DOCX Redline MCP

Local stdio MCP server for inspecting and editing Microsoft .docx files through OOXML package parts.

It is intended for agent workflows that need to:

  • open a local .docx
  • inspect OOXML parts such as word/document.xml
  • apply real Word tracked changes through @ansonlai/docx-redline-js
  • add comments and maintenance operations safely
  • save back in place or to a new output path

Status

Current behavior is hardened around the failure modes discovered during end-to-end Word testing:

  • MCP logging is routed to stderr so stdio transport is not corrupted
  • package updates are validated before the in-memory session is committed
  • invalid comment/revision combinations are rejected and rolled back
  • delete_all_comments clears both inline anchors and word/comments.xml
  • redline operations normalize hidden field scaffolding (w:fldChar, w:instrText) and proofing markers (w:proofErr) in the matched target paragraph before diffing
  • batch redline application is supported through apply_operations

Requirements

  • Node.js 18 or newer

Install

npm install

Run

node src/index.js

Package binary:

npx docx-redline-mcp

MCP Tools

open_docx

Open a .docx file and create a working handle.

{
  "path": "C:/contracts/master-services-agreement.docx"
}

list_parts

List package parts for an open handle.

{
  "handle": "doc_..."
}

read_part

Read an OOXML part as XML text or get a binary summary.

{
  "handle": "doc_...",
  "partPath": "word/document.xml",
  "maxChars": 12000
}

Binary export:

{
  "handle": "doc_...",
  "partPath": "word/media/image1.png",
  "includeBase64": true
}

write_part

Replace a writable XML part in memory.

{
  "handle": "doc_...",
  "partPath": "word/document.xml",
  "xml": "..."
}

Writable XML parts:

  • word/document.xml
  • word/comments.xml
  • word/numbering.xml
  • word/header*.xml
  • word/footer*.xml
  • [Content_Types].xml

apply_operation

Apply one structured operation to word/document.xml.

Redline example:

{
  "handle": "doc_...",
  "author": "Roo",
  "operation": {
    "type": "redline",
    "target": "Original text",
    "modified": "Updated text"
  }
}

Comment example:

{
  "handle": "doc_...",
  "author": "Roo",
  "operation": {
    "type": "comment",
    "target": "Original paragraph text",
    "textToComment": "Original",
    "commentContent": "Explain the change"
  }
}

Maintenance operations:

  • accept_all_tracked_changes
  • reject_all_tracked_changes
  • delete_all_comments

apply_operations

Apply multiple structured operations in a single batch. This is the preferred path when one edit session needs several redlines/comments against the same open document.

{
  "handle": "doc_...",
  "author": "Roo",
  "operations": [
    {
      "type": "redline",
      "target": "Original text",
      "modified": "Updated text"
    },
    {
      "type": "comment",
      "target": "Other paragraph",
      "textToComment": "Other",
      "commentContent": "Reasoning"
    }
  ]
}

save_docx

Save the working package.

In place:

{
  "handle": "doc_..."
}

To a separate file:

{
  "handle": "doc_...",
  "outputPath": "C:/contracts/master-services-agreement-copy.docx"
}

Behavior Notes

  • Each open_docx call creates an in-memory working session.
  • save_docx writes back to the original file unless outputPath is supplied.
  • Non-XML parts are read-only.
  • write_part validates XML before accepting it.
  • apply_operation and apply_operations validate the resulting package before updating the session state.
  • On failure, the server rolls back the affected word/document.xml and word/comments.xml state.
  • For redlines, the server preserves visible Word cross-reference output such as 9.1 or 10.6 but removes hidden field instruction scaffolding before diffing.
  • Comment anchors that cross tracked insertion/deletion boundaries are rejected because Word commonly refuses to open those packages.

Logging

  • Default MCP log level is warn
  • Logs are written to stderr, not stdout
  • To enable engine diagnostics safely:
$env:DOCX_REDLINE_MCP_LOG_LEVEL = "info"
node src/index.js

Troubleshooting

  • Transport closed during a tool call:
  • check for any dependency or local logging writing to stdout
  • Word rejects the saved file even though XML looks valid:
  • inspect the revised paragraph for hidden field runs (w:fldChar, w:instrText) or proofing markers (w:proofErr)
  • prefer the server redline path over direct XML surgery so the normalization step runs
  • Comment operation rejected because of a tracked-change boundary:
  • re-anchor the comment to stable text outside the revised span

Test

npm test

The test suite covers:

  • basic tool handler behavior
  • package read/write/save
  • rollback on invalid comment/revision markup
  • batch operation handling
  • real-DOCX diagnostic generation
  • field/proofing normalization regressions

License

MIT. See [LICENSE](./LICENSE).

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.