No description
Find a file
2026-02-06 23:52:39 -08:00
src/midjourney_mcp feat: enhance error handling with categorization and helpful suggestions 2026-02-07 07:51:06 +00:00
.env.example claude one shot 2026-01-28 21:23:44 -08:00
pyproject.toml claude one shot 2026-01-28 21:23:44 -08:00
README.md claude one shot 2026-01-28 21:23:44 -08:00
uv.lock claude one shot 2026-01-28 21:23:44 -08:00

Midjourney MCP Server

An MCP (Model Context Protocol) server that enables Claude to generate images using the Midjourney API via MidAPI.ai.

Features

  • imagine - Generate 4 images from a text prompt
  • upscale - Enhance image resolution
  • vary - Create variations of a generated image
  • check_status - Monitor async task progress

Setup

1. Get an API Key

Sign up at midapi.ai and get your API key from the API Key Management Page.

2. Install Dependencies

uv sync

3. Configure Environment

Create a .env file (or set the environment variable):

cp .env.example .env
# Edit .env and add your API key

Or export directly:

export MIDAPI_API_KEY=your_api_key_here

4. Test the Server

uv run midjourney-mcp

The server communicates via STDIO, so you won't see output until connected to a client.

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "midjourney": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/claude-midjourney-mcp",
        "run",
        "midjourney-mcp"
      ],
      "env": {
        "MIDAPI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Replace /path/to/claude-midjourney-mcp with the actual path to this project.

Usage Examples

Once configured, you can ask Claude to generate images:

"Generate an image of a serene Japanese garden at sunset with a koi pond"

"Create a cyberpunk cityscape in 16:9 aspect ratio"

"Make variations of the second image from the last generation"

Tool Reference

imagine

Generate images from a text prompt.

Parameter Type Default Description
prompt string required Image description (max 2000 chars)
aspect_ratio string "1:1" "1:1", "16:9", "9:16", "4:3", "3:4"
version string "7" "7", "6.1", "6", "niji6"
speed string "fast" "relaxed", "fast", "turbo"
stylization int 100 0-1000 (0=realistic, 1000=artistic)
wait_for_result bool true Wait for completion or return immediately

upscale

Enhance the resolution of a generated image.

Parameter Type Default Description
task_id string required Task ID from imagine
image_index int required Which image (0-3)
wait_for_result bool true Wait for completion

vary

Create variations of a generated image.

Parameter Type Default Description
task_id string required Task ID from imagine
image_index int required Which image (0-3)
wait_for_result bool true Wait for completion

check_status

Poll the status of any task.

Parameter Type Description
task_id string Task ID to check

Development

Testing with MCP Inspector

npx @modelcontextprotocol/inspector uv run midjourney-mcp

Project Structure

src/midjourney_mcp/
├── server.py      # MCP server with tool definitions
├── api_client.py  # Async HTTP client for MidAPI.ai
├── models.py      # Pydantic request/response models
└── config.py      # Configuration management

License

MIT