WaveSpeed MCP Server
Project description
WavespeedMCP
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
- Image Generation: Create high-quality images from text prompts or modify existing images
- Video Generation: Transform static images into dynamic videos with customizable parameters
- Modular Architecture: Clean, maintainable code structure with clear separation of concerns
- Robust Error Handling: Comprehensive exception handling and logging
- Flexible Configuration: Support for environment variables and configuration files
Installation
Prerequisites
- Python 3.8+
- WaveSpeed API key (obtain from WaveSpeed AI)
Setup
-
Clone the repository:
git clone https://github.com/your-organization/wavespeed-mcp.git cd wavespeed-mcp
-
Install the package:
pip install -e .
-
Create a
.envfile with your API credentials (see.env.examplefor reference):WAVESPEED_API_KEY=your_api_key_here WAVESPEED_API_HOST=https://api.wavespeed.ai
Usage
Running the Server
Start the WavespeedMCP server:
python -m wavespeed_mcp --api-key your_api_key_here
Or, if installed via pip:
wavespeed-mcp --api-key your_api_key_here
Client Application
Use the included client application to interact with the server:
python -m wavespeed_mcp.client_app --tool generate_image --params '{"prompt": "A beautiful sunset over mountains"}'
Or, if installed via pip:
wavespeed-mcp-client --tool generate_image --params '{"prompt": "A beautiful sunset over mountains"}'
API Reference
Image Generation
Generate images from text descriptions or modify existing images:
from mcp import ClientSession
from mcp.client.stdio import stdio_client
from mcp import StdioServerParameters
async def generate_image():
server_params = StdioServerParameters(
command="python",
args=["-m", "wavespeed_mcp", "--api-key", "your_api_key_here"]
)
async with stdio_client(server_params) as (read_stream, write_stream):
async with ClientSession(read_stream, write_stream) as client:
await client.initialize()
params = {
"prompt": "A beautiful mountain landscape",
"size": "1024*1024",
"num_images": 1
}
result = await client.call_tool("generate_image", params)
# Process result
for item in result:
if item.type == "image":
print(f"Generated image URL: {item.url}")
Video Generation
Generate videos from static images:
async def generate_video():
# ... setup client as above ...
params = {
"image_url": "https://example.com/image.jpg",
"prompt": "A scenic landscape with gentle movement",
"duration": 5
}
result = await client.call_tool("generate_video", params)
# Process result
for item in result:
if item.type == "text":
print(item.text) # Contains URL to generated video
Configuration
WavespeedMCP can be configured through:
- Environment variables (see
.env.example) - Command-line arguments
- Configuration file (see
wavespeed_mcp_config_demo.json)
Architecture
WavespeedMCP follows a clean, modular architecture:
server.py: Core MCP server implementation with tool definitionsclient.py: API client for communicating with WaveSpeed servicesutils.py: Helper functions for file handling and other utilitiesexceptions.py: Custom exception classes for error handlingconst.py: Constants and default values
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wavespeed_mcp-0.1.0.tar.gz.
File metadata
- Download URL: wavespeed_mcp-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b44ff581e3f2da91971f6a25c1024428718d2001e2893d3781ec83bd1789cba0
|
|
| MD5 |
36c5853842c8c3bda14c59fe3bf5c4b5
|
|
| BLAKE2b-256 |
61d4c86ba38e8d932d780c5694917e58c32a67fd981f74c14440a4510cbadb28
|
File details
Details for the file wavespeed_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wavespeed_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7bf957c25711c673d6ccd078d0bcaa66350b84ffef93830efe4bc87f4b87dd2
|
|
| MD5 |
6611a5f109a77b7aebf78a8d477ef27a
|
|
| BLAKE2b-256 |
a1236e7933edc02d83cd58893e7925c55128ee1bc60cfd2cd98f2e8dd7ace49d
|