Set up LlamaIndex
Data framework for LLM applications. Use llama-index-tools-mcp to connect Agentcy as a tool source in your LlamaIndex agents and workflows.
- 01
Sign up at app.goagentcy.com and create an API key
- 02
Install the package: pip install llama-index llama-index-tools-mcp
- 03
Create a BasicMCPClient with the Agentcy HTTP URL
- 04
Replace YOUR_AGENTCY_API_KEY with your actual key
- 05
Wrap it in a McpToolSpec and pass tools to any LlamaIndex agent
path: pip install llama-index-tools-mcp
# Python — LlamaIndex with MCP
# pip install llama-index llama-index-tools-mcp
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
mcp_client = BasicMCPClient(
url="https://data.goagentcy.com/mcp",
headers={"Authorization": "Bearer YOUR_AGENTCY_API_KEY"},
)
mcp_tool_spec = McpToolSpec(client=mcp_client)
# Get tools as LlamaIndex FunctionTools
tools = mcp_tool_spec.to_tool_list()
# Use with any LlamaIndex agent
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
agent = ReActAgent.from_tools(tools, llm=OpenAI("gpt-4o"))
response = agent.chat("How is my site performing?")LlamaIndex supports both consuming MCP servers (via llama-index-tools-mcp) and exposing LlamaIndex workflows as MCP servers. Supports stdio and Streamable HTTP transports. Works with any LlamaIndex-compatible LLM provider.
After connecting LlamaIndex and configuring your data sources in the portal, ask questions about any of them in natural language: