The Video RAG MCP Server enables video-based retrieval-augmented generation through semantic search and video processing capabilities:
Ingest video data: Load and process video files from a specified directory into the Ragie index, including audio-video analysis for indexing
Perform semantic search: Query indexed video content using natural language to retrieve relevant text excerpts with timestamps and source file information
Extract video chunks: Create and save specific video segments from original videos based on document name, start time, and end time
AI assistant integration: Provide these capabilities as MCP tools (
ingest_data_tool
,retrieve_data_tool
,show_video_tool
) for use in Cursor IDE and other MCP-compatible environments
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/
directoryPerform 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 |
| 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
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
- -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 -36347
- -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 -55MIT License
- -securityAlicense-qualityA video analysis system that uses AI vision models to process, analyze, and query video content through natural language, enabling users to search videos by time, location, and content.Last updated -2MIT License
- -securityFlicense-qualityEnables users to upload, search, edit, and generate videos through Video Jungle, supporting custom URI schemes and integration with video editing tools like DaVinci Resolve.Last updated -