Skip to content
unzoi docs

LlamaIndex

McpToolSpec, into an agent or a workflow.

Kind Framework
Transport llama-index-tools-mcp, streamable HTTP.
Config

Setup

  1. pip install llama-index-tools-mcp
  2. Point a BasicMCPClient at the endpoint with your key as a header.
  3. 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

Endpoint, for copying: https://api.unzoi.com/mcp