
Sproutvideo-MCP-server
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
SproutVideo MCP Server
A Model Context Protocol (MCP) server that wraps the SproutVideo API, enabling AI models to interact with SproutVideo content through standardized tools with advanced database persistence, semantic search, and security features.
Overview
This project implements a Model Context Protocol server that allows AI models to access, search, and manipulate video content on SproutVideo. It follows the MCP specification to expose SproutVideo functionality as tools that can be called by AI systems, with an additional layer for metadata persistence, semantic search, and enhanced security.
Features
- MCP Compliant: Implements the Model Context Protocol for seamless integration with AI systems
- SproutVideo Integration: Provides a bridge to SproutVideo's API with robust rate limiting and retry mechanisms
- Tool-based Architecture: Exposes SproutVideo functionality as callable tools
- Environment-based Configuration: Simple setup using environment variables
- Metadata Persistence: Stores video metadata in PostgreSQL for advanced querying capabilities
- Semantic Search: Uses vector embeddings to enable natural language searching of video content
- Security Layer: Implements API key management, access control, and audit logging
- Caching System: Optimizes performance for frequent operations
Current Tools
Tool Name | Description | Parameters |
---|---|---|
get_a_video |
Retrieves video information from SproutVideo | videoId : The ID of the video to retrieve |
list_videos |
Lists all videos from SproutVideo | page : Page number for pagination (defaults to 1 if not provided)perPage : Number of videos per page, max 100 (defaults to 25 if not provided)orderBy : Field to order by: created_at, updated_at, duration, title (optional)orderDir : Sort direction: asc or desc (optional)folderId : Filter by folder ID (optional)tagId : Filter by tag ID (optional)tagName : Filter by tag name (optional) |
search_videos |
Semantically searches videos using natural language | query : The natural language search querylimit : Maximum number of results to return (optional)filter : Additional metadata filters (optional) |
edit_video_metadata |
Updates video metadata | videoId : The ID of the video to updatetitle : New title (optional)description : New description (optional)tags : New tags array (optional)privacy : Privacy setting (optional) |
generate_video_summary |
Creates a concise summary of video content | videoId : The ID of the video to summarize |
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- PostgreSQL (with pgvector extension)
- Ollama (for local embeddings) or OpenAI API key
- SproutVideo API Key
Installation
-
Clone the repository:
git clone https://github.com/twentynineteen/sproutvideo-mcp-server.git cd sproutvideo-mcp-server
-
Install dependencies:
npm install
-
Set up PostgreSQL database with pgvector:
psql -c "CREATE DATABASE sproutvideo_mcp;" psql -d sproutvideo_mcp -c "CREATE EXTENSION IF NOT EXISTS vector;"
-
Create a
.env
file in the root directory with your configuration:# API Keys SPROUTVIDEO_API_KEY=your_api_key_here # Database Configuration DB_HOST=localhost DB_PORT=5432 DB_NAME=sproutvideo_mcp DB_USER=postgres DB_PASSWORD=your_db_password # Embedding Configuration EMBEDDING_PROVIDER=ollama # or 'openai' EMBEDDING_MODEL=nomic-embed-text OLLAMA_URL=http://localhost:11434 # OPENAI_API_KEY=your_openai_key # Uncomment if using OpenAI # Security and Performance API_RATE_LIMIT=100 CACHE_TTL=3600 LOGGING_LEVEL=info
-
Run database migrations:
npm run migrate
Usage
Build the project
npm run build
Run the server
npm start
The server will initialize and start listening for MCP requests on standard input/output channels.
Sync video metadata
npm run sync
This command synchronizes video metadata from SproutVideo API to your local database.
Project Structure
sproutvideo-mcp-server/
├── src/ # Source code
│ ├── api/ # API Integration Layer
│ │ ├── client.ts # SproutVideo API client
│ │ ├── rateLimiter.ts # Rate limiting implementation
│ │ └── transformers/ # Response transformers
│ ├── database/ # Persistence Layer
│ │ ├── entities/ # Database entity definitions
│ │ ├── migrations/ # Database migrations
│ │ └── connection.ts # Database connection manager
│ ├── embedding/ # Intelligence Layer
│ │ ├── ollama.ts # Ollama client for embeddings
│ │ ├── openai.ts # OpenAI client (alternative)
│ │ └── service.ts # Embedding service
│ ├── mcp/ # MCP Protocol Layer
│ │ ├── handlers/ # Tool handler implementations
│ │ ├── schema.ts # Tool schemas and validation
│ │ └── server.ts # MCP server implementation
│ ├── search/ # Search Functionality
│ │ ├── cache.ts # Search result caching
│ │ └── vectorSearch.ts # Vector similarity search
│ ├── security/ # Security Layer
│ │ ├── access.ts # Access control
│ │ ├── audit.ts # Audit logging
│ │ └── encryption.ts # Data encryption utilities
│ ├── tools/ # Tool Implementations
│ │ ├── videoTools.ts # Video-related tools
│ │ └── searchTools.ts # Search-related tools
│ ├── utils/ # Common utilities
│ ├── config.ts # Configuration management
│ └── index.ts # Entry point
├── tests/ # Test files mirroring src structure
├── build/ # Compiled JavaScript files
├── scripts/ # Utility scripts
│ ├── sync.ts # Database synchronization
│ └── migrations.ts # Migration runner
├── .env # Environment variables (not in git)
├── .env.example # Example environment configuration
├── .eslintrc # ESLint configuration
├── .gitignore # Git ignore file
├── .prettierrc # Prettier configuration
├── jest.config.js # Jest test configuration
├── package.json # Project metadata and dependencies
├── tsconfig.json # TypeScript configuration
├── PLANNING.md # Technical vision and architecture
├── TASKS.md # Development task tracking
└── README.md # This documentation
How It Works
- The server initializes with the MCP protocol handlers and establishes database connections.
- Video metadata is synced from SproutVideo to the local database, with embeddings generated for search.
- The server listens for tool listing requests and returns available tools.
- When a tool is called, parameters are validated and the appropriate handler is invoked.
- For data retrieval operations, the server first checks the local database before making API calls.
- Semantic search leverages vector embeddings to find videos matching natural language queries.
- Results are formatted according to the MCP specification and returned to the caller.
Technical Implementation
The server is built with TypeScript and uses the following key components:
- MCP SDK: For implementing the Model Context Protocol
- Axios: For making HTTP requests to the SproutVideo API
- StdioServerTransport: For communication via stdin/stdout
- PostgreSQL with pgvector: For metadata storage and vector similarity search
- TypeORM: For database entity management
- Ollama/OpenAI: For generating embeddings from text
- Jest: For comprehensive testing
- Environment Variables: For securely storing configuration
Error Handling
The server implements comprehensive error handling:
- Parameter validation with clear error messages
- API error handling with appropriate status codes
- Graceful error formatting following MCP specifications
- Rate limiting with exponential backoff
- Database connection retry mechanisms
- Audit logging for critical errors
Development
Adding New Tools
To add a new tool to the server:
- Add the tool definition to the schema in
src/mcp/schema.ts
- Create a tool handler in
src/mcp/handlers/
- Register the handler in the MCP server
- Add integration tests in the corresponding test file
- Update this README with the new tool details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the ISC License - see the LICENSE file for details.
Acknowledgments
- Model Context Protocol - For the MCP specification
- SproutVideo API - For video hosting services
- pgvector - For vector similarity search in PostgreSQL
- Ollama - For local embedding generation
相关推荐
🔥 1Panel proporciona una interfaz web intuitiva y un servidor MCP para administrar sitios web, archivos, contenedores, bases de datos y LLM en un servidor de Linux.
🧑🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.
Traducción de papel científico en PDF con formatos preservados - 基于 Ai 完整保留排版的 PDF 文档全文双语翻译 , 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 支持 等服务 等服务 等服务 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 提供 cli/mcp/docker/zotero
⛓️Rulego es un marco de motor de regla de orquestación de componentes de alta generación de alto rendimiento, de alto rendimiento y de alto rendimiento para GO.
Cree fácilmente herramientas y agentes de LLM utilizando funciones Plain Bash/JavaScript/Python.
😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 Qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 DiFy 、 Claude 、 Gemini 、 Xai 、 PPIO 、 Ollama 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 Chatglm 、 SillyTraven 、 MCP 等 LLM 的机器人 / Agente | Plataforma de bots de mensajería instantánea basada en LLM, admite Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack
Iniciar aplicaciones de múltiples agentes empoderadas con Building LLM de manera más fácil.
Reviews

