office-editor-mcp
Office文書処理MCPサーバー
Office文書処理のためのMCP(Model Context Protocol)サーバー。AIアシスタント環境から離れることなく、MCPクライアント内でWord、Excel、PowerPoint文書の作成・編集を可能にします。
概要
Office-Editor-MCPは、Model Context Protocol標準を実装し、Office文書操作をツールおよびリソースとして公開します。AIアシスタントとMicrosoft Office文書の間のブリッジとして機能し、AIアシスタントを通じてさまざまなOffice文書の作成、編集、書式設定、分析を可能にします。
Related MCP server: word-doc-mcp
機能
Word文書操作
文書管理
メタデータ(タイトル、作成者など)付きの新しいWord文書を作成
テキストコンテンツを抽出し、文書構造を分析
文書のプロパティと統計情報を表示
ディレクトリ内の利用可能な文書を一覧表示
文書のコピーを作成
コンテンツ作成
さまざまなレベルの見出しを追加
オプションのスタイル付きで段落を挿入
カスタムデータを含むテーブルを作成
縦横比を維持したスケーリングで画像を追加
ページ区切りを挿入
テキスト書式設定
特定のテキスト部分を書式設定(太字、斜体、下線)
テキストの色とフォントプロパティを変更
テキスト要素にカスタムスタイルを適用
文書全体でテキストを検索および置換
Excel操作
ワークブック管理
新しいExcelワークブックを作成
既存のExcelファイルを開く
ワークシートの追加/削除/名前変更
データ処理
セルの内容を読み書き
行と列を挿入/削除
データを並べ替えおよびフィルタリング
数式と関数を適用
PowerPoint操作
プレゼンテーション管理
新しいPowerPointプレゼンテーションを作成
スライドの追加/削除/並べ替え
スライドのテーマと背景を設定
コンテンツ編集
テキストとグラフィック要素を追加
テーブルとチャートを挿入
アニメーションとトランジションを追加
高度な機能
OCR認識(画像からテキストを抽出)
文書比較(文書間の差分を比較)
文書翻訳
文書の暗号化と復号化
テーブルデータのインポート/エクスポート(データベース連携)
インストールガイド
前提条件
Python 3.10以上
pipパッケージマネージャー
Microsoft Officeは、PDFエクスポート、アニメーション、トランジション、レガシーOffice形式などのWindows COM機能にのみ必要です
ocr_recognize_textを使用する場合はTesseract OCRが必要です
基本インストール
# Clone the repository
git clone https://github.com/theWDY/office-editor-mcp.git
cd office-editor-mcp
# Install dependencies
pip install -r requirements.txtこのリポジトリは、word_server.py、excel_server.py、powerpoint_server.py、general_server.pyの4つの独立したMCPサーバーを公開しています。必要なサーバーのみを設定してください。チェックインされている.cursor/mcp.jsonには、4サーバーの完全な例が含まれています。
設定
Cursorでの設定
方法1: UI設定
Cursorを開く
設定 > 機能 > MCPに移動
「+ Add New MCP Server」をクリック
設定情報を入力:
名前:
Office Assistant(お好みで変更)タイプ:
stdioを選択コマンド: サーバーを実行するためのフルパスを入力。例:
python /path/to/office-editor-mcp/word_server.py注: 実際のファイルパスに置き換えてください
方法2: JSON設定ファイル(推奨)
プロジェクトディレクトリに
.cursorフォルダーを作成(存在しない場合)そのフォルダーに以下の内容で
mcp.jsonファイルを作成:
{
"mcpServers": {
"office-assistant": {
"command": "python",
"args": ["/path/to/office-editor-mcp/word_server.py"],
"env": {"OFFICE_EDIT_PATH": "/path/to/output"}
}
}
}Claude for Desktopでの設定
Claude設定ファイルを編集:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
以下の設定を追加:
{
"mcpServers": {
"office-document-server": {
"command": "python",
"args": [
"/path/to/office-editor-mcp/word_server.py"
]
}
}
}Claudeを再起動して設定を適用します。
general_server.pyで処理されるすべてのパスは、OFFICE_EDIT_PATH内に収まる必要があります。OFFICE_ALLOW_DESTRUCTIVE=trueが明示的に設定されていない限り、移動および削除操作は無効になります。
新しい暗号化ファイルは、ランダムなソルトとScryptパスワード導出を使用するバージョン管理されたFernetコンテナを使用します。既存の暗号化ファイルは読み取り可能なままであり、再暗号化してアップグレードできます。バッチ操作は、リクエストあたり100ファイルおよび16ワーカーに制限されています。
使用例
設定後、AIアシスタントに次のようなコマンドを発行できます:
Word文書操作
「タイトルページ付きの『quarterly_report.docx』という新しい文書を作成して」
「文書に見出しと3つの段落を追加して」
「売上データを含む4x4のテーブルを挿入して」
「段落2の『important』という単語を太字で赤色にして」
「『old term』のすべての出現箇所を検索して『new term』に置換して」
Excel操作
「『financial_analysis.xlsx』という名前の新しいExcelワークブックを作成して」
「セルA1にタイトルとして『Quarterly Sales』を挿入して」
「部門別売上データのテーブルを作成して合計を計算して」
「売上データの棒グラフを作成して」
「列Bのデータを降順で並べ替えて」
PowerPoint操作
「『project_presentation.pptx』という名前のプレゼンテーションを作成して」
「『Project Overview』というタイトルの新しいスライドを追加して」
「スライド2に会社のロゴを挿入して」
「タイトルにフライインアニメーションを追加して」
APIリファレンス
Word文書操作
# Document Creation and Properties
create_document(filename, title=None, author=None)
get_document_info(filename)
get_document_text(filename)
get_document_outline(filename)
list_available_documents(directory=".")
copy_document(source_filename, destination_filename=None)
# Content Addition
add_heading(filename, text, level=1)
add_paragraph(filename, text, style=None)
add_table(filename, rows, cols, data=None)
add_picture(filename, image_path, width=None)
add_page_break(filename)
# Text Formatting
format_text(filename, paragraph_index, start_pos, end_pos, bold=None,
italic=None, underline=None, color=None, font_size=None, font_name=None)
search_and_replace(filename, find_text, replace_text)
delete_paragraph(filename, paragraph_index)
create_custom_style(filename, style_name, bold=None, italic=None,
font_size=None, font_name=None, color=None, base_style=None)Excel操作
# Workbook Operations
create_workbook(filename)
open_workbook(filename)
save_workbook(filename, new_filename=None)
add_worksheet(filename, sheet_name=None)
list_worksheets(filename)
# Cell Operations
read_cell(filename, sheet_name, cell_reference)
write_cell(filename, sheet_name, cell_reference, value)
format_cell(filename, sheet_name, cell_reference, **format_args)PowerPoint操作
# Presentation Operations
create_presentation(filename)
open_presentation(filename)
save_presentation(filename, new_filename=None)
add_slide(filename, layout=None)トラブルシューティング
よくある問題
スタイルの欠落
一部の文書には、見出しおよびテーブル操作に必要なスタイルが欠けている場合があります
サーバーは欠落したスタイルを作成するか、直接書式設定を使用しようとします
最良の結果を得るには、標準のOfficeスタイルを含むテンプレートを使用してください
権限の問題
サーバーが文書パスへの読み取り/書き込み権限を持っていることを確認してください
copy_document関数を使用して、ロックされた文書の編集可能なコピーを作成してください操作が失敗する場合は、ファイルの所有権と権限を確認してください
画像挿入の問題
画像ファイルには絶対パスを使用してください
画像形式の互換性を確認してください(JPEG、PNG推奨)
画像ファイルのサイズと権限を確認してください
デバッグ
環境変数を設定して詳細なログを有効にします:
export MCP_DEBUG=1 # Linux/macOS
set MCP_DEBUG=1 # Windows実装状況
✅ MCPサーバーの基本フレームワークを構築
✅ AIアシスタントとの統合に成功
✅ 基本的なWord文書操作
✅ 基本的なExcelワークブック操作
✅ 基本的なPowerPointプレゼンテーション操作
✅ 高度な機能の拡張
✅ パフォーマンスの最適化
✅ クロスプラットフォーム互換性のテスト
コントリビューション
コントリビューションを歓迎します!お気軽にPull Requestを送信してください。
リポジトリをフォーク
フィーチャーブランチを作成(
git checkout -b feature/amazing-feature)変更をコミット(
git commit -m 'Add some amazing feature')ブランチにプッシュ(
git push origin feature/amazing-feature)Pull Requestを開く
ライセンス
このプロジェクトはMITライセンスの下でライセンスされています。詳細はLICENSEファイルを参照してください。
謝辞
Model Context Protocol - プロトコル仕様
python-docx - Word文書処理
openpyxl - Excel処理
python-pptx - PowerPoint処理
注: このサーバーは、システム上の文書ファイルとやり取りします。AIアシスタントや他のMCPクライアントで操作を確認する前に、要求された操作が適切であることを常に確認してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
An MCP server that integrates with Discord to provide AI-powered features.
MCP server for generating rough-draft project plans from natural-language prompts.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Presentations.AI MCP server — create designed slide decks from a topic, text, or document.
Related MCP Servers
- FlicenseBqualityDmaintenanceMCP server for Office document automation, enabling AI assistants to create, read, and clone Word/Excel/PPT templates while preserving formatting.41-
- AlicenseAqualityDmaintenanceMCP server for creating and reading Word (.docx) documents with rich formatting support.38 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server for generating Word documents and Google Docs with structured formatting, templates, and rich text.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server enabling AI to control WPS Office (Writer/Calc/Impress) for document creation, editing, export, and live typing.MIT