together ai image server
A MCP server that enables Claude and other MCP-compatible assistants to generate images from text prompts using Together AI's image generation models.
A MCP server that enables Claude and other MCP-compatible assistants to generate images from text prompts using Together AI's image generation models.
English | 简体中文
A TypeScript-based MCP (Model Context Protocol) server for generating images using Together AI API.
This server provides a simple interface to generate images using Together AI's image generation models through the MCP protocol. It allows Claude and other MCP-compatible assistants to generate images based on text prompts.
generate_image
- Generate images from text prompts# Clone the repository
git clone https://github.com/zym9863/together-ai-image-server.git
cd together-ai-image-server
# Install dependencies
npm install
Set your Together AI API key as an environment variable:
# 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"
Alternatively, you can create a .env
file in the project root:
TOGETHER_API_KEY=your-api-key-here
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
To use with Claude Desktop, add the server config:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"Together AI Image Server": {
"command": "/path/to/together-ai-image-server/build/index.js"
}
}
}
Replace /path/to/together-ai-image-server
with the actual path to your installation.
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
Generates images based on a text prompt using Together AI's image generation API.
Parameters:
prompt
(string, required): Text prompt for image generationsteps
(number, optional, default: 4): Number of diffusion steps (1-4)n
(number, optional, default: 1): Number of images to generate (1-4)Returns:
JSON object containing:
- image_urls
: Array of URLs to the generated images
- local_paths
: Array of paths to locally cached images
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
[
{
"description": "Generate image from text prompt using Together AI API",
"inputSchema": {
"properties": {
"n": {
"description": "Number of images to generate (default: 1, max: 4)",
"maximum": 4,
"minimum": 1,
"type": "number"
},
"prompt": {
"description": "Text prompt for image generation",
"type": "string"
},
"steps": {
"description": "Number of diffusion steps (default: 4)",
"maximum": 4,
"minimum": 1,
"type": "number"
}
},
"required": [
"prompt"
],
"type": "object"
},
"name": "generate_image"
}
]