Prerequisites
- Python 3.9+
- Node.js 18+
- Agent MCP Studio at agentmcp.studio
Step-by-Step Setup
Install dependencies
pip install llama-index llama-index-tools-mcp llama-index-llms-anthropic
Start bridge.js
curl -O https://agentmcp.studio/bridge.js && npm install ws node bridge.js wss://agentmcp.studio/api/relay/YOUR-UUID
Open the studio โ Settings โ MCP Relay Bridge โ click Connect.
-
Load MCP tools in Python
import asyncio from llama_index.tools.mcp import McpToolSpec from llama_index.core.agent import ReActAgent from llama_index.llms.anthropic import Anthropic async def main(): # Connect to your browser-based MCP server mcp_tool_spec = McpToolSpec( server_command="node", server_args=[ "/path/to/bridge.js", "wss://agentmcp.studio/api/relay/YOUR-UUID" ] ) tools = await mcp_tool_spec.to_tool_list_async() llm = Anthropic(model="claude-3-5-sonnet-20241022") agent = ReActAgent.from_tools(tools, llm=llm, verbose=True) response = agent.chat("Query the sales data and give me the top products") print(response) asyncio.run(main())
Frequently Asked Questions
Use llama-index-tools-mcp (pip install). It provides BasicMCPClient and McpToolSpec that connect to any MCP server and return LlamaIndex-compatible tools for use in agents and query engines.
Yes โ LlamaIndex MCP tools can be used in any agent setup including RAG pipelines. Tools from Agent MCP Studio can perform data retrieval, processing, or transformation as steps within a query engine or agent workflow.
Yes โ LlamaIndex supports local models via Ollama, LlamaCPP, and vLLM. As long as the model supports function calling, MCP tools from Agent MCP Studio are available to LlamaIndex agents using those models.
Both frameworks support MCP tool integration but differ in philosophy. LlamaIndex focuses on data/RAG pipelines with strong indexing capabilities. LangChain is broader, covering chains and agents. Both use bridge.js to connect to Agent MCP Studio.
Install llama-index-tools-mcp, create a BasicMCPClient pointing at your bridge.js + relay URL, call McpToolSpec(client).to_tool_list() to get tools, then pass them to ReActAgent.from_tools(tools).