This commit is contained in:
2026-02-12 16:59:06 +08:00
parent d42930e3a1
commit aea6b0e656

View File

@@ -34,8 +34,7 @@ from mcp_docx import get_images_info, process, _parse_span_replacement
mcp = FastMCP( mcp = FastMCP(
"docx-editor", "docx-editor"
description="DOCX 文本与图片编辑 MCP 服务器",
) )
@@ -168,12 +167,11 @@ if __name__ == "__main__":
if args.transport == "http": if args.transport == "http":
# HTTP 远程模式:通过 streamable-http 暴露 MCP 服务,端点 /mcp # 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") print(f"🚀 MCP HTTP 服务器启动中 → http://{args.host}:{args.port}/mcp")
mcp.run( mcp.run(transport="streamable-http")
transport="streamable-http",
host=args.host,
port=args.port,
)
else: else:
# 本地 stdio 模式 # 本地 stdio 模式
print("🚀 MCP stdio 模式启动中(本地使用)") print("🚀 MCP stdio 模式启动中(本地使用)")