WavespeedMCP
An MCP server that provides a standardized interface for accessing WaveSpeed AI's image and video generation capabilities, including text-to-image, image-to-image, inpainting, and dynamic video generation.
README
WavespeedMCP
English | 中文文档
WavespeedMCP is a Model Control Protocol (MCP) server implementation for WaveSpeed AI services. It provides a standardized interface for accessing WaveSpeed's image and video generation capabilities through the MCP protocol.
Features
- Advanced Image Generation: Create high-quality images from text prompts with support for image-to-image generation, inpainting, and LoRA models
- Dynamic Video Generation: Transform static images into videos with customizable motion parameters
- Optimized Performance: Enhanced API polling with intelligent retry logic and detailed progress tracking
- Flexible Resource Handling: Support for URL, Base64, and local file output modes
- Comprehensive Error Handling: Specialized exception hierarchy for precise error identification and recovery
- Robust Logging: Detailed logging system for monitoring and debugging
- Multiple Configuration Options: Support for environment variables, command-line arguments, and configuration files
Installation
Prerequisites
- Python 3.11+
- WaveSpeed API key (obtain from WaveSpeed AI)
Setup
Install directly from PyPI:
pip install wavespeed-mcp
MCP Configuration
To use WavespeedMCP with your IDE or application, add the following configuration:
{
"mcpServers": {
"WaveSpeed": {
"command": "wavespeed-mcp",
"env": {
"WAVESPEED_API_KEY": "your-api-key-here",
"WAVESPEED_LOG_FILE": "/tmp/wavespeed-mcp.log"
}
}
}
}
Usage
Running the Server
Start the WavespeedMCP server:
wavespeed-mcp --api-key your_api_key_here
Claude Desktop Integration
WavespeedMCP can be integrated with Claude Desktop. To generate the necessary configuration file:
python -m wavespeed_mcp --api-key your_api_key_here --config-path /path/to/claude/config
This command generates a claude_desktop_config.json file that configures Claude Desktop to use WavespeedMCP tools. After generating the configuration:
- Start the WavespeedMCP server using the
wavespeed-mcpcommand - Launch Claude Desktop, which will use the configured WavespeedMCP tools
Configuration Options
WavespeedMCP can be configured through:
-
Environment Variables:
WAVESPEED_API_KEY: Your WaveSpeed API key (required)WAVESPEED_API_HOST: API host URL (default: https://api.wavespeed.ai)WAVESPEED_MCP_BASE_PATH: Base path for saving generated files (default: ~/Desktop)WAVESPEED_API_RESOURCE_MODE: Resource output mode -url,local, orbase64(default: url)WAVESPEED_LOG_LEVEL: Logging level - DEBUG, INFO, WARNING, ERROR (default: INFO)WAVESPEED_LOG_FILE: Optional log file path (if not set, logs to console)WAVESPEED_API_TEXT_TO_IMAGE_ENDPOINT: Custom endpoint for text-to-image generation (default: /wavespeed-ai/flux-dev)WAVESPEED_API_IMAGE_TO_IMAGE_ENDPOINT: Custom endpoint for image-to-image generation (default: /wavespeed-ai/flux-kontext-pro)WAVESPEED_API_VIDEO_ENDPOINT: Custom endpoint for video generation (default: /wavespeed-ai/wan-2.1/i2v-480p-lora)
Timeouts
WavespeedMCP supports two types of timeouts. Configure them via environment variables:
-
WAVESPEED_REQUEST_TIMEOUT: Per-HTTP request timeout in seconds (default: 300 = 5 minutes). This applies to individual HTTP calls made by the client, such as submitting a job or downloading outputs. -
WAVESPEED_WAIT_RESULT_TIMEOUT: Total timeout for waiting/polling results in seconds (default: 600 = 10 minutes). This limits the overall time spent polling for an asynchronous job result. When exceeded, polling stops with a timeout error.
Example:
export WAVESPEED_REQUEST_TIMEOUT=300 # per HTTP request
export WAVESPEED_WAIT_RESULT_TIMEOUT=900 # total wait for result (polling)
Logging Configuration
By default, the MCP server logs to console. You can configure file logging by setting the WAVESPEED_LOG_FILE environment variable:
# Log to /tmp directory
export WAVESPEED_LOG_FILE=/tmp/wavespeed-mcp.log
# Log to system log directory
export WAVESPEED_LOG_FILE=/var/log/wavespeed-mcp.log
# Log to user home directory
export WAVESPEED_LOG_FILE=~/logs/wavespeed-mcp.log
The log file uses rotating file handler with:
- Maximum file size: 10MB
- Backup count: 5 files
- Log format:
%(asctime)s - wavespeed-mcp - %(levelname)s - %(message)s
-
Command-line Arguments:
--api-key: Your WaveSpeed API key--api-host: API host URL--config: Path to configuration file
-
Configuration File (JSON format): See
wavespeed_mcp_config_demo.jsonfor an example.
Architecture
WavespeedMCP follows a clean, modular architecture:
server.py: Core MCP server implementation with tool definitionsclient.py: Optimized API client with intelligent pollingutils.py: Comprehensive utility functions for resource handlingexceptions.py: Specialized exception hierarchy for error handlingconst.py: Constants and default configuration values
Development
Requirements
- Python 3.11+
- Development dependencies:
pip install -e ".[dev]"
Testing
Run the test suite:
pytest
Or with coverage reporting:
pytest --cov=wavespeed_mcp
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support or feature requests, please contact the WaveSpeed AI team at support@wavespeed.ai.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。