diff --git a/mcp_docx_server.py b/mcp_docx_server.py index 29e4b2c..a3249bb 100644 --- a/mcp_docx_server.py +++ b/mcp_docx_server.py @@ -34,8 +34,7 @@ from mcp_docx import get_images_info, process, _parse_span_replacement mcp = FastMCP( - "docx-editor", - description="DOCX 文本与图片编辑 MCP 服务器", + "docx-editor" ) @@ -168,12 +167,11 @@ if __name__ == "__main__": if args.transport == "http": # HTTP 远程模式:通过 streamable-http 暴露 MCP 服务,端点 /mcp + # 兼容当前 FastMCP 版本:通过 settings 配置 host/port,而不是传给 run() + mcp.settings.host = args.host + mcp.settings.port = args.port print(f"🚀 MCP HTTP 服务器启动中 → http://{args.host}:{args.port}/mcp") - mcp.run( - transport="streamable-http", - host=args.host, - port=args.port, - ) + mcp.run(transport="streamable-http") else: # 本地 stdio 模式 print("🚀 MCP stdio 模式启动中(本地使用)")