English | 简体中文
一个基于TypeScript的MCP(模型上下文协议)服务器,用于通过Together AI API生成图像。
<a href="https://glama.ai/mcp/servers/p1ctvg1l87"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=3359910004,2236865785&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Together AI 图像服务器 MCP服务器" /> </a>此服务器提供了一个简单的接口,通过MCP协议使用Together AI的图像生成模型来生成图像。它允许Claude和其他兼容MCP的助手根据文本提示生成图像。
generate_image - 根据文本提示生成图像
# 克隆仓库
git clone https://github.com/zym9863/together-ai-image-server.git
cd together-ai-image-server
# 安装依赖
npm install
设置您的Together AI API密钥为环境变量:
# 在Linux/macOS上
export TOGETHER_API_KEY="your-api-key-here"
# 在Windows(命令提示符)上
set TOGETHER_API_KEY=your-api-key-here
# 在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中使用,请添加服务器配置:
在macOS上:~/Library/Application Support/Claude/claude_desktop_config.json
在Windows上:%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"Together AI 图像服务器": {
"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,以便您可以在浏览器中访问调试工具。
根据文本提示使用Together AI的图像生成API生成图像。
参数:
prompt(字符串,必需):用于图像生成的文本提示steps(数字,可选,默认值:4):扩散步骤的数量(1-4)n(数字,可选,默认值:1):要生成的图像数量(1-4)返回:
包含以下内容的JSON对象:
image_urls:生成图像的URL数组local_paths:本地缓存图像的路径数组MIT
欢迎贡献!请随意提交Pull Request。