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