MCP cover image
See in Github
2025-03-09

连接以复制图像生成API的MCP服务器 - 连接到Windsurfer的示例

1

Github Watches

2

Github Forks

0

Github Stars

Image Generator MCP Server

An MCP server that uses Replicate to generate images and allows users to save them.

Components

Resources

The server implements an image storage system with:

  • Custom image:// URI scheme for accessing individual generated images
  • Each image resource has a name based on its prompt, description with creation date, and image/png mimetype

Prompts

The server provides a single prompt:

  • generate-image: Creates prompts for generating images using Stable Diffusion
    • Optional "style" argument to control the image style (realistic/artistic/abstract)
    • Generates a prompt template with style-specific guidance

Tools

The server implements three tools:

  • generate-image: Generates an image using Replicate's Stable Diffusion model
    • Takes "prompt" as a required string argument
    • Optional parameters include "negative_prompt", "width", "height", "num_inference_steps", and "guidance_scale"
    • Returns the generated image and its URL
  • save-image: Saves a generated image to the local filesystem
    • Takes "image_url" and "prompt" as required string arguments
    • Generates a unique ID for the image and saves it to the "generated_images" directory
  • list-saved-images: Lists all saved images
    • Returns a list of all saved images with their metadata and thumbnails

Configuration

Replicate API Token

To use this image generator, you need a Replicate API token:

  1. Create an account at Replicate
  2. Get your API token from https://replicate.com/account
  3. Create a .env file based on the provided .env.example template:
REPLICATE_API_TOKEN=your_replicate_api_token_here

Important: The .env file is excluded from version control via .gitignore to prevent accidentally exposing your API token. Never commit sensitive information to your repository.

Environment Setup

  1. Clone the repository:
git clone https://github.com/yourusername/image-generator.git
cd image-generator
  1. Create and activate a virtual environment:
# Using venv
python -m venv .venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your .env file as described above

Quickstart

Install

Claude Desktop

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

Development/Unpublished Servers Configuration ``` "mcpServers": { "image-generator": { "command": "uv", "args": [ "--directory", "B:\NEWTEST\image-generator", "run", "image-generator" ] } } ```
Published Servers Configuration ``` "mcpServers": { "image-generator": { "command": "uvx", "args": [ "image-generator" ] } } ```

Usage

Once the server is running, you can:

  1. Generate an image by using the "generate-image" tool with a descriptive prompt
  2. Save the generated image using the "save-image" tool with the image URL and prompt
  3. View all saved images using the "list-saved-images" tool
  4. Access saved images through the resource list

Development

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory B:\NEWTEST\image-generator run image-generator

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

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

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

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

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

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

  • 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

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

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

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

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • modelcontextprotocol
  • 模型上下文协议服务器

    Reviews

    1 (1)
    Avatar
    user_p3IQ9CDU
    2025-04-16

    I've been using MCP Hosting in TEE for a few months now, and it has exceeded my expectations. The stability and security provided by the TEE environment are phenomenal. Setting up is straightforward, thanks to clear guidance on the link provided by tolak. Highly recommended for any serious developer!