Word 工具 MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供 AI 驱动的 Word 文档操作功能。该服务器实现了 MCP 协议,使 AI 应用程序能够通过自然语言交互来创建、编辑和管理 Word 文档。
特征
完整的 MCP 协议实现
Word文档的创建和管理
富文本内容操作
表格创建和格式化
文档布局控制
文档元数据管理
实时文档状态监控
先决条件
Node.js 14 或更高版本
Microsoft Word(可选,用于高级功能)
安装
或者全局安装:
用作项目中的依赖项:
用法
启动 MCP 服务器:
服务器默认在 8765 端口启动
配置您的 AI 应用程序(例如 Cursor、VSCode)以使用 MCP 服务器:
http://localhost:8765
MCP 工具
该服务器提供以下MCP功能:
create_document
创建一个新的Word文档参数:filePath(必需)、title、author
open_document
打开现有的Word文档参数:filePath(必需)
add_paragraph
- 向文档添加一个段落参数:filePath(必需)、text(必需)、style、alignment
add_table
向文档添加表格参数:filePath(必需)、rows(必需)、cols(必需)、headers、data
search_and_replace
- 查找并替换文档中的文本参数:filePath(必需)、searchText(必需)、replaceText(必需)、matchCase
set_page_margins
- 设置文档页边距参数:filePath(必需)、top、right、bottom、left
get_document_info
- 获取文档元数据参数:filePath(必需)
与人工智能应用程序集成
光标
打开 Cursor 配置文件
~/.cursor/mcp.json
添加以下配置:
或者对于本地开发版本:
配置完成后就可以使用自然语言来操作Word文档了:
VSCode 和其他 MCP 兼容工具
类似的集成步骤适用于其他支持 MCP 协议的工具。有关具体的 MCP 服务器配置步骤,请参阅您工具的文档。
发展
要扩展或修改此 MCP 服务器:
克隆存储库:
安装依赖项:
以开发模式启动:
为生产而构建:
添加新的 MCP 功能
在
src/services/DocumentService.ts
中添加新方法在
src/mcp-server.ts
中注册新函数根据需要更新类型定义
配置
默认端口:8765(可配置)
支持的文件类型:.docx
所有文件路径应为绝对路径或相对于当前工作目录的路径
执照
麻省理工学院
支持
如果您遇到任何问题或有改进建议,请在我们的 GitHub 存储库上提交问题。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
让AI通过自然语言阅读、创建和修改Word文档
Related Resources
Related MCP Servers
- -securityFlicense-qualityEnables AI language models to interact with Microsoft OneNote via a standardized interface, supporting notebook and page management through natural language.Last updated -919
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to create, read, edit, and format Microsoft Word documents through standardized tools and resources.Last updated -54811MIT License
- AsecurityAlicenseAqualityEnables AI agents to interact with Notion workspaces through the Notion API. Supports reading, writing, and managing pages, databases, and comments with optimized token consumption.Last updated -1912,735MIT License
- -securityAlicense-qualityEnables AI assistants to create, read, and manipulate Microsoft Word documents with comprehensive formatting, table creation, content management, and document protection capabilities. Supports advanced operations like merging documents, PDF conversion, and rich text formatting through a standardized interface.Last updated -32MIT License