LlamaIndex
McpToolSpec, into an agent or a workflow.
Kind Framework
Transport llama-index-tools-mcp, streamable HTTP.
Config —
Setup
- pip install llama-index-tools-mcp
- Point a BasicMCPClient at the endpoint with your key as a header.
- Wrap it in McpToolSpec and hand the tools to an agent.
import os, asyncio
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.anthropic import Anthropic
async def main():
client = BasicMCPClient(
"https://api.unzoi.com/mcp",
headers={"x-api-key": os.environ["UNZOI_KEY"]},
)
tools = await McpToolSpec(client=client).to_tool_list_async()
agent = FunctionAgent(
tools=tools,
llm=Anthropic(model="claude-sonnet-5"),
system_prompt="Use unzoi for current events. Prefer list_stories when the question is about an event.",
)
print(await agent.run("Summarise this week's semiconductor policy coverage."))
asyncio.run(main())What differs here
- McpToolSpec can be restricted to a subset with allowed_tools, which is worth doing — a research agent has no use for account_status.
- Use the async tool list. The sync variant blocks the event loop, which matters inside a workflow.
- The tools are ordinary FunctionTools once converted, so they compose with everything else in a LlamaIndex workflow.
Next
- Get a key at console.unzoi.com, if you have not.
- The tool reference — what the model is reading when it chooses between the six tools.
- Stories for context windows — the one habit that most changes how well an agent works against this API.
- Limits — an agent that loops can spend a monthly quota faster than you expect.
- LlamaIndex's own MCP documentation — authoritative for anything about the client itself, including config paths, which move.
Endpoint, for copying: https://api.unzoi.com/mcp