入门攻略
MCP提交
探索
Document Operations (Word, Excel, PDF)
内容详情
替代品
用于Claude Desktop的文档编辑MCP服务器
一个允许Claude Desktop在Microsoft Word、Excel和PDF文件上执行文档操作的模型上下文协议(MCP)服务器。
特性
Microsoft Word 操作
- 使用文本创建新的Word文档
- 编辑现有Word文档(添加/修改/删除段落和标题)
- 将文本文件(.txt)转换为Word文档
Excel 操作
- 从JSON或CSV格式的文本创建新的Excel电子表格
- 编辑现有的Excel文件(更新单元格、范围,添加/删除行、列、工作表)
- 将CSV文件转换为Excel
PDF 操作
- 使用文本创建新的PDF文件
- 将Word文档转换为PDF文件
安装指南
该MCP服务器要求使用Python 3.10或更高版本。
自动安装(推荐)
运行设置脚本来自动安装依赖项并配置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
日志记录
服务器将所有操作同时记录到控制台和logs/document_mcp.log
文件中,以便于故障排除。
许可证
MIT
贡献
欢迎任何贡献!请随时提交Pull Request。