user_86C3PEfx
SproutVideo-MCP-Server by Twentynineteen is an exceptional solution for video hosting and management. It's incredibly user-friendly, offering seamless integration and reliable performance. The server provides impressive customization options and efficiently handles large volumes of content. Highly recommended for anyone needing a robust video management platform!

user_FSCXXrEq
SproutVideo-MCP-Server by Twentynineteen is an exceptional product for managing video content seamlessly. It offers reliable performance and great features. Highly recommended for anyone in need of a robust video management solution!

user_9gqZYijp
The sproutvideo-mcp-server by twentynineteen is a fantastic tool for managing and streaming videos efficiently. Its user-friendly interface and robust features make video hosting a breeze. As an avid user, I'm impressed by its seamless integration and reliability. Highly recommended for anyone looking for a professional video server solution!

user_KcutxdJw
Sproutvideo-mcp-server by Twentynineteen is a phenomenal tool for managing video content seamlessly. Its user-friendly interface and robust performance make it a top choice for both beginners and professionals. The welcoming information ensures an easy start, and the detailed documentation provides comprehensive guidance. Highly recommended for anyone looking to streamline their video management process!

user_S4bOfa3G
As a dedicated user of sproutvideo-mcp-server by twentynineteen, I am extremely pleased with its performance and reliability. This server is a powerhouse, providing seamless streaming and robust management capabilities. It's clear that a lot of thought and expertise went into its design. Highly recommend it to anyone in need of a top-tier media server!