@adeu/mcp-server
Version:
[](https://github.com/dealfluence/adeu) [](https://modelcontextprotocol.io/) [ • 7.57 kB
Markdown
# @adeu/mcp-server
[](https://github.com/dealfluence/adeu)
[](https://modelcontextprotocol.io/)
[](https://opensource.org/licenses/MIT)
**Native Microsoft Word Track Changes for AI Agents**
`@adeu/mcp-server` is a standalone Node.js [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that acts as a "Virtual DOM" for Microsoft Word documents. It provides AI agents (like Claude) with tools to safely read, edit, and sanitize `.docx` files without destroying underlying formatting or complex XML.
This package provides the exact same engine as the Python `adeu` CLI, but executes entirely via Node.js—making it ideal for environments where Python is unavailable or undesired.
## Usage with MCP Clients
You can add this server directly to your MCP client (like Claude Desktop, Cursor, or Windsurf) using `npx`.
Add the following to your MCP configuration file (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"adeu-node": {
"command": "npx",
"args": ["-y", "@adeu/mcp-server"]
}
}
}
```
## File access
By default, tools can read and save Word documents in any folder accessible to the server account. Reads parse the Word package inside the Node process.
### Saving documents
The same checks apply to an explicit `output_path` and to filenames the server chooses. These examples use `draft.docx` as the input.
| Tool | Output when `output_path` is omitted |
| --- | --- |
| `process_document_batch` | `draft_processed.docx` |
| `accept_all_changes` | `draft_clean.docx` |
| `finalize_document` | `draft_final.docx` |
| `apply_text_revision` | `draft_redlined.docx` |
| `diff_docx_files` | Returns the text diff. Supply a path distinct from both inputs to save a redline. |
Default files go beside the input. Batch edits and text revisions can update an existing processed or redlined document in place. A text revision also checks `<output stem>.unverified.docx` beside the resolved output. A failed verification saves the diagnostic copy there and leaves the requested output untouched.
- Choose `.docx` or the input document’s ending, ignoring case. A comparison can match either input. Even an unusual ending such as `.bin` can be carried over from a Word package. Node writes Word packages and reserves `.pdf` for runtimes that support PDF export.
- For `.docm`, `.dotm`, `.dotx`, or `.dot`, save beside an input with that same ending.
- Choose a new filename, an empty regular file, or an existing Word package. The server checks the ZIP listing for `[Content_Types].xml` and `word/document.xml`. To recover an interrupted save, it can also replace a regular file with a Word ending beside the input if its bytes are not a readable ZIP. A readable ZIP missing either required entry is refused even there.
- The checks use the resolved destination, including symbolic links, Windows junctions, and existing parents of new files. Missing folders are created only after the checks pass. Directories, devices, pipes, and sockets are refused as destinations. On Windows, use ordinary names without extra colons, trailing dots, or trailing spaces.
### Restricting folders
Set `ADEU_ALLOWED_DIRS` in your MCP host configuration to limit every input and output to the listed folders and their descendants. This includes both comparison inputs, default outputs, and diagnostic copies. A link inside an allowed folder must also resolve inside an allowed folder. This Windows example allows two folders.
```json
{
"mcpServers": {
"adeu-node": {
"command": "npx",
"args": ["-y", "@adeu/mcp-server"],
"env": { "ADEU_ALLOWED_DIRS": "C:\\Projects\\Contracts;D:\\Reviewed" }
}
}
}
```
Separate paths with a semicolon on Windows or a colon on macOS and Linux, for example `/srv/contracts:/srv/reviewed`. Each path must be absolute and point to an existing directory. Blank entries are ignored. An entirely blank list or an invalid directory prevents startup. Restart the server after changing the setting. It logs the resolved directories to stderr.
## Exposed Tools
Once connected, your AI agent will have access to the following tools.
### Document tools
- `read_docx`: Reads a DOCX file and returns LLM-friendly text with inline CriticMarkup (`{++inserted++}`, `{--deleted--}`) for Tracked Changes and Comments. Supports pagination and page ranges (`page="1-8"`), structural outlining (`mode="outline"`), tracked-changes/comments ledger (`mode="changes"`), form fields discovery (`mode="fields"`), search (`search_query`, `search_regex`), and semantic appendix extraction (`mode="appendix"`).
- `process_document_batch`: Applies a sequential batch of search-and-replace text modifications (`modify` with Markdown headings/bold/italic/pipe tables, `{#cell:<id>}` empty-cell anchors, `match_mode`, `regex`, and single or `[{text, author?}]` comments), form field edits (`set_field`), tracked-change resolutions (`accept`/`reject` with optional `part`), comment replies (`reply`), and table row edits (`insert_row`/`delete_row`). Supports native Word Track Changes (`markup_mode="track_changes"`), inline strikethrough/underline formatting (`markup_mode="manual"`), and opt-in word-level redlines on commented edits (`commented_change_granularity="word"`).
- `apply_text_revision`: Rewrites a whole document from revised clean text by diffing against the document's clean view and applying the delta as native Word Track Changes behind a post-apply verification gate.
- `accept_all_changes`: Accepts all tracked changes to produce a finalized clean document. `remove_comments` (default `true`) also deletes every comment; pass `remove_comments=false` to keep them. Deleted comments are reported by id and author.
- `diff_docx_files`: Compares two DOCX files and returns a sub-word `@@ Word Patch @@` diff; when `output_path` is provided, also writes the comparison as a tracked-changes `.docx` in one transactional step.
- `finalize_document`: Prepares a document for signature or distribution by applying native OOXML read-only locking and deep metadata sanitization (`sanitize_mode="full"` or `"keep-markup"`).
## Documentation & Support
For full architectural details, prompt recommendations, and the project constitution, please visit the [main Adeu repository](https://github.com/dealfluence/adeu) or our [website](https://adeu.ai).
---
## Development Runbook Note: Workspace Linkage Trap
> [!WARNING]
> **Node MCP: a committed source fix is NOT a running fix.**
> `dist/` is gitignored and the server runs the compiled bundle. After ANY change to `node/packages/core` or `mcp-server`:
>
> 1. **Relink dependencies:** `cd node && npm install` (relinks `@adeu/core` in the workspace; a copied — not symlinked — core is the #1 cause of "fix didn't take").
> 2. **Rebuild the workspace:** `npm run build` (core builds before mcp-server; confirm `core/dist` timestamp is updated).
> 3. **Verify:** Check that the build verification sentinel check succeeds (automatically runs postbuild, or can be run manually via `npm run build:verify` under `packages/mcp-server`).
> 4. **Restart the MCP server:** Restart the MCP server AND reconnect in the client to flush any cached process states.
> 5. **Confirm the build stamp:** Verify that the build stamp in the live server (via `server_info` or startup logs) matches your built git HEAD.