adeu
Adeu: AIのためのネイティブな変更履歴機能
LLMはMarkdownを話し、弁護士は「変更履歴」を話します。
Adeuは、Microsoft Wordの**「仮想DOM」**として機能するModel Context Protocol (MCP) サーバーおよびPython SDKです。双方向の抽象化レイヤーを提供し、AIエージェントが基盤となるフォーマットや複雑なDOCX XMLを破壊することなく、ドキュメントのテキストを自由に編集できるようにします。
python-docxのような標準ライブラリはドキュメントをゼロから生成することには優れていますが、非破壊的な赤入れには対応していません。Adeuは.docxファイルをトークン効率の良いMarkdown表現に変換することで、この問題を解決します。これにより、AIエージェントはOpenXMLの扱いにトークンを浪費することなく、ドキュメントのセマンティクス(意味内容)に完全に集中できるようになります。
Adeuはインテリジェントなプロキシとして機能し、AIによる編集を安全なアトミックトランザクションとして処理します。
抽出: ドキュメント(ディスク上または開いているWord)を、定義された用語、相互参照、誤字脱字の可能性を含むセマンティック付録を備えた、LLMフレンドリーなCriticMarkupに変換します。エージェントは生のデータではなく、意味構造から作業を開始します。
検証: 厳格な安全ゲートとして機能します。曖昧なテキスト一致や無効な構造変更をファイルに適用する前に自動的にブロックすることで、ドキュメントの整合性を保護します。
コミット: AIのテキスト編集をネイティブなWordの変更履歴に変換します。Adeuは内部の複雑なXMLを処理し、既存のレイアウト、フォント、余白のコメントが完全に保持されるようにします。
Adeuによって保守されています。
セットアップ
前提条件: Adeuは高速で分離された実行のためにuvを使用します。インストールにはpipを使用するのが最も簡単です。
pip install uvmacOS
curl -LsSf https://astral.sh/uv/install.sh | shWindows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Claude Desktopとの統合
AdeuをClaude Desktopに即座に追加するには、以下を実行します。
uvx adeu init[!IMPORTANT] このコマンドは、
claude_desktop_config.jsonを自動的に検出して更新します。 その後、新しいツールを読み込むためにClaude Desktopを再起動してください。
動作確認
Claude Desktopが再起動したら、Claudeに直接以下のメッセージを入力して、Adeuが接続されていることを確認できます。
「Adeuツールを使ってDOCXファイルを読み込めますか?」
正しく設定されていれば、ClaudeはAdeuツールにアクセスできることを確認し、何ができるかを説明します。Adeuについて言及されない場合や、ファイルツールがないと言われた場合は、uvx adeu initを実行した後にClaude Desktopを再起動したか再確認してください。
AdeuはPython 3.12以降を必要とするため、uvxが適切なPythonバージョンのダウンロードとサーバーの実行を自動的に処理します。
{
"mcpServers": {
"adeu": {
"command": "uvx",
"args": ["--from", "adeu", "adeu-server"]
}
}
}Related MCP server: docx-mcp
ワークフロー
1. エージェント向け (Claude / MCP)
AdeuはModel Context Protocol (MCP) サーバーとして実行されます。エージェントがドキュメントを安全に読み取り、レビューし、編集するための特定のツールを提供します。
MCP Apps UI:
read_docxツールは最新のMCP Apps UIプロトコルをサポートしています。エージェントがドキュメントを読み取ると、AdeuはClaudeチャットウィンドウ内にカスタムのインタラクティブなMarkdown UIビューを動的にレンダリングします。これにより、抽出されたテキストとフォーマットをAIの推論と並べて視覚的に確認できます!
推奨されるエージェントプロンプト: AdeuのツールはLLMに対して自身のスキーマを自動的に説明しますが、Claudeのプロジェクト指示やエージェントのシステムプロンプトに以下のコンテキストを追加することで、最良の動作結果を保証できます。
役割: ドキュメントスペシャリスト ツール:
read_docx(clean_view=True): テキストの最終的な「クリーン」バージョンを読み取り、コンテキストを理解します。
process_document_batch: コミット&交渉モード。 変更の統合リストを適用します。特定の検索・置換テキスト編集にはtype: "modify"を使用し、既存の変更履歴やコメントをIDで管理するにはtype: "accept"、"reject"、または"reply"を使用します。
sanitize_docx: 送信前スクラブ。 共有前に危険なメタデータ、作成者名、内部追跡IDを削除します。既存のマークアップを保持する(keep_markup=True)か、ベースラインに対してクリーンな差分を生成できます。
ライブMS Word統合
Microsoft WordがインストールされたWindows環境で実行している場合、Adeuはリアルタイムの副操縦士として機能し、目の前でアクティブなドキュメントを編集できます。
read_active_word_document: 開いているWordウィンドウから直接、テキスト、変更履歴、コメントを抽出します。process_active_word_batch: LLMの編集内容をネイティブなCOMマクロに変換し、Wordがキャンバス上で自動的に入力、削除、コメント追加を行う様子を監視します。
2. ビルダー向け (Python SDK)
リーガルテックアプリケーションや自動化パイプラインを構築している場合は、RedlineEngineを直接使用してください。XML操作の重い処理をすべて引き受けます。
from adeu import RedlineEngine, ModifyText
from io import BytesIO
# 1. Load the contract
with open("MSA.docx", "rb") as f:
stream = BytesIO(f.read())
# 2. Define the edit (e.g., from an LLM response)
# Adeu uses fuzzy matching to locate the target text, even if whitespace varies.
edit = ModifyText(
target_text="State of New York",
new_text="State of Delaware",
comment="Standardizing governing law."
)
# 3. Apply changes
engine = RedlineEngine(stream, author="AI Copilot")
engine.apply_edits([edit])
# 4. Save the result
with open("MSA_Redlined.docx", "wb") as f:
f.write(engine.save_to_stream().getvalue())3. CLI
ターミナルからドキュメントを素早く検査したり、編集バッチを適用したりできます。
# Extract clean text for RAG or prompting
adeu extract contract.docx -o contract.md
# Generate a visual diff between two versions
adeu diff v1.docx v2.docx
# Preview what an edit list (JSON) would look like
adeu markup contract.docx edits.json --output preview.md
# Apply edits to the DOCX
adeu apply contract.docx edits.json --author "Review Bot"
# Scrub author metadata and internal trackers, but keep the visual redlines for the counterparty
adeu sanitize redline.docx -o clean.docx --keep-markup --author "My Firm" --report主な機能
フォーマットの安全性
Adeuはドキュメントを「書き換え」ません。パッチを適用します。
画像とレイアウト: 変更されません。
番号付けとヘッダー: 保持されます。
表とリスト: 複雑なグリッドスパンや多階層の法的番号付けは明示的に保護されます。
複雑なXML: 編集対象のテキストランのみを変更します。
CriticMarkup表現
中間表現は重要です。AdeuはCriticMarkupを使用して変更を可視化します。
マークアップ | 意味 | 例 |
| 削除 |
|
| 挿入 |
|
| コメント |
|
セマンティック付録
契約書には、LLMが初回パスで見落とすような地雷が満載です。一貫性のない定義用語、壊れた相互参照、乱雑なドキュメント内のOCRスタイルの誤字などです。Adeuは抽出時にこれらを事前計算し、テキストと並べて構造化された付録をエージェントに提供します。
インテリジェントなマッピング
Wordドキュメントは乱雑です。「Contract」という単語は、スペルチェックや編集履歴により、["Con", "tract"]のようなXMLランに分割されている場合があります。
ランの結合: Adeuはこれらの分割を正規化し、AIが「Contract」として認識できるようにします。
あいまい一致: LLMのメモリと実際のドキュメント内容との間のわずかな空白の不一致を処理します。
メタデータのサニタイズ
既存のメタデータスクラバーは、赤入れを壊したり、データを黙って削除したりします。Adeuのsanitizeコマンドは、有効な変更履歴を保持しながら、危険なトラッカー(rsid、テンプレート、内部パス、タイムスタンプ)や孤立したコンテンツを外科的に削除します。重要な点として、何が削除され、受信者に何が見えるようになるかを証明する透明な監査レポートを生成します。
Adeu Cloud
デフォルトでは、Adeuのコアとなる赤入れエンジンとローカルファイルツールは完全にオープンソースであり、すべてローカルマシン上で実行されます。Adeuがローカルドキュメントを外部に送信することはありません(ただし、選択したLLMプロバイダーは、エージェントが読み取ったテキストを当然ながら処理します)。
ただし、MCPサーバーをAdeu Cloudに接続して、以下を解放することを明示的に選択できます。
エンドツーエンドのワークフロー (メール): 契約書はメールでやり取りされるため、Adeu Cloudを使用すると、エージェントがメールスレッドを安全に取得し、相手方のDOCX添付ファイルを抽出してレビューし、新しくサニタイズされた赤入れを添付して返信をドラフトできます。
高度なドキュメント検証: 複雑な複数ドキュメントのセマンティック検証タスクを非同期で実行します。これらの膨大なコンテキストを処理のためにAdeu Cloudへ安全にルーティングすることで、ローカルのAIエージェントがコンテキストウィンドウを使い果たしたり、レート制限に達したりするのを防ぎます。
貢献
コミュニティからの貢献を歓迎します!バグ修正、機能追加、ドキュメントの改善など、ローカルのuv環境のセットアップ、テストの実行、およびプロジェクトの厳格なXML安全ガイドラインの理解については、貢献ガイドを参照してください。
ライセンス
MITライセンス。オープンソースであり、商用アプリケーションでも無料で使用できます。
Available Tools
11 toolsaccept_all_changesADestructive
Accepts all tracked changes and removes all comments in a single operation, producing a finalized clean document. Use this when a document review is entirely complete and you want to clear all redlines. For selective acceptance/rejection of specific changes, use process_document_batch instead.
Inputs: docx_path (required), output_path. Returns: result
create_email_draftA
Creates an email draft in the user's native draft box (e.g., Outlook/Gmail). Can either start a NEW email, or REPLY to an existing thread. To REPLY, provide 'reply_to_email_id' (the short ID from search_and_fetch_emails). To start a NEW email, omit the ID but provide 'subject' and 'to_recipients'. Allows attaching local files (PDF/DOCX) by providing their absolute paths. The body should be formatted in Markdown.
Inputs: body_markdown (required), reply_to_email_id, subject, to_recipients, +1 more.
diff_docx_filesARead-only
Compares two DOCX files and generates a text-based Unified Diff. Use this to see exactly what changed between two versions of a document. By default (compare_clean=True), it compares the 'Accepted' finalized states of both documents. Set compare_clean=False if you need to compare the raw underlying text including Tracked Change CriticMarkup.
Inputs: original_path (required), modified_path (required), compare_clean. Returns: result
login_to_adeu_cloudA
Logs the user into the Adeu Cloud backend. Securely opens a browser window for authentication.
Inputs: no named parameters. Returns: result
logout_of_adeu_cloudA
Logs out of the Adeu Cloud backend by clearing the local API key from the OS Keychain.
Inputs: no named parameters. Returns: result
open_local_fileA
Opens a local file in its native desktop application (e.g., Microsoft Word for DOCX files).
Inputs: file_path (required). Returns: result
process_document_batchADestructive
Applies a batch of structural edits, text modifications, and review actions to a document. This is your primary tool for editing DOCX files.
CRITICAL: All changes in the batch evaluate against the ORIGINAL document state. Do not send sequential edits that depend on each other within the same batch (e.g. rename X to Y, then modify Y). Instead, apply the rename in one batch, then modify Y in a subsequent batch.
The changes parameter is a list of operations. Each item MUST have a type:
'modify': Search-and-replace text. Provide exact
target_text(CRITICAL: include surrounding context if the word appears multiple times to ensure unique matching) andnew_text(the replacement).new_textsupports full Markdown structure: '# Heading 1' through '###### Heading 6' at the start of a line for heading styles, 'bold' and 'italic' inline formatting, and blank lines ('\n\n') to splitnew_textinto multiple paragraphs. Multi-paragraph inserts are tracked as one logical revision. To delete text, makenew_textempty. Do NOT manually write CriticMarkup tags ({++, {--, {>>). To add a comment, use the 'comment' parameter.'accept': Finalize a tracked change. Requires
target_id(e.g., 'Chg:12'). (Note: Accepting one half of a paired modify cascades to accept the other half).'reject': Revert a tracked change. Requires
target_id(e.g., 'Chg:12'). (Note: Rejecting one half cascades to reject the other half).'reply': Reply to a comment. Requires
target_id(e.g., 'Com:5') andtext.'insert_row': Insert table row. Requires
target_text(anchor),position('above'/'below'), andcells(Markdown strings).'delete_row': Delete table row. Requires
target_textinside the row to be deleted.
Always provide a realistic author_name for Tracked Changes. This name will be used for attribution in the document's tracked changes and comments.
Inputs: original_docx_path (required), author_name (required), changes (required), output_path. Returns: result
read_docxARead-only
Reads a DOCX file and extracts its text content. Use this to ingest documents into your context window. By default (clean_view=False), it returns text with inline CriticMarkup (e.g., {++inserted++}, {--deleted--}, {==highlighted==}{>>comment<<}) representing Tracked Changes and Comments. Set clean_view=True ONLY if you want to read the final, clean text, ignoring all redlines and comments.
PAGINATION & OUTLINE:
mode='outline' returns a structural map of headings with page numbers, styles, table presence, and referenced footnotes. Body content is omitted. Use this first on large documents to plan targeted reads.
mode='full' (default) returns the document body. Documents over ~19,000 characters are split into pages; use page=N to read a specific page (1-indexed). Documents under the limit are returned in full on page 1.
Page boundaries differ between clean_view=True and clean_view=False.
The Structural Appendix (defined terms, anchors, diagnostics) is repeated on every page.
Inputs: file_path (required), clean_view, mode, page.
sanitize_docxADestructive
Sanitizes a DOCX file by stripping dangerous metadata (rsids, author names, template paths, DMS metadata, hidden text, orphaned content) and producing an audit report of everything removed. Use this before sending documents to external parties. Supports three modes: full scrub (for signing/closing), keep-markup (preserves your track changes and open comments), or baseline (recomputes your delta against the original document).
Inputs: file_path (required), output_path, keep_markup, baseline_path, +2 more. Returns: object
search_and_fetch_emailsARead-only
Searches the user's live email inbox. By default, searches only the Inbox folder (matching what the user sees in their mail client) — this excludes deleted items, drafts, and spam. Use filters to find specific emails (e.g., 'is_unread=True' for new emails, 'days_ago=7' for last week, 'folder=sent' for sent items, 'folder=all' to search the entire mailbox including trash). It returns a list of lightweight email previews. To read the full email body, thread history, and automatically download attachments to local disk, call this tool again and provide the specific email_id. Emails often contain attachments. It is highly recommended to always provide the working_directory parameter so attachments are saved directly to the user's actual project folder. This directory path refers to the user's native operating system, not the LLM's sandbox environment.
Inputs: sender, subject, has_attachments, attachment_name, +7 more.
validate_documentsA
Validates documents for inconsistencies, contradictions, and risk assessments. To START a new validation, provide 'file_paths' as a JSON-encoded string representing a list of file paths. This will immediately return a task_id. To CHECK the status of a validation, call this tool AGAIN and provide ONLY the 'task_id'. The checking process will poll for up to 50 seconds. If it times out, continue checking.
Inputs: file_paths, task_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct operation (auth, email, document reading/editing/finalization/comparison/sanitization/validation) with clear boundaries. No two tools serve overlapping purposes.
All tool names follow a consistent verb_noun snake_case pattern (e.g., accept_all_changes, create_email_draft, sanitize_docx). No mixing of styles or vague verbs.
The 11 tools cover the core functionality (document editing, email handling, authentication) without being excessive. Each tool serves a well-defined purpose.
The set covers read, edit, finalize, compare, sanitize, search/create drafts, and validate. However, adding new comments is not directly exposed (only replying), which is a minor gap.
Maintenance
Related MCP Connectors
Contract review that keeps your contracts: cited answers, Word redlines, key-date alerts.
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Create documents and reusable templates, request signatures, and track approvals — for AI agents.
AI contract management (CLM): contract review, data extraction, reminders and renewal deadlines.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables creating professional Word documents from markdown or structured content with fast, customized formatting via natural language.71ISC
- AlicenseAqualityDmaintenanceLegal document redlining engine that applies AI-generated JSON changes as professional tracked changes with comments in .docx files, producing Word-indistinguishable output.61MIT
- AlicenseBqualityCmaintenanceStructure-preserving Word DOCX editing MCP server with a .NET Open XML backend and Office.js live sessions. Enables safe, auditable, incremental editing of Microsoft Word documents for AI agents.6312 npm10AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to generate format-stable, editable Word DOCX documents from structured content and reusable templates, with document type recognition, schema retrieval, template rendering, validation, and conservative fixes.MIT