Use Webcite with LlamaIndex: verified answers with citations
To use Webcite from LlamaIndex, connect the llama-index-tools-mcp client to webcite-mcp-server and convert its tools: your code or agent gets all 34 Webcite tools as LlamaIndex tools, from verify_claim to extract_document. This guide was run with llama-index-tools-mcp 0.7.0, llama-index-core 0.14.26 and webcite-mcp-server 1.9.67 on Node.js 22.
Last updated
Install
pip install llama-index-tools-mcp
export WEBCITE_API_KEY="YOUR_API_KEY"The npm server needs an API key from the API keys page in WEBCITE_API_KEY. Keep it on your server. The server runs through npx, so Node.js must be installed.
Load the tools and verify a claim
import asyncio
import os
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
async def main():
client = BasicMCPClient(
"npx",
args=["-y", "webcite-mcp-server"],
env={"WEBCITE_API_KEY": os.environ["WEBCITE_API_KEY"], "PATH": os.environ["PATH"]},
)
tools = {tool.metadata.name: tool for tool in await McpToolSpec(client=client).to_tool_list_async()}
print(len(tools), "tools")
result = await tools["verify_claim"].acall(
claim="The Great Wall of China is visible from the Moon with the naked eye."
)
print(result.raw_output.content[0].text)
asyncio.run(main())This prints 34 tools, then the verification. verify_claim costs 4 credits; the saved response for this claim shows the verdict, each source's stance and the passages. result.raw_output holds the MCP result; BasicMCPClient starts a fresh server process for each call.
Give the tools to an agent
The list from to_tool_list_async() is ordinary LlamaIndex tools, so pass it to the agent you already build. Tell the agent to call webcite_guide first; it picks the workflow for the request.
If a call fails
- A missing or wrong key comes back as a tool result that starts with
Error [unauthorized]and says how to reconnect; the call does not raise. - Errors and rate limits covers retries without repeating paid work.