Home / MCP / LlamaCloud MCP Server
Provides LlamaCloud-backed MCP server access to query indexes and extract data using agents.
Configuration
View docs{
"mcpServers": {
"llamacloud_mcp": {
"command": "uvx",
"args": [
"llamacloud-mcp@latest",
"--index",
"your-index-name:Description",
"--index",
"your-other-index:Description",
"--extract-agent",
"extract-agent-name:Description",
"--project-name",
"<Your LlamaCloud Project Name>",
"--org-id",
"<Your LlamaCloud Org ID>",
"--api-key",
"<Your LlamaCloud API Key>"
],
"env": {
"LLAMA_CLOUD_API_KEY": "YOUR_LLAMA_CLOUD_API_KEY",
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"
}
}
}
}You can run LlamaCloud as an MCP server to power private, up-to-date question answering by querying LlamaCloud indexes and extracting data with specialized agents. This server can be consumed by MCP clients like Claude Desktop, enabling seamless tool-based querying and RAG-powered responses. You can run a local stdio MCP server or build a small Python MCP server to expose your LlamaCloud index as tools for clients to use.
To query your LlamaCloud-backed MCP server from an MCP client, start the stdio server and connect the client to it. The server exposes one or more indexes as context sources and one or more extract agents as data extractors. You can configure project and organization IDs and supply an API key to access LlamaCloud.
Prerequisites: you need the tooling to start a local MCP server and your programming language/runtime of choice for the server variant.
Option A — Run a local stdio MCP server with uvx (recommended for quick testing) — steps:
Install uv (the runner for MCP tools).
Run the MCP server using the following command to start listening on stdio:
uvx llamacloud-mcp@latest --index your-index-name:Description --extract-agent your-extract-agent:Description --project-id YOUR_PROJECT_ID --org-id YOUR_ORG_ID --transport stdio --api-key YOUR_LLAMACLOUD_API_KEYIf you prefer to configure Claude Desktop to connect to this server, you can prepare a config that includes an entry for the server. Create or edit the configuration file and add a server block similar to the following, then restart Claude Desktop to apply the changes.
{
"mcpServers": {
"llamacloud_mcp": {
"command": "uvx",
"args": [
"llamacloud-mcp@latest",
"--index",
"your-index-name:Description",
"--index",
"your-other-index:Description",
"--extract-agent",
"extract-agent-name:Description",
"--project-name",
"<Your LlamaCloud Project Name>",
"--org-id",
"<Your LlamaCloud Org ID>",
"--api-key",
"<Your LlamaCloud API Key>"
]
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"<your directory you want filesystem tool to have access to>"
]
}
}
}Note: restart Claude Desktop after configuring the file to ensure the new MCP server is detected and usable.
LlamaCloud-based MCP server setup from scratch uses a Python tool to expose the index as a toolset. You can define tools that run queries against a LlamaCloud index, enabling interactive querying and retrieval. The example below shows a tool named llama_index_documentation that queries a LlamaCloud index called mcp-demo-2 using the provided API key.
Example code (Python) for the server tool:
@mcp.tool()
def llama_index_documentation(query: str) -> str:
"""Search the llama-index documentation for the given query."""
index = LlamaCloudIndex(
name="mcp-demo-2",
project_name="Rando project",
organization_id="e793a802-cb91-4e6a-bd49-61d0ba2ac5f9",
api_key=os.getenv("LLAMA_CLOUD_API_KEY"),
)
response = index.as_query_engine().query(query + " Be verbose and include code examples.")
return str(response)
```
This tool demonstrates querying a LlamaCloud index within an MCP server context and returning the results as a text response.To enable a client-based workflow, you can use an MCP client to retrieve the server tools and then instantiate an agent that uses those tools to answer questions. For example, you can obtain tools from the MCP server via a client, convert them into a tool list, and then run an agent with a suitable LLM.
Tool that searches the llama-index documentation for a given query by querying a LlamaCloud index and returning verbose results with code examples.