Kaltura媒体
HTTP-SSE通过MCP为AI模型提供Kaltura媒体管理能力
通过MCP为AI模型提供Kaltura媒体管理能力
A Model Context Protocol (MCP) server that provides secure, read-only tools for managing Kaltura API operations. This server enables AI assistants to search, discover, and analyze Kaltura media content safely.
git clone https://github.com/zoharbabin/kaltura-mcp.git cd kaltura-mcp
pip install -e .
This server supports two deployment modes:
Best for: Personal use, direct Claude Desktop integration, development
Best for: Hosted services, multiple users, production deployments
pip install kaltura-mcp
🔒 Secure Method (Recommended): Use the interactive setup script:
# Navigate to your project directory cd /path/to/kaltura-mcp # Run the interactive setup python setup_env.py
The script will guide you through:
.env file with proper permissions (600)📋 Manual Method: Copy and edit the example file:
# Copy the example file cp .env.example .env # Edit with your credentials # - For stdio mode: Only fill in KALTURA_* variables # - For remote mode: Fill in JWT_SECRET_KEY, OAUTH_*, and SERVER_* variables nano .env # Set secure permissions chmod 600 .env
You'll need these credentials from your Kaltura account:
https://cdnapisec.kaltura.com)admin)Open your Claude Desktop configuration file:
macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
🔒 Secure Configuration (credentials in .env file):
{ "mcpServers": { "kaltura": { "command": "/full/path/to/kaltura-mcp" } } }
Important Notes:
/full/path/to/kaltura-mcp with the actual path to your kaltura-mcp command (find it with which kaltura-mcp).env file is automatically loaded from the project directory by the serversetup_env.py script will automatically detect and provide the correct command pathAfter saving the configuration file, restart Claude Desktop completely for the changes to take effect.
In Claude Desktop, try asking:
Issue: kaltura-mcp command not found
pip install kaltura-mcp and the command is in your PATHIssue: "Error: Missing required environment variables"
.env file exists in your project directoryls -la .env (should show -rw-------).env fileIssue: "Invalid credentials" or "Authentication failed"
.env file for typos or extra spacespython setup_env.py to recreate the configurationIssue: Claude Desktop doesn't show the MCP server
which kaltura-mcp)Issue: ".env file not found" error
python setup_env.py from your project directory.env file exists in the same directory as the server codels -la .env (should show -rw-------)✅ Security Benefits:
For remote/hosted deployment, additional environment variables are required:
cp .env.example .env # Configure remote server settings
Required environment variables:
JWT_SECRET_KEY: Strong secret key for JWT token signing (⚠️ CRITICAL FOR SECURITY)OAUTH_REDIRECT_URI: OAuth callback URL (e.g., https://your-domain.com/oauth/callback)SERVER_HOST: Server bind address (default: 0.0.0.0)SERVER_PORT: Server port (default: 8000)Optional environment variables:
SERVER_RELOAD: Enable auto-reload in development (default: false)OAUTH_CLIENT_ID: Custom OAuth client IDOAUTH_CLIENT_SECRET: Custom OAuth client secret# Using the installed command kaltura-mcp-remote # Or using Python module python -m kaltura_mcp.remote_server
The remote server provides:
get_media_entry - Get detailed information about a specific media entry
list_categories - List and search content categories
Analytics Tools - Comprehensive analytics suite with purpose-driven functions:
get_download_url - Get direct download URL for media files
get_thumbnail_url - Get video thumbnail/preview image URL with custom dimensions
search_entries - Search and discover media entries with intelligent sorting and filtering
list_caption_assets - List available captions and subtitles for a media entry
get_caption_content - Get caption/subtitle content and download URL
list_attachment_assets - List attachment assets for a media entry
get_attachment_content - Get attachment content details and download content as base64
The server provides intelligent prompts to guide users through complex workflows:
analytics_wizard - Interactive guide for creating comprehensive analytics reports
Arguments:
- analysis_goal: What to analyze (e.g., "video performance", "viewer engagement", "geographic reach")
- time_period: Time range (e.g., "today", "yesterday", "last_week", "last_month")
content_discovery - Natural language search assistant for finding media
Arguments:
- search_intent: What you're looking for in natural language
- include_details: Whether to fetch captions/attachments (yes/no)
accessibility_audit - Content accessibility compliance checker
Arguments:
- audit_scope: What to audit ("all", "recent", "category:name", or entry_id)
retention_analysis - Create comprehensive retention analysis report
Arguments:
- entry_id: Video to analyze (e.g., "1_3atosphg") [required]
- time_period: Months of data to analyze (default: "12")
- output_format: "interactive" (HTML) or "markdown" (default: "interactive")
The server exposes frequently-used data as cached resources:
kaltura://analytics/capabilities - Complete analytics documentation
kaltura://categories/tree - Category hierarchy with entry counts
kaltura://media/recent/{count} - Recent media entries
https://your-server.com/oauth/authorize# Generate a strong secret key python -c "import secrets; print(secrets.token_urlsafe(32))"
# Set in your .env file or environment JWT_SECRET_KEY=your-generated-secret-key-here OAUTH_REDIRECT_URI=https://your-domain.com/oauth/callback SERVER_HOST=0.0.0.0 SERVER_PORT=8000
Option A: Direct Python
kaltura-mcp-remote
Option B: Docker
docker-compose up -d
Option C: Production with Gunicorn (Optional)
# Install gunicorn separately if needed for production pip install gunicorn gunicorn -w 4 -k uvicorn.workers.UvicornWorker kaltura_mcp.remote_server:app
Send users to: https://your-server.com/oauth/authorize?response_type=code&client_id=kaltura-mcp&redirect_uri=https://your-server.com/oauth/callback&state=user123
For Claude Desktop (Remote Mode):
The easiest way to use the remote server with Claude Desktop is via the proxy client:
{ "mcpServers": { "kaltura-remote": { "command": "kaltura-mcp-proxy", "env": { "KALTURA_REMOTE_SERVER_URL": "https://your-server.com/mcp/messages", "KALTURA_REMOTE_ACCESS_TOKEN": "your-jwt-token-from-authorization-flow" } } } }
The proxy client (kaltura-mcp-proxy) acts as a local stdio MCP server that forwards requests to your remote server. This provides the best compatibility with Claude Desktop.
For Custom MCP Clients:
// HTTP transport with authentication const transport = new HTTPTransport({ baseUrl: "https://your-server.com/mcp/messages", headers: { "Authorization": "Bearer user-jwt-token-here" } });
The MCP server provides a comprehensive analytics suite with purpose-driven functions optimized for different use cases:
Purpose-Built Analytics Functions:
Analytics Capabilities:
For comprehensive documentation, see:
# Example nginx configuration for production server { listen 443 ssl; server_name your-kaltura-mcp.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
docker-compose.yml for production:
version: '3.8' services: kaltura-mcp: build: . ports: - "8000:8000" environment: - JWT_SECRET_KEY=${JWT_SECRET_KEY} - OAUTH_REDIRECT_URI=https://your-domain.com/oauth/callback - SERVER_HOST=0.0.0.0 - SERVER_PORT=8000 restart: unless-stopped volumes: - ./logs:/app/logs labels: - "traefik.enable=true" - "traefik.http.routers.kaltura-mcp.rule=Host(\`your-domain.com\`)" - "traefik.http.routers.kaltura-mcp.tls=true"
The remote server provides built-in logging and can be monitored via:
GET / returns server statusClaude Desktop ←→ Local MCP Server ←→ Kaltura API
Claude Desktop ←→ Proxy Client ←→ Remote MCP Server ←→ Kaltura API
Multiple Clients ←→ Load Balancer ←→ Multiple MCP Servers ←→ Kaltura API
↓
Redis/Database
pytest
black src/ ruff check src/
MIT