Mastra
Mastra:来自 @mastra/mcp 的 MCPClient,密钥放在 requestInit 的 headers 中。
- API 密钥(Bearer)
- OAuth 登录
客户端代码
推荐import { MCPClient } from '@mastra/mcp';
const mcp = new MCPClient({
servers: {
aicharged: {
url: new URL('https://aicharged.io/api/v1/mcp'),
requestInit: { headers: { Authorization: `Bearer ${process.env.AICHARGED_API_KEY}` } },
},
},
});
const tools = await mcp.listTools();
console.log(Object.keys(tools));
安装软件包
npm install @mastra/mcp