Image Generator
Generate and save images using the Replicate API.
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:
- Create an account at Replicate
- Get your API token from https://replicate.com/account
- Create a
.envfile based on the provided.env.exampletemplate:
REPLICATE_API_TOKEN=your_replicate_api_token_here
Important: The
.envfile is excluded from version control via.gitignoreto prevent accidentally exposing your API token. Never commit sensitive information to your repository.
Environment Setup
- Clone the repository:
git clone https://github.com/yourusername/image-generator.git
cd image-generator
- Create and activate a virtual environment:
# Using venv
python -m venv .venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Set up your
.envfile 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:
- Generate an image by using the "generate-image" tool with a descriptive prompt
- Save the generated image using the "save-image" tool with the image URL and prompt
- View all saved images using the "list-saved-images" tool
- Access saved images through the resource list
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--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.
Servidores relacionados
Scout Monitoring MCP
patrocinadorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
patrocinadorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
MLflow Prompt Registry
Access prompt templates managed in an MLflow Prompt Registry. Requires a running MLflow server configured via the MLFLOW_TRACKING_URI environment variable.
OpenAPI MCP Server
Explore and analyze OpenAPI specifications from local files or remote URLs.
SatGate
Open-source API gateway that adds budget enforcement, cost attribution, and monetization to AI agent API calls. MCP-aware with per-tool cost tracking, macaroon-based bearer tokens, L402 Lightning micropayments, and enterprise budget control (Fiat402). The economic firewall for the agent economy.
codeix
Fast semantic code search for AI agents — find symbols, references, and callers across any codebase. Pre-built index committed to git, instant queries via MCP.
Tatara MCP Server
An MCP server for interacting with the Tatara blockchain ecosystem. Requires configuration for the Tatara RPC endpoint and a wallet private key.
MCP Proxy Hub
Aggregates multiple MCP resource servers into a single interface using a JSON configuration file.
Zen MCP
Orchestrates multiple AI models like Claude and Gemini for enhanced code analysis, problem-solving, and collaborative development.
Code Context Provider MCP
Provides code context and analysis for AI assistants using WebAssembly Tree-sitter parsers.
Remote MCP Server (Authless)
An example of a remote MCP server deployable on Cloudflare Workers without authentication.
Prover MCP
Integrates with the Succinct Prover Network to monitor, calibrate, and optimize prover operations.