Midjourney MCP server

Integrates with Midjourney's image generation API to create, blend, upscale, and describe images with support for aspect ratios, variations, and reference inputs.
Back to servers
Setup instructions
Provider
z23cc
Release date
May 29, 2025
Stats
4 stars

This MCP server provides a complete implementation of the Midjourney Model Context Protocol, allowing you to generate high-quality images through the GPTNB API. It supports various image operations including generation, transformation, editing, face swapping, and description.

Installation Requirements

To use the MCP server, you'll need:

  • Python 3.10 or higher
  • pip
  • Node.js (optional, for MCP Inspector)

Setup Instructions

Installing the Package

# Clone the repository
git clone <repository-url>
cd mj-mcp

# Install dependencies
pip install -r requirements.txt

# Or install as an editable package
pip install -e .

Configuration

Set up your API credentials using environment variables:

# Windows
set GPTNB_API_KEY=your_api_key_here
set GPTNB_BASE_URL=https://aiclound.vip

# Linux/Mac
export GPTNB_API_KEY=your_api_key_here
export GPTNB_BASE_URL=https://aiclound.vip

Alternatively, create a .env file in the project root:

GPTNB_API_KEY=your_api_key_here
GPTNB_BASE_URL=https://aiclound.vip

Running the Server

Start the MCP server using one of these methods:

# Direct execution
python src/server.py

# Or using MCP Inspector tool
npx @modelcontextprotocol/inspector python src/server.py

Available Tools

Image Generation Tools

The server provides 6 core image manipulation tools:

Tool Name Description Key Parameters
imagine_image Generate images from text prompt, aspect_ratio, base64_images
blend_images Combine multiple images base64_images, dimensions
describe_image Analyze image content base64_image
change_image Transform existing images task_id, action, index
modal_edit Advanced image editing task_id, action, prompt
swap_face Replace faces in images source_image, target_image

Task Management

There's also a utility tool for managing tasks:

Tool Name Description Key Parameters
get_task_status Check task progress task_id

Usage Examples

Generating an Image

To create a new image from a text prompt:

# Using MCP client
result = await session.call_tool("imagine_image", {
    "prompt": "a beautiful sunset over mountains, digital art",
    "aspect_ratio": "16:9"
})

Creating Image Variations

To generate variations of a previously created image:

# Generate variations
result = await session.call_tool("change_image", {
    "task_id": "previous_task_id",
    "action": "VARIATION",
    "index": 1
})

Advanced Usage

You can chain multiple operations together to create complex image workflows. For example:

  1. Generate an initial image with imagine_image
  2. Get the task ID from the response
  3. Create variations using change_image
  4. Upscale promising results
  5. Apply advanced edits with modal_edit

Each operation returns a task ID that can be used to track progress or as input for subsequent operations.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "midjourney" '{"command":"python","args":["src/server.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "midjourney": {
            "command": "python",
            "args": [
                "src/server.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "midjourney": {
            "command": "python",
            "args": [
                "src/server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later