开发者文档 SDK

MCP

调用项目 MCP server 暴露的工具(仅 streamable-http),同步或异步皆可。

Python

result = mcp("github").call("create_issue", {"title": "Fix login"})
tools = mcp("github").list_tools()

# 一次性快捷调用(单次 RPC 超时 60 秒)
result = mcp_call("github", "create_issue", {"title": "Fix login"})

# async 任务
import asyncio
r1, r2 = await asyncio.gather(
    mcp("exa").acall("web_search_exa", {"query": "MCP"}),
    mcp("context7").acall("resolve-library-id", {"query": "fastapi"}),
)

TypeScript

import { mcp, mcp_call } from "@allybuild/sdk";

const github = await mcp("github");
const tools = await github.listTools();
const result = await github.call("create_issue", { title: "Fix login" });

// 一次性快捷调用(单次 RPC 超时 60 秒)
await mcp_call("exa", "web_search_exa", { query: "MCP" });