LlamaIndex 集成
将LlamaIndex代理连接到ThorData MCP服务器,即可将实时网络搜索、抓取和结构化数据检索添加到您的RAG和索引管ThorData MCP服务器,即可将实时网络搜索、抓取和结构化数据检索添加到您的RAG和索引管道中。
托管 MCP
1
获取您的 API 令牌
前往 SERP API-API Token 创建API Token
复制您的 API 令牌(格式如下:
sk_7qBRe***************************)
2
安装LlamaIndex MCP工具包
pip install llama-index-tools-mcp3
配置您的MCP服务器
import asyncio
from llama_index.tools.mcp import BasicMCPClient
async def main():
http_client = BasicMCPClient("https://mcp.thordata.com/API_TOKEN/mcp")
# List tools
tools = await http_client.list_tools()
print("Tools:", tools)
# Call a tool
result = await http_client.call_tool("scrape_as_markdown", {"url":"https://docs.llamaindex.ai/en/stable/examples/tools/mcp/"})
print("Result:", result)
asyncio.run(main())
4
测试一下是否有效
使用手动工具运行您的LlamaIndex脚本
你应该能在Markdown中看到请求的URL
5
监控使用情况
在 ThorData SERP API-使用记录 中查看您的 API 使用情况。
Last updated
Was this helpful?