LlamaCloud RAG MCP Server
by uiqkos
README.md
# ๐ฆ LlamaCloud RAG MCP Server
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
[](https://www.typescriptlang.org/)
Professional Model Context Protocol (MCP) server for **Retrieval-Augmented Generation** using **LlamaCloud API**. Built with TypeScript following industry best practices from the [Cursor MCP Integration Guide 2025](https://www.aifreeapi.com/en/posts/cursor-mcp-integration-guide-2025).
> **Transform your Cursor IDE into an AI powerhouse!** Connect any LlamaCloud document index and get intelligent answers with sources directly in your development workflow.
## โจ Features
- ๐ **Professional TypeScript Implementation**: Type-safe, compiled, production-ready
- ๐ฆ **LlamaCloud Integration**: Direct API connection to cloud-hosted document indices
- ๐ ๏ธ **Three Powerful Tools**: Query, search, and inspect your knowledge base
- ๐ **MCP Protocol Compliant**: Full compatibility with Cursor IDE
- โก **Performance Optimized**: Efficient API calls and response handling
- ๐ **Secure**: Environment-based API key management
- ๐ฆ **Easy Installation**: Automated setup script included
## ๐ฏ Quick Start
### Option 1: Automated Installation (Recommended)
```bash
# Clone the repository
git clone https://github.com/uiqkos/llamacloud-rag-mcp.git
cd llamacloud-rag-mcp
# Run the interactive installer
chmod +x install.sh
./install.sh
```
The installer will:
- โ
Check Node.js version
- ๐ฆ Install dependencies
- ๐ง Build the project
- ๐ Setup your API key + Organization ID + Pipeline ID
- ๐ Configure Cursor MCP
- ๐งช Test the connection
### Option 2: Manual Installation
```bash
# 1. Clone and setup
git clone https://github.com/uiqkos/llamacloud-rag-mcp.git
cd llamacloud-rag-mcp
npm install
npm run build
# 2. Get your LlamaCloud API key
# Visit: https://cloud.llamaindex.ai/
# 3. Configure Cursor
# Add to ~/.cursor/mcp.json or .cursor/mcp.json:
{
"mcpServers": {
"llamacloud-rag": {
"command": "node",
"args": ["/absolute/path/to/llamacloud-rag-mcp/dist/index.js"],
"env": {
"LLAMA_CLOUD_API_KEY": "your-api-key-here",
"LLAMA_CLOUD_ORGANIZATION_ID": "your-organization-id",
"LLAMA_CLOUD_PIPELINE_ID": "your-pipeline-id"
}
}
}
}
# 4. Restart Cursor IDE
```
## ๐ง Prerequisites
- **Node.js 18.0+** and npm
- **LlamaCloud API Key** (get it [here](https://cloud.llamaindex.ai/))
- **LlamaCloud Organization ID**
- **LlamaCloud Pipeline ID** (or a full Pipeline URL)
- **Cursor IDE** with MCP support
## ๐ Available Tools
### ๐ `query_rag`
Ask questions about your documents and get comprehensive answers with sources.
**Input:**
- `question` (string, 1-1000 chars): Your question about the documents
**Output:**
- ๐ Detailed answer based on retrieved content
- ๐ List of source documents with relevance scores
- ๐ Preview text from each source
**Example:**
```
Question: "What is database normalization?"
Answer: Based on the found documents, database normalization is...
Sources:
1. Database Design Principles (relevance: 0.95)
2. SQL Fundamentals (relevance: 0.87)
```
### ๐ `search_documents`
Search for relevant documents without generating an answer.
**Input:**
- `query` (string, 1-500 chars): Search query
- `top_k` (number, 1-10, default 5): Number of results
**Output:**
- ๐ List of matching documents
- ๐ Content previews and metadata
- ๐ Relevance scores
### โน๏ธ `get_index_info`
Get detailed information about your LlamaCloud index.
**Input:** None
**Output:**
- ๐ Index name, project, organization details
- โ
Current status and configuration
- ๐ Pipeline URL and last update time
## ๐งช Testing Your Setup
```bash
# Test with npm scripts
npm run test
# Manual testing
npm run test:init # Test initialization
npm run test:tools # Test tool listing
# Test with your API key
LLAMA_CLOUD_API_KEY="your-key" LLAMA_CLOUD_ORGANIZATION_ID="your-org-id" LLAMA_CLOUD_PIPELINE_ID="your-pipeline-id" npm run test
```
## ๐ Project Structure
```
llamacloud-rag-mcp/
โโโ ๐ src/
โ โโโ ๐ index.ts # Main MCP server implementation
โโโ ๐ dist/ # Compiled JavaScript (auto-generated)
โโโ ๐ package.json # Node.js configuration
โโโ ๐ tsconfig.json # TypeScript configuration
โโโ ๐ install.sh # Automated installer
โโโ ๐ cursor-mcp-config.example.json # Configuration example
โโโ ๐ config.example # LlamaCloud config template
โโโ ๐ LICENSE # MIT license
โโโ ๐ README.md # This file
```
## ๐ Security & Best Practices
- โ
**API Key Protection**: Never commit keys to version control
- โ
**Environment Variables**: Secure configuration management
- โ
**Type Safety**: Full TypeScript implementation
- โ
**Error Handling**: Comprehensive error catching and reporting
- โ
**Input Validation**: Secure parameter validation
- โ
**No Data Logging**: Your queries stay private
## ๐จ Customization
### Using Your Own LlamaCloud Index
1. **Create your index** in LlamaCloud
2. **Set the required environment variables** in your Cursor MCP config:
```typescript
LLAMA_CLOUD_API_KEY=...
LLAMA_CLOUD_ORGANIZATION_ID=...
LLAMA_CLOUD_PIPELINE_ID=...
# or set LLAMA_CLOUD_PIPELINE_URL=... instead of PIPELINE_ID
```
3. **Rebuild**: `npm run build`
### Custom Tools
Extend the server by adding new tools in `src/index.ts`. Follow the existing patterns for type safety and error handling.
## ๐ Troubleshooting
### Tools not showing in Cursor?
1. โ
**Check env vars**: Ensure `LLAMA_CLOUD_API_KEY`, `LLAMA_CLOUD_ORGANIZATION_ID`, and `LLAMA_CLOUD_PIPELINE_ID` (or `LLAMA_CLOUD_PIPELINE_URL`) are set correctly
2. ๐ **Restart Cursor**: Fully quit and restart Cursor IDE
3. ๐ **Check paths**: Ensure absolute paths in MCP configuration
4. ๐ **Check logs**: Look at Cursor developer console for errors
5. ๐งช **Test manually**: Run `npm run test` to verify server works
### Common Issues
**"Module not found"**: Run `npm run build` first
**"Missing required environment variables"**: Set `LLAMA_CLOUD_API_KEY`, `LLAMA_CLOUD_ORGANIZATION_ID`, and `LLAMA_CLOUD_PIPELINE_ID` (or `LLAMA_CLOUD_PIPELINE_URL`)
**"Connection failed"**: Check your LlamaCloud API key and internet connection
**"Tools not listed"**: Verify Cursor MCP configuration syntax
### Getting Help
- ๐ Check the [MCP Documentation](https://modelcontextprotocol.io/)
- ๐ฌ Open an [issue](https://github.com/uiqkos/llamacloud-rag-mcp/issues)
- ๐ Review Cursor logs in developer console
## ๐ค Contributing
Contributions are welcome! Please read our contributing guidelines and open an issue or pull request.
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Commit your changes: `git commit -m 'Add amazing feature'`
4. Push to the branch: `git push origin feature/amazing-feature`
5. Open a pull request
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [Model Context Protocol](https://modelcontextprotocol.io/) team
- [LlamaIndex](https://llamaindex.ai/) for the amazing RAG platform
- [Cursor IDE](https://cursor.sh/) for MCP integration
- [Cursor MCP Integration Guide 2025](https://www.aifreeapi.com/en/posts/cursor-mcp-integration-guide-2025) for best practices
---
**Made with โค๏ธ for the developer community**
*Star โญ this repository if it helped you!*
TDQS
A3.9/5.0
Scored across 3 tools
Disambiguation5/5
Each tool has a clearly distinct purpose: get_index_info retrieves index metadata, query_rag answers with sources, and search_documents finds documents without generating an answer. No overlap in functionality.
Naming Consistency5/5
All tool names follow a consistent verb_noun snake_case pattern (get_index_info, query_rag, search_documents). The naming is predictable and intuitive.
Tool Count5/5
With 3 tools, the surface is well-scoped for a RAG server: one for index status, one for querying, and one for searching. Neither too few nor too many.
Completeness4/5
The tools cover the core RAG workflow (index info, query, search). A minor gap is absence of document management or index modification, but that may be out of scope for a read-only RAG server.
Maintenance
ActivityInactive
ResponsivenessNo issues