Allows retrieving and indexing documents from Google Drive to provide up-to-date private information for RAG queries.
Powers the RAG query functionality, enabling the retrieval of relevant information from indexed documents.
LlamaIndex MCP demos
llamacloud-mcp
is a tool that allows you to use LlamaCloud as an MCP server. It can be used to query LlamaCloud indexes and extract data from files.
It allows for:
- specifying one or more indexes to use for context retrieval.
- specifying one or more extract agents to use for data extraction
- configuring project and organization ids
- configuring the transport to use for the MCP server (stdio, sse, streamable-http)
Getting Started
- Install uv
- Run
uvx llamacloud-mcp@latest --help
to see the available options. - Configure your MCP client to use the
llamacloud-mcp
server. You can either launch the server directly withuvx llamacloud-mcp@latest
or use aclaude_desktop_config.json
file to connect with claude desktop.
Usage
Configure Claude Desktop
- Install Claude Desktop
- In the menu bar choose
Claude
->Settings
->Developer
->Edit Config
. This will show up a config file that you can edit in your preferred text editor. - Create a add the following "mcpServers" to the config file, where each
--index
is a new index tool that you define, and each--extract-agent
is an extraction agent tool. - You'll want your config to look something like this (make sure to replace
$YOURPATH
with the path to the repository):
Make sure to restart Claude Desktop after configuring the file.
Now you're ready to query! You should see a tool icon with your server listed underneath the query box in Claude Desktop, like this:
LlamaCloud as an MCP server From Scratch
To provide a local MCP server that can be used by a client like Claude Desktop, you can use mcp-server.py
. You can use this to provide a tool that will use RAG to provide Claude with up-to-the-second private information that it can use to answer questions. You can provide as many of these tools as you want.
Set up your LlamaCloud index
- Get a LlamaCloud account
- Create a new index with any data source you want. In our case we used Google Drive and provided a subset of the LlamaIndex documentation as a source. You could also upload documents directly to the index if you just want to test it out.
- Get an API key from the LlamaCloud UI
Set up your MCP server
- Clone this repository
- Create a
.env
file and add two environment variables:LLAMA_CLOUD_API_KEY
- The API key you got in the previous stepOPENAI_API_KEY
- An OpenAI API key. This is used to power the RAG query. You can use any other LLM if you don't want to use OpenAI.
Now let's look at the code. First you instantiate an MCP server:
Then you define your tool using the @mcp.tool()
decorator:
Here our tool is called llama_index_documentation
; it instantiates a LlamaCloud index called mcp-demo-2
and then uses it as a query engine to answer the query, including some extra instructions in the prompt. You'll get instructions on how to set up your LlamaCloud index in the next section.
Finally, you run the server:
Note the stdio
transport, used for communicating to Claude Desktop.
LlamaIndex as an MCP client
LlamaIndex also has an MCP client integration, meaning you can turn any MCP server into a set of tools that can be used by an agent. You can see this in mcp-client.py
, where we use the BasicMCPClient
to connect to our local MCP server.
For simplicity of demo, we are using the same MCP server we just set up above. Ordinarily, you would not use MCP to connect LlamaCloud to a LlamaIndex agent, you would use QueryEngineTool and pass it directly to the agent.
Set up your MCP server
To provide a local MCP server that can be used by an HTTP client, we need to slightly modify mcp-server.py
to use the run_sse_async
method instead of run
. You can find this in mcp-http-server.py
.
Get your tools from the MCP server
Create an agent and ask a question
You're all set! You can now use the agent to answer questions from your LlamaCloud index.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A local MCP server that integrates with Claude Desktop, enabling RAG capabilities to provide Claude with up-to-date private information from custom LlamaCloud indices.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that allows accessing and managing ledger files through Claude by providing account listing, balance checking, and transaction register viewing capabilities.Last updated -3GPL 3.0
- -securityFlicense-qualityAn MCP server for Claude Desktop that allows users to query data from selected Google Cloud datasets by configuring project ID and datasets in the Claude Desktop configuration.Last updated -
- AsecurityAlicenseAqualityAn MCP server that enables saving and sharing Claude Desktop conversations, allowing users to store chats privately or make them public through a web interface.Last updated -11MIT License
- -securityFlicense-qualityAn MCP server that allows Claude to interact with local LLMs running in LM Studio, providing access to list models, generate text, and use chat completions through local models.Last updated -10