doc-tools-mcp
Word 工具 MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供 AI 驱动的 Word 文档操作功能。该服务器实现了 MCP 协议,使 AI 应用程序能够通过自然语言交互来创建、编辑和管理 Word 文档。
特征
完整的 MCP 协议实现
Word文档的创建和管理
富文本内容操作
表格创建和格式化
文档布局控制
文档元数据管理
实时文档状态监控
Related MCP server: MCP Word Commander
先决条件
Node.js 14 或更高版本
Microsoft Word(可选,用于高级功能)
安装
npx @puchunjie/doc-tools-mcp或者全局安装:
npm install -g @puchunjie/doc-tools-mcp用作项目中的依赖项:
npm install @puchunjie/doc-tools-mcp用法
启动 MCP 服务器:
npx @puchunjie/doc-tools-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添加以下配置:
{
"mcpServers": {
"doc-tools-mcp": {
"command": "npx",
"args": [
"@puchunjie/doc-tools-mcp"
]
}
}
}
或者对于本地开发版本:
{
"mcpServers": {
"doc-tools-mcp": {
"command": "node",
"args": [
"/path/to/your/doc-tools-mcp/dist/mcp-server.js"
]
}
}
}配置完成后就可以使用自然语言来操作Word文档了:
"Create a new document named report.docx"
"Add a heading 'Monthly Report' to report.docx"
"Insert a 4x3 table with sales data"VSCode 和其他 MCP 兼容工具
类似的集成步骤适用于其他支持 MCP 协议的工具。有关具体的 MCP 服务器配置步骤,请参阅您工具的文档。
发展
要扩展或修改此 MCP 服务器:
克隆存储库:
git clone <repository-url>
cd doc-tools-mcp安装依赖项:
npm install以开发模式启动:
npm run start为生产而构建:
npm run build添加新的 MCP 功能
在
src/services/DocumentService.ts中添加新方法在
src/mcp-server.ts中注册新函数根据需要更新类型定义
配置
默认端口:8765(可配置)
支持的文件类型:.docx
所有文件路径应为绝对路径或相对于当前工作目录的路径
执照
麻省理工学院
支持
如果您遇到任何问题或有改进建议,请在我们的 GitHub 存储库上提交问题。
Available Tools
7 toolsadd_paragraphD
Inputs: filePath (required), text (required), style, alignment.
add_tableD
Inputs: filePath (required), rows (required), cols (required), headers, +1 more.
create_documentD
Inputs: filePath (required), title, author.
get_document_infoD
Inputs: filePath (required).
open_documentD
Inputs: filePath (required).
search_and_replaceD
Inputs: filePath (required), searchText (required), replaceText (required), matchCase.
set_page_marginsD
Inputs: filePath (required), top, right, bottom, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The tools have clearly distinct purposes targeting different document operations: creating documents, opening them, adding content (paragraphs/tables), modifying content (search/replace), adjusting layout (margins), and retrieving metadata. There is minor potential overlap between 'create_document' and 'open_document' if 'open' implies creation, but they are generally distinct.
All tool names follow a consistent verb_noun pattern with snake_case throughout (e.g., add_paragraph, create_document, get_document_info). There are no deviations in naming conventions, making the set predictable and readable.
With 7 tools, this is a well-scoped set for a document management server. It covers core operations without being overly sparse or bloated, aligning with typical tool counts for focused domains like this.
The tools cover creation, opening, content addition, basic editing, layout adjustment, and info retrieval, but there are notable gaps. Missing operations include updating or deleting documents, managing document versions, or handling more complex formatting, which could limit agent workflows in a document management context.
Maintenance
Related MCP Connectors
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Create and manage documents, spreadsheets, and presentations from your AI assistant.
Document editing, AI writing, saved documents, DOCX downloads, PDF, STT, TTS and watermarking
Real Word and Excel for agents: open your .docx/.xlsm, read, propose, apply, get it back intact.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading, creating, and appending content to Microsoft Word (.docx) files through natural language commands.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to directly read, edit, and manipulate Word documents, supporting image and table operations, paragraph editing, and search/replace.202MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to create, edit, and extract data from Microsoft Word documents programmatically, supporting document creation, content editing, table manipulation, parameter extraction, and template generation.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to create, read, and manipulate Microsoft Word documents with rich editing capabilities.MIT