Skip to main content

WaveSpeed MCP Server

Project description

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

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:

  1. Start the WavespeedMCP server using the wavespeed-mcp command
  2. Launch Claude Desktop, which will use the configured WavespeedMCP tools

Configuration Options

WavespeedMCP can be configured through:

  1. 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)

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
  1. Command-line Arguments:

    • --api-key: Your WaveSpeed API key
    • --api-host: API host URL
    • --config: Path to configuration file
  2. Configuration File (JSON format): See wavespeed_mcp_config_demo.json for an example.

Architecture

WavespeedMCP follows a clean, modular architecture:

  • server.py: Core MCP server implementation with tool definitions
  • client.py: Optimized API client with intelligent polling
  • utils.py: Comprehensive utility functions for resource handling
  • exceptions.py: Specialized exception hierarchy for error handling
  • const.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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wavespeed_mcp-0.1.26.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wavespeed_mcp-0.1.26-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file wavespeed_mcp-0.1.26.tar.gz.

File metadata

  • Download URL: wavespeed_mcp-0.1.26.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for wavespeed_mcp-0.1.26.tar.gz
Algorithm Hash digest
SHA256 9ad0d8066f1cfc0746e5165dd7121167c2300ef558a7b5ca178466a27d9338d2
MD5 37c3968d267086f9d810fc205da9eb3b
BLAKE2b-256 ec553696a68d8adcc585f9c4e4a2b63d8c52e98979e737292a0c6a302c13f424

See more details on using hashes here.

File details

Details for the file wavespeed_mcp-0.1.26-py3-none-any.whl.

File metadata

  • Download URL: wavespeed_mcp-0.1.26-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for wavespeed_mcp-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 f9f771719795f84322eb2dd3d86c803572518c2143d8cd9960ee1ef29acac50e
MD5 08b1a3929b6fc3d4f6e65304c77b7355
BLAKE2b-256 5cf2fc04c61c4b6acd9db0d06aa0e3ee0c3c0ff636685284ff25fa5a00fcb312

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page