loading…
Search for a command to run...
loading…
Enables AI assistants to generate videos from text prompts and images by interfacing with a Wan2GP Gradio server. It provides tools for high-quality video gener
Enables AI assistants to generate videos from text prompts and images by interfacing with a Wan2GP Gradio server. It provides tools for high-quality video generation, queue management, and model discovery through the Model Context Protocol.
A Model Context Protocol (MCP) server that provides AI assistants (like Claude Desktop) with access to Wan2GP video generation capabilities.
This MCP server communicates with a running Wan2GP Gradio instance to generate videos from text prompts and images. It's designed to work with Wan2GP installations via StabilityMatrix or standalone setups.
Claude Desktop (MCP Client)
↓ stdio (JSON-RPC 2.0)
Wan2GP MCP Server
↓ HTTP requests
Wan2GP Gradio Server (localhost:7860)
Wan2GP Server: A running Wan2GP Gradio instance
python wgp.py --server-name 0.0.0.0 --server-port 7860Python 3.10+: Required for the MCP server
Claude Desktop (optional): For MCP integration
cd /path/to/your/projects
git clone <this-repo> wan2gp-mcp-server
cd wan2gp-mcp-server
pip install -r requirements.txt
Edit config.json to match your Wan2GP server URL:
{
"wan2gp_url": "http://localhost:7860",
"timeout": 300,
"max_concurrent_tasks": 3,
"default_model": "wan",
"default_resolution": "1280x720",
"output_directory": "./output"
}
Or set via environment variable:
export WAN2GP_URL="http://localhost:7860"
export WAN2GP_TIMEOUT="300"
Test the MCP server directly:
python wan2gp_mcp_server.py
In another terminal, test with an MCP client or inspect the logs.
Add to Claude Desktop Config
Locate Claude Desktop's config file:
%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonMerge the Configuration
Add the wan2gp server to the mcpServers section:
{
"mcpServers": {
"wan2gp": {
"command": "python",
"args": [
"/absolute/path/to/wan2gp-mcp-server/wan2gp_mcp_server.py"
],
"env": {
"WAN2GP_URL": "http://localhost:7860",
"WAN2GP_TIMEOUT": "300",
"LOG_LEVEL": "INFO"
}
}
}
}
Important: Use absolute paths in the args section.
Restart Claude Desktop
Claude will load the MCP server on startup.
Use in Claude
Now you can ask Claude to generate videos:
Generate a 5-second video of a cat walking through a sunny garden
Claude will use the MCP server to submit the generation task.
The server provides the following tools:
generate_text_to_videoGenerate a video from text description.
Parameters:
prompt (required): Text description of the videonegative_prompt: Things to avoid in the videoresolution: Video resolution (e.g., "1280x720", "1920x1080")video_length: Number of frames (49 ≈ 2 seconds at 24fps)num_inference_steps: Number of denoising steps (20-50 recommended)guidance_scale: How strongly to follow the prompt (1-20)seed: Random seed (-1 for random)model_type: Model to use (wan, hunyuan, ltx, etc.)output_filename: Custom output filenameExample:
generate_text_to_video(
prompt="A cat walking through a sunny garden, slow motion",
resolution="1280x720",
num_inference_steps=25,
guidance_scale=7.5
)
generate_image_to_videoAnimate a static image based on a text prompt.
Parameters:
image_path (required): Path to the input imageprompt (required): How the image should animate/movenegative_prompt: Things to avoid in the videomotion_scale: How much motion to generate (0.5-2.0)video_length: Number of framesnum_inference_steps: Number of denoising stepsguidance_scale: How strongly to follow the promptseed: Random seed (-1 for random)model_type: Model to useExample:
generate_image_to_video(
image_path="/path/to/image.jpg",
prompt="Camera slowly zooms in, clouds drift across the sky",
motion_scale=1.2
)
health_checkCheck if Wan2GP server is running and accessible.
Returns:
{
"status": "healthy",
"url": "http://localhost:7860",
"version": "10.951"
}
list_modelsList all available video generation models.
Returns:
[
{
"name": "Wan2.1 T2V",
"id": "t2v_2_2",
"type": "text_to_video",
"resolution": "480p-8K",
"vram_requirement": "16GB+"
}
]
list_lorasList available LoRA adapters.
get_queueGet the current generation queue.
cancel_taskCancel a queued generation task.
The server provides the following resources:
wan2gp://models - List available models (JSON)wan2gp://loras - List available LoRAs (JSON)wan2gp://queue - Current generation queue (JSON)wan2gp://health - Server health status (JSON)config.json matches your serverThis is a Wan2GP environment issue, not related to the MCP server. Ensure Wan2GP's dependencies are correctly installed:
# In Wan2GP environment
pip install flash-attn==2.7.4
Help > Developer > Show Logspython wan2gp_mcp_server.py# Test client
python tests/test_client.py
# Test with MCP inspector
npx @modelcontextprotocol/inspector python wan2gp_mcp_server.py
Edit wan2gp_mcp_server.py and add a new tool using the @mcp.tool decorator:
@mcp.tool
async def my_new_tool(param: str) -> str:
"""Tool description."""
client = await get_client()
# ... implementation
return "result"
| Key | Type | Default | Description |
|---|---|---|---|
wan2gp_url |
string | http://localhost:7860 |
Wan2GP Gradio server URL |
timeout |
number | 300 |
Request timeout in seconds |
max_concurrent_tasks |
number | 3 |
Maximum concurrent generations |
default_model |
string | wan |
Default model to use |
default_resolution |
string | 1280x720 |
Default video resolution |
output_directory |
string | ./output |
Where to save generated videos |
| Variable | Description | Default |
|---|---|---|
WAN2GP_URL |
Override Wan2GP server URL | http://localhost:7860 |
WAN2GP_TIMEOUT |
Override request timeout | 300 |
LOG_LEVEL |
Logging level | INFO |
This MCP server is provided as-is for use with Wan2GP.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"wan2gp-mcp-server": {
"command": "npx",
"args": []
}
}
}