feat: 新增飞书和文件工具MCP服务并优化机器人配置
- 新增飞书MCP服务,包含图片上传和消息卡片发送功能 - 新增文件工具MCP服务,提供文件转JSON和data URI功能 - 更新机器人MCP服务配置,移除环境变量硬编码 - 升级机器人版本至0.1.28并优化迎宾功能参数 - 添加.gitignore和项目配置文件
This commit is contained in:
38
lzwcai_lark_mcp/test.py
Normal file
38
lzwcai_lark_mcp/test.py
Normal file
@@ -0,0 +1,38 @@
|
||||
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_card_message
|
||||
|
||||
async def _run() -> None:
|
||||
server = LarkMcpServer()
|
||||
await server.ensure_token()
|
||||
image_key = "img_v3_02uq_d48b3ee1-0f89-44a3-80cd-a5afa4f8c39g"
|
||||
receiver_id = "843ga2gb"
|
||||
person_id = receiver_id
|
||||
result = send_card_message(server.tenant_access_token or "", receiver_id, person_id, image_key)
|
||||
print(result)
|
||||
|
||||
asyncio.run(_run())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user