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

mcp_generate_images
可用于cursor 集成 mcp server
3 years
Works with Finder
1
Github Watches
2
Github Forks
13
Github Stars
AI 图像生成服务
基于 Together AI 的图像生成服务,专门设计用于与 Cursor MCP 服务集成。支持自定义图片大小、保存路径等功能。
功能特点
- 支持高质量图像生成
- 自动重试和错误处理
- 支持批量生成多张图片
- 完整的路径和权限验证
- 详细的错误提示
- 异步处理支持
环境准备
1. Python 环境
-
Python 3.10+
-
推荐使用 pyenv 管理 Python 版本:
# macOS 安装 pyenv
brew install pyenv
# 安装 Python
pyenv install 3.13.2
pyenv global 3.13.2
-
Nodejs 环境
-
下载地址: https://nodejs.org/zh-cn
2. uv 包管理工具
uv 是一个快速的 Python 包管理器,需要先安装:
# macOS 安装 uv
brew install uv
# 或者使用 pip 安装
pip install uv
3. Together AI API 密钥
- 访问 Together AI API Keys
- 注册/登录账号
- 创建新的 API 密钥
- 复制密钥并保存,格式如:
YOUR_API_KEY
4. Cursor
- 下载并安装 Cursor IDE
- 确保 Cursor 已正确配置 Python 环境
安装配置
- 克隆项目:
git clone [https://github.com/chenyeju295/mcp_generate_images.git]
- 安装依赖(cd 到mcp_generate_images 安装):
python3 -m pip install fastmcp requests
出现证书问题可以使用:
python3 -m pip install fastmcp requests --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade --force-reinstall --no-cache-dir
- 配置 API 密钥:
在 mcp_server.py
中修改 TOGETHER_API_KEY
:
TOGETHER_API_KEY = "your_api_key_here" # 替换为你的 Together AI API 密钥
- 配置服务:
在 mcp_server.py
中可以修改以下配置:
CONFIG = {
"api": {
"url": "https://api.together.xyz/v1/images/generations",
"model": "black-forest-labs/FLUX.1-schnell-Free",
"timeout": 30,
"max_retries": 3,
"retry_delay": 5
},
"image": {
"max_width": 1024,
"max_height": 1024,
"default_width": 1024,
"default_height": 1024,
"default_steps": 2,
"max_batch_size": 4
},
"output": {
"base_folder": "你的默认保存路径",
"allowed_extensions": [".png", ".jpg", ".jpeg"],
"default_extension": ".png"
}
}
运行服务
- 开发模式运行(带调试界面):
- 运行检查是否成功:
uv run --with fastmcp fastmcp dev /Users/username/Documents/mcp_generate_images/mcp_server.py
- 生产模式运行:
uv run --with fastmcp fastmcp run /Users/username/Documents/mcp_generate_images/mcp_server.py
- 如果端口被占用,可以指定其他端口:
PORT=5174 uv run --with fastmcp fastmcp dev /Users/username/Documents/mcp_generate_images/mcp_server.py
使用说明
在 Cursor IDE 中使用
- 确保服务正在运行
- 在 Cursor 中引入MCP:
- 添加mcp 服务:
uv run --with fastmcp fastmcp run /Users/username/Documents/mcp_generate_images/mcp_server.py
- 如图(运行成功):
- 在 Cursor 中使用:
- 在composer 的 agent 模式下,直接输入相关的提示:
错误排查
如果遇到问题,请检查:
- 服务是否正常运行
- 保存路径是否正确(必须是绝对路径)
- 目录权限是否正确
- 网络连接是否正常
- API 密钥是否有效
- Python 环境是否正确配置
- uv 是否正确安装
- 依赖包是否完整安装
相关推荐
Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.
Confidential guide on numerology and astrology, based of GG33 Public information
A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.
Converts Figma frames into front-end code for various mobile frameworks.
Advanced software engineer GPT that excels through nailing the basics.
Therapist adept at identifying core issues and offering practical advice with images.
Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.
Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx
A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.
Mirror ofhttps://github.com/agentience/practices_mcp_server
Mirror ofhttps://github.com/bitrefill/bitrefill-mcp-server
Reviews

user_t796bXcn
I've been using mcp_generate_images for a while now, and it's truly impressive. The capabilities of this tool in generating realistic images are outstanding. The user-friendly interface and the seamless integration with different projects make it a top choice for image generation tasks. Kudos to chenyeju295 for creating such a versatile and powerful tool! Highly recommend checking it out on GitHub.