Document Edit Mcp

Document Edit Mcp

🚀 Claude 文档 MCP 服务器

Claude 文档 MCP 服务器是一个基于 Model Context Protocol (MCP) 的服务器,它允许 Claude Desktop 对 Microsoft Word、Excel 和 PDF 文件执行各种文档操作,极大地提升了文档处理的效率和便捷性。

🚀 快速开始

此 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

这将:

  1. 创建一个虚拟环境
  2. 安装所需的依赖项
  3. 配置服务器以供 Claude Desktop 使用
  4. 创建必要的目录

手动安装

如果你更喜欢手动设置:

  1. 安装依赖项:
cd claude-document-mcp
python -m venv .venv
source .venv/bin/activate  # 在 Windows 上:.venv\Scripts\activate
pip install -e .
  1. 配置 Claude Desktop: 复制 claude_desktop_config.json 文件到:
  • Mac~/Library/Application Support/Claude/
  • Windows%APPDATA%\Claude\
  1. 重启 Claude Desktop

📚 详细文档

Model Context Protocol 集成

此服务器遵循 Model Context Protocol 规范,以提供文档操作功能供 Claude Desktop 使用:

  • 工具:提供 Word、Excel 和 PDF 操作函数
  • 资源:提供有关功能的信息
  • 提示:(尚未实现)

💻 使用示例

基础用法

以下是使用 API 进行文档操作的示例:

创建 Word 文档

# 创建 Word 文档
create_word_document(filepath: str, content: str) -> Dict

编辑 Word 文档

# 编辑 Word 文档
edit_word_document(filepath: str, operations: List[Dict]) -> Dict

将 TXT 转换为 Word

# 将 TXT 转换为 Word
convert_txt_to_word(source_path: str, target_path: str) -> Dict

创建 Excel 文件

# 创建 Excel 文件
create_excel_file(filepath: str, content: str) -> Dict

编辑 Excel 文件

# 编辑 Excel 文件
edit_excel_file(filepath: str, operations: List[Dict]) -> Dict

将 CSV 转换为 Excel

# 将 CSV 转换为 Excel
convert_csv_to_excel(source_path: str, target_path: str) -> Dict

创建 PDF 文件

# 创建 PDF 文件
create_pdf_file(filepath: str, content: str) -> Dict

将 Word 转换为 PDF

# 将 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

创建 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。

  • 0 关注
  • 0 收藏,28 浏览
  • system 提出于 2025-10-02 03:15

相似服务问题

相关AI产品