MCP 图像生成服务

MCP 图像生成服务

基于 Together AI 的图像生成服务,专为与 Cursor MCP 集成设计。

快速入门

环境准备

  1. 安装 Python 3.10+ 和 Node.js。
  2. 安装 uv 工具: brew install uv 或 pip install uv。
  3. 获取 Together AI API 密钥
  4. 下载并安装 Cursor IDE

安装配置

  1. 克隆项目: git clone https://github.com/chenyeju295/mcp_generate_images.git。
  2. 安装依赖: python3 -m pip install fastmcp requests。
  3. 修改 mcp_server.py 中的 API 密钥和配置。

启动服务

  • 开发模式运行: uv run --with fastmcp fastmcp dev /path/to/mcp_server.py。
  • 生产模式运行: uv run --with fastmcp fastmcp run /path/to/mcp_server.py。

使用方法

  1. 确保服务正常运行。
  2. 在 Cursor IDE 中添加 MCP 服务。
  3. 在 Composer 的 Agent 模式下输入提示生成图片。

错误排查

检查服务运行、路径权限、网络连接及依赖包是否正确。