Skip to main content

MCP server for Doubao image generation - generates images from text prompts using Doubao's API

Project description

MCP Doubao Image Generator

English | 中文

A Model Context Protocol (MCP) server that enables AI assistants to generate images from text prompts using Doubao Seedream.

Features

  • Doubao Seedream Integration: Generate images from text descriptions using Doubao Seedream API
  • Multiple Parameters: Support for size, style, quality, and quantity options
  • Dedicated Provider: Specifically designed for Doubao Seedream service
  • Cross-Platform: Works on Windows, Linux, and macOS
  • Easy Integration: Simple configuration for MCP clients

Installation

Using uvx (Recommended)

uvx mcp-seedream

Using pip

pip install mcp-seedream

From Source

git clone https://github.com/aardpro/mcp-seedream.git
cd mcp-seedream
pip install -e .

Configuration

Add the following to your MCP client configuration (e.g., Claude Desktop, Cursor):

Option 1: Using uvx with environment variables (Required Configuration)

You must configure the API settings using the environment field (or env depending on your MCP client implementation) in your MCP configuration to pass environment variables to the server. ARK_API_KEY is required for authentication. These will be used as the initial values when the server starts:

Note: Some MCP clients may require env instead of environment. Please check your MCP client documentation to confirm which field name is supported.

{
  "mcpServers": {
    "McpSeedream": {
      "command": "uvx",
      "args": ["mcp-seedream"],
      "environment": {
        "ARK_API_URL": "https://ark.cn-beijing.volces.com/api/v3/images/generations",
        "ARK_DEFAULT_MODEL": "doubao-seedream-4-5-251128",
        "ARK_API_KEY": "your-api-key-here",
        "ARK_OUTPUT_DIR": "./images"
      }
    }
  }
}

Option 2: Using pip-installed command with environment (or env) field

{
  "mcpServers": {
    "McpSeedream": {
      "command": "mcp-seedream",
      "environment": {
        "ARK_API_URL": "https://ark.cn-beijing.volces.com/api/v3/images/generations",
        "ARK_DEFAULT_MODEL": "doubao-seedream-4-5-251128",
        "ARK_API_KEY": "your-api-key-here",
        "ARK_OUTPUT_DIR": "./images"
      }
    }
  }
}

Option 3: Windows with Unicode Support

For Windows systems, to ensure proper functionality, use the environment field (or env depending on your MCP client implementation) in your MCP configuration:

{
  "mcpServers": {
    "McpSeedream": {
      "command": "cmd",
      "args": [
        "/c",
        "chcp 65001 >nul && uvx mcp-seedream"
      ],
      "environment": {
        "ARK_API_URL": "https://ark.cn-beijing.volces.com/api/v3/images/generations",
        "ARK_DEFAULT_MODEL": "doubao-seedream-4-5-251128",
        "ARK_API_KEY": "your-api-key-here",
        "ARK_OUTPUT_DIR": "./images"
      }
    }
  }
}

Option 4: Linux/macOS with Python module

Use the environment field (or env depending on your MCP client implementation) in your MCP configuration:

{
  "mcpServers": {
    "McpSeedream": {
      "command": "python",
      "args": ["-m", "main"],
      "environment": {
        "ARK_API_URL": "https://ark.cn-beijing.volces.com/api/v3/images/generations",
        "ARK_DEFAULT_MODEL": "doubao-seedream-4-5-251128",
        "ARK_API_KEY": "your-api-key-here",
        "ARK_OUTPUT_DIR": "./images"
      }
    }
  }
}

Available Tools

generate_image

Generate an image from text prompt using Doubao Seedream API.

Parameters:

  • prompt (string, required): Text description of the image to generate
  • model (string, optional): Model to use for generation (overrides default)
  • n (integer, optional): Number of images to generate (default: 1, max: 10)
  • size (string, optional): Size of the generated image (default: '1024x1024')
  • style (string, optional): Style of the generated image (default: 'vivid')
  • quality (string, optional): Quality of the generated image (default: 'standard')

Example:

{
  "name": "generate_image",
  "arguments": {
    "prompt": "A cute柴犬 playing in the park",
    "size": "1024x1024",
    "style": "vivid",
    "n": 1
  }
}

Usage Examples

Once configured, you can ask your AI assistant to:

  • "Generate an image of a futuristic cityscape at night"
  • "Create an illustration of a fantasy castle surrounded by floating mountains"
  • "Make a cartoon-style drawing of a robot reading a book"

Development

Setup Development Environment

git clone https://github.com/aardpro/mcp-seedream.git
cd mcp-seedream
pip install -e ".[dev]"

Run Tests

pytest

Build Package

build && upload

rm -rf dist && pip install build && python -m build && pip install twine && twine upload dist/*
pip install build
python -m build

Publish to PyPI

pip install twine
twine upload dist/*

Release Steps After Modifications

When making changes to the project, follow these steps to publish an updated version:

  1. Increment the version number in pyproject.toml
  2. Install build dependencies:
    pip install build twine
    
  3. Build the package:
    python -m build
    
  4. Test the built package locally (optional but recommended):
    pip install dist/mcp_seedream-*.whl
    
  5. Upload to PyPI:
    twine upload dist/*
    

Project Structure

doubao-image-generator/
├── src/
│   └── main/
│       ├── __init__.py
│       ├── __main__.py
│       └── server.py
├── pyproject.toml
├── README.md
└── LICENSE

Troubleshooting

Configuration Issues

Make sure you have configured the API settings using environment variables in your MCP configuration. The ARK_API_KEY is required for authentication:

For MCP environment configuration, see the examples in the Configuration section above.

Image Generation Failures

If image generation fails, check that:

  1. Your API key is valid and has sufficient credits
  2. The prompt is not too long or contains no prohibited content
  3. The requested image size is supported by your chosen API provider

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_seedream-1.0.5.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_seedream-1.0.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_seedream-1.0.5.tar.gz.

File metadata

  • Download URL: mcp_seedream-1.0.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for mcp_seedream-1.0.5.tar.gz
Algorithm Hash digest
SHA256 08d1abab0ddda35a544ff3116e1a8ce35dfd0a2aa21b8a9394c0df12637a7eeb
MD5 7c770f55b838678d14324be3ea983bf0
BLAKE2b-256 9fca3138289d78e1d5df80c72da2d0aa329a5462e45a364a7b25888219f9ae70

See more details on using hashes here.

File details

Details for the file mcp_seedream-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: mcp_seedream-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for mcp_seedream-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 43133562f69d1899e0f3e7cc0e6ead8c506a10be74ba29684adca352c618c380
MD5 789dfba7a920d3f89813cdee68d3e15b
BLAKE2b-256 1b2adc655d73a9cf6eb735fbf6fc2e447b52b74b870e2abd79a3969d2151524a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page