Skip to main content
Glama

🎨 pruna-mcp-server

CI PyPI Python License: MIT

Pruna AI 的 MCP 服务器 — 直接从您的 AI 助手进行超快速的图像生成、编辑、放大和视频生成。

Pruna AI 是一款专注于图像和视频生成的推理 API。它提供 2 秒以内的图像生成,起价为 $0.005/张,并提供用于文本生成图像、图像编辑、放大和视频生成的模型。此 MCP 服务器封装了他们的 API,以便任何兼容 MCP 的客户端(Claude Desktop、Kiro、Cursor)都能原生生成视觉内容。

符合 MCP 规范 2025-11-25。

功能特性

  • 6 个 MCP 工具:generate_image、edit_image、upscale_image、generate_video、list_models、upload_file

  • 7 个 MCP 提示词:产品照片、虚拟布景、社交媒体视觉素材、游戏概念艺术、广告创意、视频广告、图像增强

  • 2 个 MCP 资源:pruna://models 目录,无需调用工具即可发现模型

  • 18 个模型:10 个文本生成图像模型、3 个编辑模型、1 个放大模型、4 个视频模型

  • 智能同步/异步:快速图像模型使用同步,视频模型使用带轮询的异步

  • 透明文件处理:传递本地路径或 URL — 自动处理上传

  • 原生 MCP 图像返回:为支持内联显示的客户端提供 ImageContent 块

  • 完全符合 MCP 标准:工具注解、结构化内容、进度通知

Related MCP server: jgkme/kilo-image-gen-mcp

快速入门

# With uvx (zero install)
uvx pruna-mcp-server

# Or with pip
pip install pruna-mcp-server
pruna-mcp

设置您的 API 密钥 — 在 pruna.ai 获取(前往 开发者门户 或 联系 Pruna 申请访问权限):

# macOS Keychain (recommended)
security add-generic-password -a $USER -s PRUNA_API_KEY -w "your-api-key"

# Or environment variable
export PRUNA_API_KEY="your-api-key"

MCP 客户端配置

Kiro CLI

添加到您的代理配置中(例如 ~/.kiro/agents/default.json):

在 mcpServers 中:

"pruna": {
  "command": "sh",
  "args": ["-c", "PRUNA_API_KEY=$(security find-generic-password -a $USER -s PRUNA_API_KEY -w) uv run --directory /path/to/pruna-mcp-server pruna-mcp"],
  "autoApprove": ["generate_image", "edit_image", "upscale_image", "generate_video", "list_models", "upload_file"]
}

在 tools 中,添加:"@pruna/*"

在 allowedTools 中,添加:"generate_image", "edit_image", "upscale_image", "generate_video", "list_models", "upload_file"

