mcp-docx-template
MCP DOCX Template Server
一个便携式 MCP 服务器,可克隆带样式的 Microsoft Word 模板,并用另一个文档的内容填充,保留图片、布局、字体、颜色和段落样式。
工具
该服务器提供三个工具:
analyze_template— 检查.docx模板并返回其段落结构、图片、样式和内容架构。同时会在模板旁边写入一个<template>.docx.md描述文件,以便重复查找(例如通过map_content_to_template提示)时无需重新分析。extract_content— 从内容.docx中提取可编辑的文本块。fill_template— 克隆模板并使用标签到文本的映射替换其可编辑文本。可选地将结果转换为 PDF。
Related MCP server: Word MCP Server
提示
map_content_to_template— 给定template_path和content_path,读取模板的.docx.md描述文件(如果不存在则先分析并写入),以及提取的内容,并返回一条用于构建content_mapping的指令消息。当映射不明确时,助手会被告知直接询问用户,然后调用fill_template。
安装
pip install .或者,用于带测试的开发:
pip install -e ".[dev]"与 Claude Desktop 一起使用
将服务器添加到你的 Claude Desktop 配置(claude_desktop_config.json)中:
{
"mcpServers": {
"docx-template": {
"command": "mcp-docx-template-server"
}
}
}该服务器使用 stdio 传输。配置完成后,Claude 可以调用 analyze_template、extract_content 和 fill_template。
示例流程
分析模板:
{
"template_path": "/path/to/SSIT_Template.docx"
}从源文档提取内容:
{
"content_path": "/path/to/NetApp_Content.docx"
}填充模板:
{
"template_path": "/path/to/SSIT_Template.docx",
"content_mapping": {
"overview": "NetApp Cutover Dependency Mapper",
"business_challenge": "Business Challenge",
"body_1": "Long body paragraph...",
"solution_item_1": "Title\nBody text..."
},
"output_path": "/path/to/output.docx",
"convert_to_pdf": true
}开发
运行测试:
pytest许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Automate enterprise-grade documents from templates, merge and 100+ conversions: PDF, Office, HTML.
Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.
Fill PDF and Word templates, generate PDFs and Word documents, and collect e-signatures.
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Word document generation from templates using Jinja2 syntax and parsing of DOCX, PDF, and Excel files to extract structured content, metadata, and text.16 npm1MIT
- FlicenseNot gradedqualityDmaintenanceEnables creation and management of Word documents from markdown content, with support for multiple templates and conversion of chat conversations to formatted Word documents.-
- AlicenseBqualityDmaintenanceEnables comprehensive management of Microsoft Word documents with 30+ tools for reading, writing, formatting, template merging, image extraction, equation extraction, and style application.241MIT
- AlicenseBqualityCmaintenanceEnables creating professional Word documents from markdown or structured content with fast, customized formatting via natural language.71ISC