一起AI图像服务
一个MCP服务器,它使克劳德和其他与MCP兼容的助手能够使用Together AI的图像生成模型,从文本提示中生成图像。
可用工具 (1 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
generate_image 3 个参数 需填 1 项
Generate image from text prompt using Together AI API
必填参数:prompt
服务介绍
Together AI 图像服务器
English | 简体中文
这是一个基于 TypeScript 的 MCP(Model Context Protocol)服务器,用于通过 Together AI API 生成图像。
概览
该服务器通过 MCP 协议提供了一个简单的接口,使用 Together AI 的图像生成模型来生成图像。它允许 Claude 和其他兼容 MCP 的助手根据文本提示生成图像。
功能
工具
generate_image- 根据文本提示生成图像- 需要一个文本提示作为必需参数
- 可选参数用于控制生成步骤和生成的图像数量
- 返回生成图像的 URL 和本地路径
前提条件
- Node.js (推荐 v14 或更高版本)
- Together AI API 密钥
安装
# Clone the repository
git clone https://github.com/zym9863/together-ai-image-server.git
cd together-ai-image-server
# Install dependencies
npm install
配置
将你的 Together AI API 密钥设置为环境变量:
# On Linux/macOS
export TOGETHER_API_KEY="your-api-key-here"
# On Windows (Command Prompt)
set TOGETHER_API_KEY=your-api-key-here
# On Windows (PowerShell)
$env:TOGETHER_API_KEY="your-api-key-here"
或者,你可以在项目根目录中创建一个 .env 文件:
TOGETHER_API_KEY=your-api-key-here
开发
构建服务器:
npm run build
对于带有自动重建功能的开发:
npm run watch
与 Claude Desktop 一起使用
要与 Claude Desktop 一起使用,请添加服务器配置:
在 macOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"Together AI Image Server": {
"command": "/path/to/together-ai-image-server/build/index.js"
}
}
}
将 /path/to/together-ai-image-server 替换为你实际的安装路径。
调试
由于 MCP 服务器通过 stdio 进行通信,调试可能会比较困难。我们建议使用 MCP Inspector,它作为一个包脚本提供:
npm run inspector
Inspector 将提供一个 URL,以便你在浏览器中访问调试工具。
API 参考
generate_image
使用 Together AI 的图像生成 API 根据文本提示生成图像。
参数:
prompt(字符串, 必需): 用于图像生成的文本提示steps(数字, 可选, 默认值: 4): 扩散步骤数 (1-4)n(数字, 可选, 默认值: 1): 生成的图像数量 (1-4)
返回:
包含以下内容的 JSON 对象:
image_urls: 生成图像的 URL 数组local_paths: 本地缓存图像的路径数组
许可证
MIT
贡献
欢迎贡献!请随时提交 Pull Request。