注意:Kiro 代理使用带有 @server-name/* 语法的 tools 白名单和 allowedTools 列表。两者都必须包含 Pruna 工具才能使用。

Claude Desktop

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "pruna": {
      "command": "sh",
      "args": ["-c", "PRUNA_API_KEY=$(security find-generic-password -a $USER -s PRUNA_API_KEY -w) /path/to/uv run --directory /path/to/pruna-mcp-server pruna-mcp"]
    }
  }
}

重要:请使用 uv 的完整路径(例如 /Users/you/.local/bin/uv) — Claude Desktop 启动进程时使用的 PATH 非常精简,不包含 ~/.local/bin。

注意:Claude Desktop 不会在聊天中内联渲染 ImageContent。图像生成后会保存在本地 — Claude 将在其回复中引用文件路径。

Cursor

添加到 .cursor/mcp.json:

{
  "mcpServers": {
    "pruna": {
      "command": "uvx",
      "args": ["pruna-mcp-server"],
      "env": { "PRUNA_API_KEY": "your-api-key" }
    }
  }
}

工具

工具

描述

定价

generate_image

10 种模型的文本生成图像

$0.0001/张起

edit_image

使用文本指令编辑 1-5 张图像

$0.010/张起

upscale_image

AI 放大至 1-8 百万像素

$0.005/张起

generate_video

文本/图像/音频生成视频

$0.005/秒起

list_models

浏览所有可用模型及定价

免费

upload_file

上传用于编辑/视频工作流的文件

免费

图像工具会返回一个 JSON 元数据块和一个原生的 MCP ImageContent 块(base64 格式,适用于小于 5MB 的图像)。

提示词

针对常见用例的内置工作流模板:

提示词

用例

示例

product-photo

电商产品拍摄

"干净背景上的白色皮质运动鞋"

virtual-staging

房地产房间布景

用家具布置空房间

social-media-visual

平台优化视觉素材

针对不同平台自动调整宽高比

game-concept-art

游戏资产与环境

角色、武器、景观

ad-creative

带文字叠加的数字广告

在图像中渲染标题

video-ad

短视频广告

真人出镜、产品演示

image-enhance

放大 + 增强工作流

AI 生成图像的精修

配置

环境变量

必需

默认值

描述

PRUNA_API_KEY

✅

—

您的 Pruna AI API 密钥

PRUNA_OUTPUT_DIR

—

./pruna-output

下载文件的目录

PRUNA_POLL_INTERVAL

—

2

异步轮询之间的秒数

PRUNA_TIMEOUT

—

120

HTTP 超时时间(秒)

PRUNA_MAX_RETRIES

—

3

瞬时错误的最大重试次数

客户端兼容性

客户端

传输方式

状态

备注

Kiro CLI

STDIO

✅ 已测试

需要 tools + allowedTools 配置

Claude Desktop

STDIO

✅ 已测试

使用 uv 的完整路径;不支持内联图像显示

Cursor

STDIO

🔲 计划中

—

Claude Code

STDIO

🔲 计划中

—

开发

git clone https://github.com/charlesrapp/pruna-mcp-server.git
cd pruna-mcp-server
uv sync --extra dev

# Run tests (100 tests, 94% coverage)
uv run pytest --cov

# Lint & type check
uv run ruff check src/ tests/
uv run mypy src/

请参阅 CONTRIBUTING.md 获取指南。

许可证

MIT — 请参阅 LICENSE。

Available Tools

8 tools
edit_imageA

Edit one or more images with text instructions using Pruna AI.

Args: prompt: Edit instruction describing the desired changes images: 1-5 image URLs or local file paths model: Model to use (default: p-image-edit) aspect_ratio: Output aspect ratio seed: Random seed for reproducible generation

Inputs: images (required), prompt (required), seed, model, +1 more.

generate_imageA

Generate an image from a text prompt using Pruna AI.

Args: prompt: Text description of the image to generate model: Model to use (default: p-image) aspect_ratio: Output aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, custom) width: Custom width 256-1440, multiple of 16. Only when aspect_ratio=custom height: Custom height 256-1440, multiple of 16. Only when aspect_ratio=custom seed: Random seed for reproducible generation

Inputs: prompt (required), seed, model, width, +2 more.

generate_videoB

Generate a video from text, image, or audio using Pruna AI.

Args: prompt: Text prompt for video generation model: Model to use (p-video, wan-t2v, wan-i2v, vace) image: Input image URL/path for image-to-video audio: Input audio URL/path for audio-conditioned video duration: Duration in seconds (1-20) resolution: Video resolution (720p or 1080p) aspect_ratio: Aspect ratio (ignored when image is provided) fps: Frames per second (24 or 48) seed: Random seed for reproducible generation

Inputs: prompt (required), fps, seed, audio, +5 more. Returns: result

list_modelsA
Read-onlyIdempotent

List available Pruna AI models with capabilities and pricing.

Args: category: Filter by category: image, editing, try-on, upscale, video, video-edit

Inputs: category. Returns: result

transform_videoA

Transform a source video using reference images (video-to-video).

Two models are available:

  • p-video-animate: animate a single subject reference image using the motion from the source video (provide exactly 1 reference).

  • p-video-replace: replace the character(s) in the source video using 1-3 identity reference images.

Motion, timing, camera movement, and scene structure are preserved.

Args: video: Source video URL or local file path (.mp4) references: Reference images (URLs or local file paths). Exactly 1 for p-video-animate, 1-3 for p-video-replace. model: Model to use (p-video-animate or p-video-replace) resolution: Output resolution (720p or 1080p) target_fps: Working FPS (original, 24, or 48) instruction_prompt: Optional guidance on how to apply the transform turbo: Faster generation for slightly lower quality save_audio: Save the output video with audio ignore_audio: Ignore source audio during generation seed: Random seed for reproducible generation

Inputs: video (required), references (required), seed, model, +6 more. Returns: result

try_on_imageA

Virtually fit one or more garments onto a person's photo using Pruna AI.

Args: person_image: Image URL or local file path of the person garment_images: 1-11 garment reference images (URLs or local file paths). Up to 6 recommended for best quality. model: Model to use (default: p-image-try-on) prompt: Experimental guidance for non-flatlay garment images (e.g. which garment from which image to use) turbo: Faster generation. Not recommended for more than 4 garments reference_pose: Experimental. Image URL/path to repose the person before try-on seed: Random seed for reproducible generation output_format: Output format (webp, jpg, png) output_quality: Quality for jpg/webp outputs (0-100) preserve_input_size: Resize the result back to the person image size

Inputs: person_image (required), garment_images (required), seed, model, +6 more.

upload_fileA
Idempotent

Upload a local file to Pruna AI for use in editing/video workflows.

Args: file_path: Local file path to upload (max 20MB)

Inputs: file_path (required). Returns: result

upscale_imageA
Idempotent

Upscale an image using Pruna AI.

Args: image: Image URL or local file path to upscale target: Target resolution in megapixels (1-128, capped at 128 MP) output_format: Output format (webp, jpg, png) enhance_details: Enhance fine textures enhance_realism: Improve realism (recommended for AI-generated images)

Inputs: image (required), target, output_format, enhance_details, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: image generation, image editing, video generation, video transformation, try-on, upscaling, model listing, and file upload. No two tools overlap in function.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., generate_image, edit_image, list_models) using snake_case, making them predictable and easy to understand.

    Tool Count5/5

    With 8 tools, the server is well-scoped for its purpose—covering core media generation and editing tasks without being overly sparse or cluttered.

    Completeness4/5

    The set covers major operations: generation, editing, transformation, upscaling, try-on, model listing, and file upload. A minor gap is the lack of a text-based video editing tool analogous to edit_image, but overall it's quite complete.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers