FFmpeg MCP Server
Enables secure video and audio processing using FFmpeg commands in an isolated sandbox environment. Supports file management, Google Cloud Storage integration, and URL-based file transfers for AI-powered multimedia operations.
README
FFmpeg MCP Server
A Model Context Protocol (MCP) server that provides secure FFmpeg functionality through a sandboxed environment. This server allows AI assistants and other MCP clients to perform video/audio processing tasks using FFmpeg in an isolated environment.
Features
- Sandboxed Execution: All FFmpeg commands run in isolated temporary directories for security
- File Management: Upload, download, and manage files within the sandbox
- Google Cloud Storage Integration: Direct integration with GCS for file transfers
- Security: Only FFmpeg commands are allowed, preventing arbitrary code execution
- RESTful API: Runs as an HTTP server using FastMCP
Installation
Prerequisites
- Python 3.11 or higher
- FFmpeg installed on your system
- (Optional) Google Cloud credentials for GCS features
Setup
- Clone the repository:
git clone <repository-url>
cd ffmpeg_mcp
- Install dependencies using uv (recommended):
uv sync
Or using pip:
pip install -e .
- (Optional) Set up Google Cloud credentials for GCS integration:
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your/credentials.json"
Usage
Starting the Server
python main.py
The server will start on localhost:8000 by default.
Available Tools
1. create_sandbox()
Creates a new isolated sandbox environment for FFmpeg operations.
Returns: Sandbox directory path
2. run_ffmpeg_command(sandbox, command)
Executes FFmpeg commands within the specified sandbox.
Parameters:
sandbox(str): Sandbox directory pathcommand(str): FFmpeg command to execute
Returns: Command output or error message
3. put_file(sandbox, filename, content)
Puts a file into the sandbox environment.
Parameters:
sandbox(str): Sandbox directory pathfilename(str): Name of the file to createcontent(bytes): File content
Returns: Full path of the created file
4. get_file(sandbox, filename)
Retrieves a file from the sandbox environment.
Parameters:
sandbox(str): Sandbox directory pathfilename(str): Name of the file to retrieve
Returns: File content as bytes
5. delete_file(sandbox, filename)
Deletes a file from the sandbox environment.
Parameters:
sandbox(str): Sandbox directory pathfilename(str): Name of the file to delete
Returns: Confirmation message
6. download_file(sandbox, url, filename)
Downloads a file from a URL into the sandbox.
Parameters:
sandbox(str): Sandbox directory pathurl(str): URL of the file to downloadfilename(str): Local filename to save as
Returns: Full path of the downloaded file
7. upload_file(sandbox, filename, upload_url)
Uploads a file from the sandbox to a specified URL.
Parameters:
sandbox(str): Sandbox directory pathfilename(str): Name of the file to uploadupload_url(str): Destination URL
Returns: Upload response
8. download_file_from_gcs(sandbox, gcs_url, filename)
Downloads a file from Google Cloud Storage.
Parameters:
sandbox(str): Sandbox directory pathgcs_url(str): GCS URL (gs://bucket/path)filename(str): Local filename to save as
Returns: Full path of the downloaded file
9. upload_file_to_gcs(sandbox, filename, gcs_url)
Uploads a file to Google Cloud Storage.
Parameters:
sandbox(str): Sandbox directory pathfilename(str): Name of the file to uploadgcs_url(str): Destination GCS URL
Returns: Confirmation message
Example Workflow
# 1. Create a sandbox
sandbox = create_sandbox()
# 2. Download a video file
download_file(sandbox, "https://example.com/video.mp4", "input.mp4")
# 3. Process with FFmpeg
run_ffmpeg_command(sandbox, "ffmpeg -i input.mp4 -vf scale=720:480 output.mp4")
# 4. Retrieve the processed file
processed_video = get_file(sandbox, "output.mp4")
Security Features
- Command Restriction: Only commands starting with "ffmpeg" are allowed
- Sandbox Isolation: All operations are contained within temporary directories
- Path Validation: Sandbox directories are validated before operations
- Error Handling: Comprehensive error handling for failed operations
Configuration
The server runs on localhost:8000 by default. You can modify the host and port in the main.py file:
if __name__ == "__main__":
mcp.run(transport="httpx", host="your-host", port=your-port)
Dependencies
httpx: HTTP client for file downloads and uploadsmcp[cli]: Model Context Protocol server frameworkgoogle-cloud-storage: Google Cloud Storage integration (optional)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。