mcp server office
A server providing tools to read, write, and edit Microsoft Word (docx) files through the Model Context Protocol, allowing operations like complete document reading, content creation, targeted paragraph editing, and text insertion.
A server providing tools to read, write, and edit Microsoft Word (docx) files through the Model Context Protocol, allowing operations like complete document reading, content creation, targeted paragraph editing, and text insertion.
A Model Context Protocol (MCP) server providing tools to read/write Microsoft Word (docx) files.
Install with pip:
pip install mcp-server-office
Then, start the MCP server:
mcp-server-office
Or using uv, just:
uvx mcp-server-office
read_docx: Read complete contents of a docx file including tables and images.
Input: path (string) - Absolute path to the target file
write_docx: Create a new docx file with given content.
Input:
path (string) - Absolute path to target filecontent (string) - Content to write to the fileedit_docx_paragraph: Make text replacements in specified paragraphs of a docx file.
Input:
path (string) - Absolute path to file to editedits (array) - List of dictionaries containing search/replace text and paragraph indexparagraph_index (number) - 0-based index of the paragraph to editsearch (string) - Text to find within the specified paragraphreplace (string) - Text to replace withedit_docx_insert: Insert new paragraphs into a docx file.
Input:
path (string) - Absolute path to file to editinserts (array) - List of dictionaries containing text and optional paragraph indextext (string) - Text to insert as a new paragraphparagraph_index (number, optional) - 0-based index of the paragraph before which to insert. If not specified, insert at the end.Microsoft Word (docx) ファイルの読み書きを提供するModel Context Protocol (MCP) サーバーです。
pipを使用してインストール:
pip install mcp-server-office
MCPサーバーの起動:
mcp-server-office
または、uvを使う場合:
uvx mcp-server-office
read_docx: docxファイルの内容を表やイメージを含めて完全に読み取ります。
入力: path (文字列) - 対象ファイルの絶対パス
write_docx: 新しいdocxファイルを指定された内容で作成します。
入力:
path (文字列) - 作成するファイルの絶対パスcontent (文字列) - ファイルに書き込む内容edit_docx_paragraph: docxファイル内の指定された段落のテキストを置換します。
入力:
path (文字列) - 編集するファイルの絶対パスedits (配列) - 検索/置換テキストと段落インデックスを含む辞書のリストparagraph_index (数値) - 編集する段落の0ベースのインデックスsearch (文字列) - 指定された段落内で検索するテキストreplace (文字列) - 置換するテキストedit_docx_insert: docxファイルに新しい段落を挿入します。
入力:
path (文字列) - 編集するファイルの絶対パスinserts (配列) - テキストとオプションの段落インデックスを含む辞書のリストtext (文字列) - 新しい段落として挿入するテキストparagraph_index (数値, オプション) - 挿入する位置の段落の0ベースのインデックス。指定しない場合は末尾に挿入されます。[
{
"description": "Read complete contents of a docx file including tables and images.Use this tool when you want to read file endswith '.docx'.Paragraphs are separated with two line breaks.This tool convert images into placeholder [Image].'--- Paragraph [number] ---' is indicator of each paragraph.",
"inputSchema": {
"properties": {
"path": {
"description": "Absolute path to target file",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"name": "read_docx"
},
{
"description": "Make text replacements in specified paragraphs of a docx file. Accepts a list of edits with paragraph index and search/replace pairs. Each edit operates on a single paragraph and preserves the formatting of the first run. Returns a git-style diff showing the changes made. Only works within allowed directories.",
"inputSchema": {
"properties": {
"edits": {
"description": "Sequence of edits to apply to specific paragraphs.",
"items": {
"properties": {
"paragraph_index": {
"description": "0-based index of the paragraph to edit. tips: whole table is count as one paragraph.",
"type": "integer"
},
"replace": {
"description": "Text to replace the search string with. The formatting of the first run in the paragraph will be applied to the entire replacement text. Empty string represents deletion. Escape line break when you input multiple lines.",
"type": "string"
},
"search": {
"description": "Text to find within the specified paragraph. The search is performed only within the target paragraph. Escape line break when you input multiple lines.",
"type": "string"
}
},
"required": [
"paragraph_index",
"search",
"replace"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "Absolute path to file to edit. It should be under your current working directory.",
"type": "string"
}
},
"required": [
"path",
"edits"
],
"type": "object"
},
"name": "edit_docx_paragraph"
},
{
"description": "Create a new docx file with given content.Editing exisiting docx file with this tool is not recomended.",
"inputSchema": {
"properties": {
"content": {
"description": "Content to write to the file. Two line breaks in content represent new paragraph.Table should starts with [Table], and separated with '|'.Escape line break when you input multiple lines.",
"type": "string"
},
"path": {
"description": "Absolute path to target file. It should be under your current working directory.",
"type": "string"
}
},
"required": [
"path",
"content"
],
"type": "object"
},
"name": "write_docx"
},
{
"description": "Insert new paragraphs into a docx file. Accepts a list of inserts with text and optional paragraph index. Each insert creates a new paragraph at the specified position. If paragraph_index is not specified, the paragraph is added at the end. When multiple inserts target the same paragraph_index, they are inserted in order. Returns a git-style diff showing the changes made.",
"inputSchema": {
"properties": {
"inserts": {
"description": "Sequence of paragraphs to insert.",
"items": {
"properties": {
"paragraph_index": {
"description": "0-based index of the paragraph before which to insert. If not specified, insert at the end.",
"type": "integer"
},
"text": {
"description": "Text to insert as a new paragraph.",
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "Absolute path to file to edit. It should be under your current working directory.",
"type": "string"
}
},
"required": [
"path",
"inserts"
],
"type": "object"
},
"name": "edit_docx_insert"
}
]