Provides environment variable management for storing and accessing API keys securely.
Allows cloning and management of the video RAG project repository.
Enables issue tracking and repository management for the video RAG project.
Enables interactive development and experimentation with video RAG capabilities through notebook support.
Integrates with Python 3.12 or higher for video processing and analysis capabilities.
Video RAG (Retrieval-Augmented Generation)
A powerful video retrieval and analysis system that uses the Ragie API to process, index, and query video content with natural language. This project enables semantic search through video content, extracting relevant video chunks based on text queries.
🎯 MCP-powered video-RAG using Ragie
This project demonstrates how to build a video-based Retrieval Augmented Generation (RAG) system powered by the Model Context Protocol (MCP). It uses Ragie's video ingestion and retrieval capabilities to enable semantic search and Q&A over video content and integrate them as MCP tools via Cursor IDE.
Tech Stack
- Ragie for video ingestion + retrieval (video-RAG)
- Cursor as the MCP host
- Model Context Protocol (MCP) for AI assistant integration
🎯 Features
- Video Processing: Upload and process video files with audio-video analysis
- Semantic Search: Query video content using natural language
- Video Chunking: Extract specific video segments based on search results
- MCP Integration: Model Context Protocol (MCP) server for AI assistant integration
- Jupyter Notebook Support: Interactive development and experimentation
- Automatic Indexing: Clear and rebuild video indexes as needed
🚀 Quick Start
Prerequisites
- Python 3.12 or higher
- Ragie API key
- Video files to process
- Cursor IDE (for MCP integration)
Setup and Installation
1. Install uv
First, let's install uv and set up our Python project and environment:
MacOS/Linux:
Windows:
2. Clone and Setup Project
3. Configure Environment Variables
Create a .env
file in the project root:
4. Add Your Video Files
Place your video files in the video/
directory.
MCP Server Setup with Cursor IDE
1. Configure MCP Server in Cursor
- Go to Cursor settings
- Select MCP Tools
- Add new global MCP server
- In the JSON configuration, add:
Note: Replace /absolute/path/to/project_root
with the actual absolute path to your project directory.
2. Connect MCP Server
- In Cursor MCP settings, make sure to toggle the button to connect the server to the host
- You should now see the MCP server listed in the MCP settings
3. Available MCP Tools
Your custom MCP server provides 3 tools:
ingest_data_tool
: Ingests the video data to the Ragie indexretrieve_data_tool
: Retrieves relevant data from the video based on user queryshow_video_tool
: Creates a short video chunk from the specified segment from the original video
You can now ingest your videos, retrieve relevant data and query it all using the Cursor Agent. The agent can even create the desired chunks from your video just with a single query!
📖 Usage
Basic Usage
Run the main script to process videos and perform queries:
This will:
- Clear the existing index
- Ingest all videos from the
video/
directory - Perform a sample query
Interactive Development
Use the Jupyter notebook for interactive development:
MCP Server
Start the MCP server for AI assistant integration:
🔧 API Reference
Core Functions
clear_index()
Removes all documents from the Ragie index.
ingest_data(directory: str)
Processes and uploads all video files from the specified directory to the Ragie index.
Parameters:
directory
(str): Path to the directory containing video files
retrieve_data(query: str)
Performs semantic search on the indexed video content.
Parameters:
query
(str): Natural language query to search for in video content
Returns:
- List of dictionaries containing:
text
: The retrieved text contentdocument_name
: Name of the source video filestart_time
: Start timestamp of the video segmentend_time
: End timestamp of the video segment
chunk_video(document_name: str, start_time: float, end_time: float, directory: str = "videos")
Extracts a specific video segment and saves it as a new file.
Parameters:
document_name
(str): Name of the source video filestart_time
(float): Start time in secondsend_time
(float): End time in secondsdirectory
(str): Directory containing the source video (default: "videos")
Returns:
- Path to the created video chunk file
MCP Tools
The project includes an MCP server with the following tools:
ingest_data_tool(directory: str)
MCP wrapper for the ingest_data
function.
retrieve_data_tool(query: str)
MCP wrapper for the retrieve_data
function.
show_video_tool(document_name: str, start_time: float, end_time: float)
MCP wrapper for the chunk_video
function.
📝 Examples
Example 1: Basic Video Processing and Query
Example 2: Extract Video Chunks
Example 3: Jupyter Notebook Workflow
🏗️ Project Structure
🔑 Environment Variables
Variable | Description | Required |
---|---|---|
RAGIE_API_KEY | Your Ragie API authentication key | Yes |
📦 Dependencies
- ragie: Video processing and retrieval API
- moviepy: Video editing and manipulation
- python-dotenv: Environment variable management
- mcp: Model Context Protocol implementation
- ipykernel: Jupyter notebook support
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Ragie for providing the video processing API
- MoviePy for video manipulation capabilities
- MCP for AI assistant integration
📞 Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include your Python version, error messages, and steps to reproduce
🔄 Changelog
v0.1.0
- Initial release
- Basic video processing and retrieval functionality
- MCP server integration
- Jupyter notebook support
- Video chunking capabilities
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables natural language search and interaction with video content through three tools: ingesting videos to a Ragie index, retrieving relevant video segments based on queries, and creating video chunks from specific timestamps.
Related MCP Servers
- AsecurityFlicenseAqualityThis server allows AI language models to interact with YouTube content through a standardized interface, providing features such as video and channel information retrieval, transcript management, and playlist operations.Last updated -7191287TypeScript
- -securityFlicense-qualityEnables AI language models to interact with YouTube content through a standardized interface, providing tools for retrieving video information, transcripts, channel analytics, and trend analysis.Last updated -6,57342JavaScript
- AsecurityFlicenseAqualityEnables interaction with YouTube videos by extracting metadata, captions in multiple languages, and converting content to markdown with various templates.Last updated -1161TypeScript
- -securityAlicense-qualityProvides a robust interface for searching TikTok videos by hashtags and retrieving trending content, with anti-detection measures and comprehensive metadata extraction.Last updated -47PythonMIT License