- 新增 `send_asset_confirmation_card` 工具,用于发送资产变动确认卡片 - 新增 `upload_image_by_excel` 工具,支持从Excel中根据image_key定位并上传图片 - 在file-tools中添加 `excel_image_key_to_temp_file` 和 `upload_file_to_minio` 工具 - 新增配置文件管理和MinIO集成支持 - 更新项目依赖版本,添加openpyxl和minio库
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import asyncio
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def main() -> None:
|
|
if not os.getenv("app_id") or not os.getenv("app_secret"):
|
|
config_path = Path(__file__).with_name("mcp-server.json")
|
|
if config_path.exists():
|
|
config_data = json.loads(config_path.read_text(encoding="utf-8"))
|
|
env_data = (
|
|
config_data.get("mcpServers", {})
|
|
.get("lzwcai-mcpskills-lark-mcp", {})
|
|
.get("env", {})
|
|
)
|
|
if env_data.get("app_id") and env_data.get("app_secret"):
|
|
os.environ["app_id"] = env_data["app_id"]
|
|
os.environ["app_secret"] = env_data["app_secret"]
|
|
if not os.getenv("app_id") or not os.getenv("app_secret"):
|
|
raise RuntimeError("missing app_id or app_secret")
|
|
from lzwcai_lark_mcp.main import LarkMcpServer
|
|
from lzwcai_lark_mcp.tools import send_asset_confirmation_card
|
|
|
|
async def _run() -> None:
|
|
server = LarkMcpServer()
|
|
await server.ensure_token()
|
|
user_id = "843ga2gb"
|
|
result = send_asset_confirmation_card(
|
|
server.tenant_access_token or "",
|
|
user_id,
|
|
"2026-02-13 10:30:00",
|
|
["华为i手机"],
|
|
["红米手机"]
|
|
)
|
|
print(result)
|
|
|
|
asyncio.run(_run())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|