Sponsored by Deepsite.site

MCP Media Server

Created By
Bzcasper7 months ago
Content

MCP Media Server

A custom MCP (Model Context Protocol) server for media processing, built with Python. This server enables AI assistants like Claude to interact with media files, perform video processing, and integrate with Supabase and Pinecone for data storage and vector search.

Features

Core Features

  • YouTube video downloading using yt-dlp
  • Video processing with FFmpeg
  • Supabase integration for metadata storage
  • Pinecone integration for vector search
  • MCP server for AI assistant integration

Advanced Features

  • Progress tracking for long-running operations
  • Webhook support for notifications
  • Batch processing for multiple files
  • Caching for improved performance
  • Rate limiting for API protection
  • User authentication and API key management
  • Scheduled tasks for maintenance
  • RESTful API gateway
  • Continuous operation with Docker
  • Integration with development IDEs (Roo Code & Windsurf)

Prerequisites

  • Python 3.10 or higher
  • FFmpeg
  • Supabase account
  • Pinecone account
  • OpenAI API key (for embeddings)
  • Docker and Docker Compose (for containerized deployment)

Installation

Option 1: Manual Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/mcp-media-server.git
    cd mcp-media-server
    
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Configure the server by copying and editing the example environment file:

    cp .env.example .env
    
  5. Edit the .env file to add your API keys and configuration.

Option 2: Docker Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/mcp-media-server.git
    cd mcp-media-server
    
  2. Configure the server by copying and editing the example environment file:

    cp .env.example .env
    
  3. Edit the .env file to add your API keys and configuration.

  4. Build and start the Docker container:

    docker-compose up -d
    

Usage

Running the MCP Server

To run the MCP server:

python main.py

The server uses stdio transport by default for direct integration with Claude Desktop or other MCP clients.

Starting with SSE Transport

To run the server with Server-Sent Events (SSE) transport:

python main.py --transport sse

Running the API Server

To run the API server alongside the MCP server:

python main.py --api

Starting Both SSE and API Server

To run both the SSE transport and API server:

python main.py --transport sse --api

Continuous Operation with Docker

For 24/7 operation in production environments:

  1. Deploy using Docker Compose:

    docker-compose up -d
    
  2. Set up automatic restarts and monitoring:

    # Make scripts executable
    chmod +x deploy.sh monitor.sh generate_api_key.sh
    
    # Deploy with health checks
    ./deploy.sh
    
    # Add monitoring to crontab (runs every 5 minutes)
    (crontab -l 2>/dev/null; echo "*/5 * * * * /path/to/mcp-media-server/monitor.sh") | crontab -
    
  3. Set up as a system service (Linux):

    # Copy service file
    sudo cp mcp-media-server.service /etc/systemd/system/
    
    # Edit the service file to update the path
    sudo nano /etc/systemd/system/mcp-media-server.service
    
    # Enable and start the service
    sudo systemctl enable mcp-media-server.service
    sudo systemctl start mcp-media-server.service
    

IDE Integration (Roo Code & Windsurf)

For Windows users:

  1. Run the IDE integration setup script:
    setup_ide_integration.bat
    

For Linux/macOS users:

  1. Generate an API key:

    ./generate_api_key.sh
    
  2. Configure your IDE using the generated key and settings from ide-config.json

Integrating with Claude Desktop

  1. Open Claude Desktop app
  2. Navigate to Settings
  3. Add a new MCP server with the following configuration:
    • Name: MCP Media Server
    • Command: Path to your Python executable
    • Arguments: Path to the main.py file

Example configuration:

{
  "mcpServers": {
    "mcp-media-server": {
      "command": "C:\\path\\to\\venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\mcp-media-server\\main.py"]
    }
  }
}

API Documentation

Once the API server is running, you can access the API documentation at:

http://localhost:9000/docs

Key API Endpoints

  • /videos/download - Download a video from YouTube
  • /videos/process - Process a video using FFmpeg
  • /videos/search - Search for videos on YouTube
  • /videos/vector-search - Semantic search for videos
  • /videos/similar - Find similar videos

Development

Project Structure

mcp-media-server/
├── src/
│   ├── api/              # RESTful API implementation
│   ├── auth/             # Authentication and security
│   ├── core/             # Core MCP server implementation
│   ├── config/           # Configuration settings
│   ├── db/               # Database integrations
│   ├── services/         # Background services
│   ├── tasks/            # Scheduled tasks
│   ├── tools/            # MCP tools implementation
│   ├── utils/            # Utilities and helpers
│   └── webhooks/         # Webhook handlers
├── downloads/            # Downloaded files
├── processed/            # Processed files
├── thumbnails/           # Generated thumbnails
├── cache/                # Cache files
├── logs/                 # Log files
├── .env                  # Environment variables
├── docker-compose.yml    # Docker configuration
├── Dockerfile            # Docker build instructions
├── deploy.sh             # Deployment script
├── monitor.sh            # Health monitoring script
├── generate_api_key.sh   # API key generation script
├── mcp-media-server.service # Systemd service file
├── setup_ide_integration.bat # IDE integration for Windows
├── ide-config.json       # Configuration for IDE integration
├── main.py               # Application entry point
└── requirements.txt      # Python dependencies

Adding New Tools

To add a new tool to the MCP server, create a new function in the appropriate file in the src/tools directory and decorate it with @mcp_server.register_tool.

Example:

from src.core.server import mcp_server

@mcp_server.register_tool
async def my_new_tool(param1: str, param2: int) -> dict:
    """
    Description of the new tool.
    
    Args:
        param1: Description of param1
        param2: Description of param2
        
    Returns:
        Dict containing the result
    """
    # Implement the tool functionality
    result = {"status": "success", "message": "Tool executed successfully"}
    return result

Container Management

View logs:

docker-compose logs -f mcp-server

Check container status:

docker ps | grep mcp-server

Monitor resource usage:

docker stats mcp-server

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
WindsurfThe new purpose-built IDE to harness magic
Playwright McpPlaywright MCP server
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Amap Maps高德地图官方 MCP Server
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.