This commit is contained in:
2026-03-20 19:45:19 +08:00
parent 248f7a2637
commit 3757894e7c
2 changed files with 11 additions and 9 deletions

View File

@@ -2,9 +2,11 @@
"""
基于 mcp_docx.py 封装的 MCP 服务器。
暴露两个主要 MCP 工具:
暴露主要 MCP 工具:
- list_docx_images列出 DOCX 中的图片信息
- edit_docx: 进行文本替换 / 关键字上色 / 图片替换
另外提供一个普通函数 `edit_docx`(供 Python 代码直接调用),支持:
- 进行文本替换 / 关键字上色 / 图片替换
额外提供 HTTP 文件接口(仅在 http 模式下可用):
- POST /upload: 上传文件到服务器
@@ -313,8 +315,7 @@ async def list_docx_images(docx_url: str) -> List[Dict[str, Any]]:
imgs = get_images_info(_download_to_temp(docx_url, suffix=".docx"))
return imgs
@mcp.tool()
async def edit_docx(
def edit_docx(
input_docx_path: str,
replacements: List[Dict[str, str]] = None,
image_replacements: Optional[List[Dict[str, Any]]] = None,