Cover image
Try Now
2025-03-20

可用于 Cursor 集成 MCP Server

3 years

Works with Finder

1

Github Watches

2

Github Forks

13

Github Stars

AI 图像生成服务

基于 Together AI 的图像生成服务,专门设计用于与 Cursor MCP 服务集成。支持自定义图片大小、保存路径等功能。

功能特点

  • 支持高质量图像生成
  • 自动重试和错误处理
  • 支持批量生成多张图片
  • 完整的路径和权限验证
  • 详细的错误提示
  • 异步处理支持

环境准备

1. Python 环境

# macOS 安装 pyenv
brew install pyenv

# 安装 Python
pyenv install 3.13.2
pyenv global 3.13.2

2. uv 包管理工具

uv 是一个快速的 Python 包管理器,需要先安装:

# macOS 安装 uv
brew install uv

# 或者使用 pip 安装
pip install uv

3. Together AI API 密钥

  1. 访问 Together AI API Keys
  2. 注册/登录账号
  3. 创建新的 API 密钥
  4. 复制密钥并保存,格式如:YOUR_API_KEY

4. Cursor

  • 下载并安装 Cursor IDE
  • 确保 Cursor 已正确配置 Python 环境

安装配置

  1. 克隆项目:
git clone [https://github.com/chenyeju295/mcp_generate_images.git]

  1. 安装依赖(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
  1. 配置 API 密钥:

mcp_server.py 中修改 TOGETHER_API_KEY

TOGETHER_API_KEY = "your_api_key_here"  # 替换为你的 Together AI API 密钥
  1. 配置服务:

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"
    }
}

运行服务

  1. 开发模式运行(带调试界面):
  • 运行检查是否成功:
uv run --with fastmcp fastmcp dev /Users/username/Documents/mcp_generate_images/mcp_server.py
  1. 生产模式运行:
uv run --with fastmcp fastmcp run /Users/username/Documents/mcp_generate_images/mcp_server.py
  1. 如果端口被占用,可以指定其他端口:
PORT=5174 uv run --with fastmcp fastmcp dev /Users/username/Documents/mcp_generate_images/mcp_server.py

使用说明

在 Cursor IDE 中使用

  1. 确保服务正在运行
  2. 在 Cursor 中引入MCP:
  • 添加mcp 服务:
uv run --with fastmcp fastmcp run /Users/username/Documents/mcp_generate_images/mcp_server.py
  • 如图(运行成功): image.png
  1. 在 Cursor 中使用:
  • 在composer 的 agent 模式下,直接输入相关的提示: image.png

错误排查

如果遇到问题,请检查:

  1. 服务是否正常运行
  2. 保存路径是否正确(必须是绝对路径)
  3. 目录权限是否正确
  4. 网络连接是否正常
  5. API 密钥是否有效
  6. Python 环境是否正确配置
  7. uv 是否正确安装
  8. 依赖包是否完整安装

相关推荐

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

  • 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.

  • Khalid kalib
  • Write professional emails

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

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • OffchainLabs
  • GO -Umsetzung des Ethereum -Beweises des Anteils

  • huahuayu
  • Ein einheitliches API-Gateway zur Integration mehrerer Ethercan-ähnlicher Blockchain-Explorer-APIs mit Modellkontextprotokoll (MCP) für AI-Assistenten.

  • deemkeen
  • Steuern Sie Ihren MBOT2 mit einer Power Combo: MQTT+MCP+LLM

  • zhaoyunxing92
  • 本项目是一个钉钉 MCP (Message Connector Protocol )服务 , 提供了与钉钉企业应用交互的 api 接口。项目基于 Go 语言开发 , 支持员工信息查询和消息发送等功能。

  • pontusab
  • Die Cursor & Windsurf -Community finden Regeln und MCPs

    Reviews

    4 (1)
    Avatar
    user_t796bXcn
    2025-04-17

    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.