Cover image
Try Now
2025-02-04

3 years

Works with Finder

1

Github Watches

8

Github Forks

69

Github Stars

Image Generation MCP Server

An MCP (Model Context Protocol) server implementation for generating images using Replicate's black-forest-labs/flux-schnell model.

Ideally to be used with Cursor's MCP feature, but can be used with any MCP client.

Features

  • Generate images from text prompts
  • Configurable image parameters (resolution, aspect ratio, quality)
  • Save generated images to specified directory
  • Full MCP protocol compliance
  • Error handling and validation

Prerequisites

  • Node.js 16+
  • Replicate API token
  • TypeScript SDK for MCP

Setup

  1. Clone the repository

  2. Install dependencies:

    npm install
    
  3. Add your Replicate API token directly in the code at src/imageService.ts by updating the apiToken constant:

    // No environment variables are used since they can't be easily set in cursor
    const apiToken = "your-replicate-api-token-here";
    

    Note: If using with Claude, you can create a .env file in the root directory and set your API token there:

    REPLICATE_API_TOKEN=your-replicate-api-token-here
    

    Then build the project:

    npm run build
    

Usage

To use with cursor:

  1. Go to Settings
  2. Select Features
  3. Scroll down to "MCP Servers"
  4. Click "Add new MCP Server"
  5. Set Type to "Command"
  6. Set Command to: node ./path/to/dist/server.js

API Parameters

Parameter Type Required Default Description
prompt string Yes - Text prompt for image generation
output_dir string Yes - Server directory path to save generated images
go_fast boolean No false Enable faster generation mode
megapixels string No "1" Resolution quality ("1", "2", "4")
num_outputs number No 1 Number of images to generate (1-4)
aspect_ratio string No "1:1" Aspect ratio ("1:1", "4:3", "16:9")
output_format string No "webp" Image format ("webp", "png", "jpeg")
output_quality number No 80 Compression quality (1-100)
num_inference_steps number No 4 Number of denoising steps (4-20)

Example Request

{
  "prompt": "black forest gateau cake spelling out 'FLUX SCHNELL'",
  "output_dir": "/var/output/images",
  "filename": "black_forest_cake",
  "output_format": "webp"
  "go_fast": true,
  "megapixels": "1",
  "num_outputs": 2,
  "aspect_ratio": "1:1"
}

Example Response

{
  "image_paths": [
    "/var/output/images/output_0.webp",
    "/var/output/images/output_1.webp"
  ],
  "metadata": {
    "model": "black-forest-labs/flux-schnell",
    "inference_time_ms": 2847
  }
}

Error Handling

The server handles the following error types:

  • Validation errors (invalid parameters)
  • API errors (Replicate API issues)
  • Server errors (filesystem, permissions)
  • Unknown errors (unexpected issues)

Each error response includes:

  • Error code
  • Human-readable message
  • Detailed error information

License

ISC

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

    Reviews

    2 (1)
    Avatar
    user_tBz5cMX8
    2025-04-17

    I've been using ai-image-gen-mcp for all my AI image generation needs, and it's fantastic! The tool, developed by mikeyny, provides reliable and impressive results every time. The interface is user-friendly, making it easy to create stunning images effortlessly. Highly recommended for anyone looking into AI-driven image creation! Check it out on GitHub: https://github.com/mikeyny/ai-image-gen-mcp