Use Webcite with LangChain: fact-check and cite from your agent
To use Webcite from LangChain, load the Webcite MCP server's tools with the langchain-mcp-adapters package: one client definition gives your Python code or agent all 34 tools, from verify_claim to extract_document. This guide was run with langchain-mcp-adapters 0.3.2 and webcite-mcp-server 1.9.66 on Node.js 22.
Last updated
Install
pip install langchain-mcp-adapters
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 langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient(
{
"webcite": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "webcite-mcp-server"],
"env": {"WEBCITE_API_KEY": os.environ["WEBCITE_API_KEY"], "PATH": os.environ["PATH"]},
}
}
)
async def main():
tools = {tool.name: tool for tool in await client.get_tools()}
print(len(tools), "tools")
result = await tools["verify_claim"].ainvoke(
{"claim": "The Great Wall of China is visible from the Moon with the naked eye."}
)
print(result)
asyncio.run(main())get_tools() returns 34 LangChain tools. verify_claim costs 4 credits and returns the verdict, each source's stance and the passages. The recorded REST response for this claim shows the same verification fields.
Give the tools to an agent
The tools are ordinary LangChain tools, so pass the list to the agent you already build. Tell it to call webcite_guide first: the guide picks the workflow for the request, such as reading a document before checking its claims.
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 server does not throw. - Without
WEBCITE_API_KEYthe server prints an error and exits before it starts. - Errors and rate limits covers retries without repeating paid work.