LlamaIndex
Use AllMCP tools in LlamaIndex agents via the MCP tool spec.
All frameworks Browse providers-
Install the packages
install pip install llama-index-tools-mcp llama-index-llms-anthropic -
Wire up the agent
agent.py import asynciofrom llama_index.tools.mcp import BasicMCPClient, McpToolSpecfrom llama_index.llms.anthropic import Anthropicfrom llama_index.core.agent.workflow import ReActAgentasync def main():mcp_client = BasicMCPClient(command_or_url="https://go.allmcp.co/mcp/",headers={"X-API-Key": "YOUR_API_KEY"},)tool_spec = McpToolSpec(client=mcp_client)tools = await tool_spec.to_tool_list_async()llm = Anthropic(model="claude-sonnet-4-6")agent = ReActAgent(tools=tools, llm=llm)response = await agent.run("List my open deals in Bitrix24")print(response)asyncio.run(main())
Filtering tools
Section titled “Filtering tools”AllMCP exposes many tools. You can filter to only the ones you need:
all_tools = await tool_spec.to_tool_list_async()
# Keep only Bitrix24 toolsbitrix_tools = [t for t in all_tools if t.metadata.name.startswith("bitrix24_")]
agent = ReActAgent(tools=bitrix_tools, llm=llm)Using with FunctionAgent
Section titled “Using with FunctionAgent”from llama_index.core.agent.workflow import FunctionAgent
agent = FunctionAgent(tools=tools, llm=llm)response = await agent.run("What Google Sheets do I have access to?")Multi-user setup
Section titled “Multi-user setup”def make_tools_for_user(user_id: str): client = BasicMCPClient( command_or_url=f"https://go.allmcp.co/mcp/?user_id={user_id}", headers={"X-API-Key": "YOUR_API_KEY"}, ) return McpToolSpec(client=client)Async workflow
Section titled “Async workflow”async def answer_question(user_id: str, question: str) -> str: spec = make_tools_for_user(user_id) tools = await spec.to_tool_list_async() agent = ReActAgent(tools=tools, llm=Anthropic(model="claude-sonnet-4-6")) return str(await agent.run(question))See also
Section titled “See also” Browse providers See every provider you can connect and the tools each one offers.