Wavespeed
STDIOOfficialMCP server for WaveSpeed AI image and video generation services
MCP server for WaveSpeed AI image and video generation services
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.
Install directly from PyPI:
pip install wavespeed-mcp
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" } } } }
Start the WavespeedMCP server:
wavespeed-mcp --api-key your_api_key_here
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:
wavespeed-mcp commandWavespeedMCP 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, or base64 (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)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)
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:
%(asctime)s - wavespeed-mcp - %(levelname)s - %(message)sCommand-line Arguments:
--api-key: Your WaveSpeed API key--api-host: API host URL--config: Path to configuration fileConfiguration File (JSON format):
See wavespeed_mcp_config_demo.json for an example.
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 valuespip install -e ".[dev]"Run the test suite:
pytest
Or with coverage reporting:
pytest --cov=wavespeed_mcp
This project is licensed under the MIT License - see the LICENSE file for details.
For support or feature requests, please contact the WaveSpeed AI team at [email protected].