MCP 概念

允许的工具

任何事物都不允许,除非你这么说。不要谨慎——算术:每次运行的每一关,申报都要花代币。

none by defaultchosen per connectionthe cost is per turn
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

算术

每个允许的工具都随每转而发送

一个服务器提供90个工具,所有这些都允许,给每个使用工具的运行的每一步都增加大笔固定成本——由账户持有人支付,不论是否一个答案都得到回答。

这就是为什么默认是零,为什么选择是在连接而不是运行时作出:这是关于账户持续支付什么的决定。

选择他们

// At connection
await api.mcp.connect({ url, name: "example", tools: ["search_docs", "get_issue"] });

// Later — the list is replaced, not added to
const server = await api.mcp.get("example");
const allowed = server.tools.filter((t) => t.allowed).map((t) => t.name);
await api.mcp.update("example", { tools: [...allowed, "create_issue"] });
# At connection
api.mcp.connect(url=url, name="example", tools=["search_docs", "get_issue"])

# Later — the list is replaced, not added to
server = api.mcp.get("example")
allowed = [t["name"] for t in server["tools"] if t["allowed"]]
api.mcp.update("example", tools=[*allowed, "create_issue"])

观看总数

const servers = await api.mcp.list();
const perTurn = servers.reduce((n, s) => n + s.allowed, 0);
console.log(perTurn, "MCP tools declared on every turn");
servers = api.mcp.list()
per_turn = sum(s["allowed"] for s in servers)
print(per_turn, "MCP tools declared on every turn")

新的工具抵达被拒绝

刷新服务器时带来的任何附加内容 allowed: false服务器不能通过运输更多工具来扩大自己的表面。

关闭服务器

tools: [] 保持连接和标志,不做任何宣布。可以变现,同时不花费任何费用。

窄节拍完成

三种选择良好的工具比九十种工具更能提供更好的代理:模型每转弯读取每一个描述,长长的近同名词清单是选择错误名称的理由。