Document Operations (Word, Excel, PDF)
🚀 用於Claude Desktop的文檔編輯MCP服務器
這是一個基於模型上下文協議(MCP)的服務器,它允許Claude Desktop在Microsoft Word、Excel和PDF文件上執行各類文檔操作,極大地拓展了Claude Desktop的文檔處理能力。
🚀 快速開始
該MCP服務器要求使用Python 3.10或更高版本。下面為你提供詳細的安裝步驟。
✨ 主要特性
Microsoft Word 操作
- 可使用文本創建新的Word文檔。
- 支持編輯現有Word文檔,包括添加、修改或刪除段落和標題。
- 能夠將文本文件(.txt)轉換為Word文檔。
Excel 操作
- 可從JSON或CSV格式的文本創建新的Excel電子表格。
- 支持編輯現有的Excel文件,如更新單元格、範圍,添加或刪除行、列、工作表。
- 能夠將CSV文件轉換為Excel。
PDF 操作
- 可使用文本創建新的PDF文件。
- 能夠將Word文檔轉換為PDF文件。
📦 安裝指南
自動安裝(推薦)
運行設置腳本來自動安裝依賴項並配置Claude Desktop:
git clone https://github.com/alejandroBallesterosC/document-edit-mcp
cd document-edit-mcp
./setup.sh
此操作將完成以下步驟:
- 創建虛擬環境。
- 安裝所需的依賴項。
- 配置服務器以供Claude Desktop使用。
- 創建必要的目錄。
手動安裝(如果需要)
如果你更喜歡手動安裝,可按以下步驟操作:
- 安裝依賴項:
cd claude-document-mcp
python -m venv .venv
source .venv/bin/activate # 在Windows上:.venv\Scripts\activate
pip install -e .
- 配置Claude Desktop:
複製
claude_desktop_config.json
文件到:
- Mac:
~/Library/Application Support/Claude/
- Windows:
%APPDATA%\Claude\
- 重啟Claude Desktop。
📚 詳細文檔
模型上下文協議集成
該服務器遵循模型上下文協議規範,以向Claude Desktop提供文檔處理功能:
- 工具:提供了對Word、Excel和PDF操作的操縱函數。
- 資源:提供了有關功能的信息。
- 提示:(目前尚未實現)
💻 使用示例
基礎用法
以下是使用該服務器API的一些基礎示例:
Microsoft Word
# 創建Word文檔
create_word_document(filepath: str, content: str) -> Dict
# 編輯Word文檔
edit_word_document(filepath: str, operations: List[Dict]) -> Dict
# 將TXT轉換為Word
convert_txt_to_word(source_path: str, target_path: str) -> Dict
Excel
# 創建Excel文件
create_excel_file(filepath: str, content: str) -> Dict
# 編輯Excel文件
edit_excel_file(filepath: str, operations: List[Dict]) -> Dict
# 將CSV轉換為Excel
convert_csv_to_excel(source_path: str, target_path: str) -> Dict
# 創建PDF文件
create_pdf_file(filepath: str, content: str) -> Dict
# 將Word轉換為PDF
convert_word_to_pdf(source_path: str, target_path: str) -> Dict
📄 API文檔
Microsoft Word
創建Word文檔
create_word_document(filepath: str, content: str) -> Dict
編輯Word文檔
edit_word_document(filepath: str, operations: List[Dict]) -> Dict
將TXT轉換為Word
convert_txt_to_word(source_path: str, target_path: str) -> Dict
Excel
創建Excel文件
create_excel_file(filepath: str, content: str) -> Dict
編輯Excel文件
edit_excel_file(filepath: str, operations: List[Dict]) -> Dict
將CSV轉換為Excel
convert_csv_to_excel(source_path: str, target_path: str) -> Dict
創建PDF文件
create_pdf_file(filepath: str, content: str) -> Dict
將Word轉換為PDF
convert_word_to_pdf(source_path: str, target_path: str) -> Dict
🔧 技術細節
服務器將所有操作同時記錄到控制檯和logs/document_mcp.log
文件中,以便於故障排除。
📄 許可證
本項目採用MIT許可證。
🤝 貢獻
歡迎任何貢獻!請隨時提交Pull Request。
精選MCP服務推薦

Baidu Map
已認證
百度地圖MCP Server是國內首個兼容MCP協議的地圖服務,提供地理編碼、路線規劃等10個標準化API接口,支持Python和Typescript快速接入,賦能智能體實現地圖相關功能。
Python
707
4.5分

Markdownify MCP
Markdownify是一個多功能文件轉換服務,支持將PDF、圖片、音頻等多種格式及網頁內容轉換為Markdown格式。
TypeScript
1.7K
5分

Firecrawl MCP Server
Firecrawl MCP Server是一個集成Firecrawl網頁抓取能力的模型上下文協議服務器,提供豐富的網頁抓取、搜索和內容提取功能。
TypeScript
3.9K
5分

Sequential Thinking MCP Server
一個基於MCP協議的結構化思維服務器,通過定義思考階段幫助分解複雜問題並生成總結
Python
262
4.5分

Edgeone Pages MCP Server
EdgeOne Pages MCP是一個通過MCP協議快速部署HTML內容到EdgeOne Pages並獲取公開URL的服務
TypeScript
255
4.8分

Notion Api MCP
已認證
一個基於Python的MCP服務器,通過Notion API提供高級待辦事項管理和內容組織功能,實現AI模型與Notion的無縫集成。
Python
123
4.5分

Context7
Context7 MCP是一個為AI編程助手提供即時、版本特定文檔和代碼示例的服務,通過Model Context Protocol直接集成到提示中,解決LLM使用過時信息的問題。
TypeScript
5.2K
4.7分

Magic MCP
Magic Component Platform (MCP) 是一個AI驅動的UI組件生成工具,通過自然語言描述幫助開發者快速創建現代化UI組件,支持多種IDE集成。
JavaScript
1.7K
5分