LlamaIndex
Connect a LlamaIndex agent to Leadovaro using BasicMCPClient and McpToolSpec. LlamaIndex's MCP integration discovers all available tools and exposes them to a FunctionAgent.
Prerequisites
- Python 3.11+
- A Leadovaro account at app.leadovaro.com with a configured toolkit
- A Leadovaro token and an Anthropic API key
Installation
pip install llama-index llama-index-tools-mcp llama-index-llms-anthropic python-dotenv
Environment Variables
LEADOVARO_URL=/_sites/app.leadovaro.com/hub/mcp?profile=your-toolkit
LEADOVARO_TOKEN=your-leadovaro-token
ANTHROPIC_API_KEY=your-anthropic-key
Get Your Credentials
How to generate a Leadovaro token and configure toolkit URL parameters
Connecting to Leadovaro
Use BasicMCPClient to connect (URL is positional, not a keyword argument), then convert tools with McpToolSpec:
import os
import asyncio
from dotenv import load_dotenv
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.llms.anthropic import Anthropic
from llama_index.core.agent.workflow import FunctionAgent
load_dotenv()
async def main():
mcp_client = BasicMCPClient(
os.environ["LEADOVARO_URL"], # positional — not url=
headers={"Authorization": f"Bearer {os.environ['LEADOVARO_TOKEN']}"},
)
spec = McpToolSpec(client=mcp_client)
tools = await spec.to_tool_list_async()
print(f"{len(tools)} tools loaded")
llm = Anthropic(model="claude-sonnet-4-6")
agent = FunctionAgent(
tools=tools,
llm=llm,
system_prompt="You are a helpful assistant with access to Leadovaro tools.",
)
response = await agent.run("What events do I have today?")
print(response)
asyncio.run(main())
note
Pass the URL as a positional argument to BasicMCPClient — using url= as a keyword will raise an error. Use FunctionAgent from llama_index.core.agent.workflow — ReActAgent.from_tools is not available in LlamaIndex v0.14+.
Production Configuration
For production agents, lock to a specific toolkit using the profile URL parameter:
LEADOVARO_URL=/_sites/app.leadovaro.com/hub/mcp?profile=your-production-toolkit
Reference Implementation
llamaindex-reference-implementation-leadovaro
Complete implementation with FastAPI chat UI and deployment guide