前言

今天在写论文,使用cursor生成论文的整个源码及说明文档,AI大模型目前是不能直接生成Word的,给cursor安排了Word-MCP。Office-Word-MCP-Server是一个专为Cursor编辑器设计的MCP(Model Context Protocol)服务器,它能够实现在Cursor中Word文档创建、markdown转Word等功能。

项目简介

在这里插入图片描述

Office-Word-MCP-Server(https://github.com/GongRzhe/Office-Word-MCP-Server.git)是一个基于MCP协议的开源项目,主要功能包括:

  • 文档创建与编辑:直接从Cursor创建和修改Word文档
  • 格式转换:将Markdown、代码块转换为Word格式
  • 实时同步:保持Cursor和Word内容的同步更新
  • 模板支持:使用预定义模板快速生成文档

环境准备

系统要求

  • Windows 10/11(支持Microsoft Word)
  • Node.js 16.0或更高版本
  • Cursor编辑器最新版本
  • Microsoft Word 2016或更高版本

依赖安装

首先克隆项目到本地:

git clone https://github.com/GongRzhe/Office-Word-MCP-Server.git
cd Office-Word-MCP-Server

安装项目依赖:

npm install

或使用yarn:

yarn install

Cursor配置步骤

在这里插入图片描述
在这里插入图片描述

1. 配置MCP服务器

在Cursor中打开设置,找到MCP配置选项,添加以下配置:

{
  "mcpServers": {
    "word-document-server": {
      "command": "G:\\aicode\\cursorword\\Office-Word-MCP-Server\\.venv\\Scripts\\python.exe",
      "args": [
        "G:\\aicode\\cursorword\\Office-Word-MCP-Server\\word_mcp_server.py"
      ],
      "env": {
        "PYTHONPATH": "G:\\aicode\\cursorword\\Office-Word-MCP-Server",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

2. 修改配置文件路径

将上述配置中的`替换为实际的项目路径,例如:

你根据上面实际的路径,替换3个G盘的路径为你自己的实际路径。

3. 启动服务验证

重启Cursor编辑器,在命令面板中输入"MCP"查看是否成功加载Office-Word服务器。

核心功能使用

文档创建功能

在Cursor中使用以下命令创建新的Word文档:

// 通过MCP调用创建文档
AI会自动调用WORDMCP

在这里插入图片描述

Markdown转Word

To update, run: G:\aicode\cursorword\Office-Word-MCP-Server\.venv\Scripts\python.exe -m pip install --upgrade pip
Requirements installed successfully!

MCP configuration has been written to: G:\aicode\cursorword\Office-Word-MCP-Server\mcp-config.json

MCP configuration for Claude Desktop:
{
  "mcpServers": {
    "word-document-server": {
      "command": "G:\\aicode\\cursorword\\Office-Word-MCP-Server\\.venv\\Scripts\\python.exe",
      "args": [
        "G:\\aicode\\cursorword\\Office-Word-MCP-Server\\word_mcp_server.py"
      ],
      "env": {
        "PYTHONPATH": "G:\\aicode\\cursorword\\Office-Word-MCP-Server",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

💻 STDIO Transport Configuration:
   Server runs locally with standard input/output
```c


总结

通过本教程,您已经学会了如何在Cursor中配置和使用Office-Word-MCP-Server工具。这个强大的集成方案为开发者提供了:

  1. 无缝集成:Cursor与Word之间的直接数据交换
  2. 格式转换:自动化的Markdown到Word转换
  3. 模板支持:快速生成标准化文档
  4. 批量处理:高效的大量文档操作
Logo

更多推荐