LlamaIndex
LlamaIndex:帶有 headers 的 BasicMCPClient,再由 McpToolSpec 將這些工具轉換為 LlamaIndex 工具。
- API 金鑰(Bearer)
- OAuth 登入
用戶端程式碼
推薦import asyncio, os
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
async def main():
client = BasicMCPClient("https://aicharged.io/api/v1/mcp", headers={"Authorization": f"Bearer {os.environ['AICHARGED_API_KEY']}"})
tools = await McpToolSpec(client=client).to_tool_list_async()
print([tool.metadata.name for tool in tools])
asyncio.run(main())
安裝套件
pip install llama-index-tools-mcp