Skip to content

z23cc/MJ-MCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 Midjourney MCP Server

npm version License: MIT Node.js

A powerful Model Context Protocol (MCP) server that brings Midjourney's AI image generation directly to Claude Desktop and other MCP-compatible applications.

Quick Start β€’ Installation β€’ Features β€’ Documentation

Language: English | δΈ­ζ–‡


✨ What is this?

Transform your Claude Desktop into a powerful AI art studio! This MCP server seamlessly integrates Midjourney's image generation capabilities, allowing you to create stunning artwork directly through natural conversation with Claude.

🌟 Key Highlights

  • πŸš€ Zero-config setup - Works out of the box with npx
  • 🎯 Midjourney-focused - Optimized specifically for Midjourney API
  • πŸ–ΌοΈ Direct image display - See your creations instantly in Claude
  • πŸ”§ Full parameter support - Access all Midjourney features
  • ⚑ Real-time tracking - Monitor generation progress
  • 🎨 Advanced tools - Upscale, variations, blending, and more

πŸš€ Quick Start

1. Install and Test

npx midjourney-mcp@latest

2. Configure Claude Desktop

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

{
  "mcpServers": {
    "midjourney": {
      "command": "npx",
      "args": ["midjourney-mcp@latest"],
      "env": {
        "MJ_API_KEY": "sk-your-api-key-here"
      }
    }
  }
}

3. Start Creating!

Restart Claude Desktop and try:

"Create a cyberpunk cityscape at night with neon lights, 16:9 aspect ratio"

πŸŽ‰ That's it! You're now ready to generate amazing AI artwork through Claude.


πŸ“¦ Installation

Option 1: NPX (Recommended)

# Run directly without installation (always gets latest version)
npx midjourney-mcp@latest

Option 2: Global Installation

# Install globally
npm install -g midjourney-mcp

# Run anywhere
midjourney-mcp

Option 3: Local Development

git clone https://github.com/z23cc/MJ-MCP.git
cd MJ-MCP
npm install
npm run build
npm run dev

βš™οΈ Configuration

Environment Variables

Variable Description Default Required
MJ_API_KEY Your Midjourney API key - βœ…
MJ_BASE_URL API base URL https://aiclound.vip ❌
MJ_TIMEOUT Request timeout (ms) 30000 ❌
MJ_MAX_RETRIES Max retry attempts 3 ❌

πŸ”‘ Getting Your API Key

Option 1: AICloud (Recommended)

  1. 🌐 Visit https://aiclound.vip
  2. πŸ“ Register an account or log in
  3. πŸ’³ Purchase credits or choose a plan
  4. πŸ”‘ Generate your API key from the dashboard
  5. πŸ“‹ Copy the key (format: sk-xxxxxxxxxx)

⚠️ Important: Make sure your chosen provider supports the Midjourney API format that this MCP server expects. If you use a different provider, you may need to update the MJ_BASE_URL environment variable.

Setting Up Your Key

Once you have your API key, you can use it in two ways:

Method 1: Environment Variable

export MJ_API_KEY="sk-your-actual-api-key-here"

Method 2: Claude Desktop Config (Recommended) Add it directly to your claude_desktop_config.json as shown in the Quick Start section.

πŸ”§ Using Custom API Providers

If you're using a different API provider (not AICloud), you may need to customize the base URL:

{
  "mcpServers": {
    "midjourney": {
      "command": "npx",
      "args": ["midjourney-mcp@latest"],
      "env": {
        "MJ_API_KEY": "your-api-key-here",
        "MJ_BASE_URL": "https://your-provider-api-url.com"
      }
    }
  }
}

Common API Base URLs:

  • AICloud: https://aiclound.vip (default)
  • Custom: Check your provider's documentation

πŸ› οΈ Features

Core Image Generation

  • 🎨 Text-to-Image: Create stunning artwork from text descriptions
  • πŸ“ Aspect Ratios: Support for all standard ratios (1:1, 16:9, 9:16, etc.)
  • 🎭 Style Control: Raw, stylize, and model-specific styling
  • 🎲 Chaos & Variation: Control randomness and artistic interpretation

Advanced Tools

  • πŸ“ˆ Upscaling: Enhance image resolution (U1-U4 buttons)
  • πŸ”„ Variations: Generate alternative versions (V1-V4 buttons)
  • 🎭 Blending: Combine multiple images seamlessly
  • πŸ“ Image Description: Reverse-engineer prompts from images
  • ⚑ Custom Actions: Zoom, pan, and other advanced operations

Smart Features

  • πŸ“Š Real-time Progress: Track generation status with duration
  • πŸ–ΌοΈ Direct Display: Images appear instantly in Claude
  • πŸ” Stuck Task Detection: Automatic warnings for long-running tasks
  • πŸ’‘ Smart Suggestions: Helpful tips and next steps

πŸ“š Documentation

Available Tools

🎨 midjourney_imagine - Generate images from text prompts

Description: Create stunning AI artwork using natural language descriptions.

Parameters:

Parameter Type Required Description
prompt string βœ… Text description of the image
aspect_ratio string ❌ 1:1, 16:9, 9:16, 4:3, 3:4, 2:3, 3:2, 5:4, 4:5
quality string ❌ low, medium, high
style string ❌ raw, stylize
model string ❌ midjourney, niji, niji-5, niji-6
chaos number ❌ 0-100 (variation amount)
stylize number ❌ 0-1000 (artistic level)
weird number ❌ 0-3000 (unusual results)
seed number ❌ For reproducible results
no string ❌ Negative prompt (things to avoid)
reference_images array ❌ Base64 encoded reference images

Example:

"Create a majestic dragon flying over a medieval castle, 16:9 aspect ratio, high quality"
πŸ“‹ midjourney_get_task - Check task status and results

Description: Monitor the progress of any Midjourney generation task.

Parameters:

Parameter Type Required Description
task_id string βœ… The ID of the task to check

Example:

"Check the status of task 1748526068622289"
πŸ“ˆ midjourney_upscale - Enhance image resolution

Description: Upscale a specific image from a completed 4-image generation.

Parameters:

Parameter Type Required Description
task_id string βœ… ID of the completed generation task
index number βœ… Which image to upscale (1-4)

Example:

"Upscale image 1 from my last generation"
🎲 midjourney_variation - Create image variations

Description: Generate alternative versions of a specific image.

Parameters:

Parameter Type Required Description
task_id string βœ… ID of the completed generation task
index number βœ… Which image to vary (1-4)

Example:

"Create variations of image 2"
πŸ”„ midjourney_reroll - Regenerate with same prompt

Description: Generate new results using the same prompt but different randomization.

Parameters:

Parameter Type Required Description
task_id string βœ… ID of the task to reroll

Example:

"Reroll my last generation"
🎭 midjourney_blend - Combine multiple images

Description: Blend 2-5 images together to create a new combined artwork.

Parameters:

Parameter Type Required Description
images array βœ… 2-5 base64 encoded images
aspect_ratio string ❌ Aspect ratio for result

Example:

"Blend these two images together with a 16:9 aspect ratio"
πŸ“ midjourney_describe - Generate prompts from images

Description: Analyze an image and generate text descriptions that could recreate it.

Parameters:

Parameter Type Required Description
image string βœ… Base64 encoded image

Example:

"Describe this image and suggest prompts"
⚑ midjourney_action - Execute advanced actions

Description: Perform zoom, pan, and other advanced operations on completed tasks.

Parameters:

Parameter Type Required Description
task_id string βœ… ID of the task with available actions
action string βœ… Action to perform (button label or ID)

Example:

"Zoom out on my last generation"

πŸ’‘ Usage Examples

Basic Image Generation

"Create a beautiful sunset over mountains with 16:9 aspect ratio"
"Generate a portrait of a cat in high quality using niji model"
"Make an abstract art piece with high chaos and stylization"

πŸ’‘ Pro Tip: Always use npx midjourney-mcp@latest to ensure you're running the newest version with the latest features and bug fixes!

Task Management

"Check the status of task 1748519117239161"
"Upscale image 1 from my last generation"
"Create variations of image 2"
"Reroll my last generation for different results"

Advanced Features

"Blend these two landscape photos together"
"Describe this image and suggest similar prompts"
"Zoom out on the generated image"

Real Workflow Example

  1. Generate: "Create a cyberpunk cityscape, neon lights, 16:9"
  2. Check Status: "How is my generation going?"
  3. Upscale: "Upscale image 3, it looks amazing!"
  4. Variations: "Create variations of image 1"

πŸ§ͺ Testing & Validation

βœ… Verified Features

  • πŸš€ Server Startup: MCP protocol compliance verified
  • πŸ› οΈ All 8 Tools: Registered and responding correctly
  • 🎨 Image Generation: Successfully tested with task 1748526068622289
  • πŸ“Š Status Tracking: Real-time progress monitoring working
  • πŸ”§ Parameter Validation: Comprehensive error handling
  • πŸ” API Authentication: Secure communication established
  • πŸ–₯️ Claude Desktop: Integration tested and verified

Recent Test Results

βœ… Prompt: "η”»δΈͺε°ηŒ«οΌšδΈ€εͺε―ηˆ±ηš„ε°ηŒ«οΌŒη”¨ε‘ι€šι£Žζ Όη»˜εˆΆοΌŒεΈ¦ζœ‰ζŸ”ε’Œηš„θ‰²ε½©ε’Œζ’¦εΉ»θˆ¬ηš„θƒŒζ™―"
βœ… Parameters: 1:1 aspect ratio, medium quality
βœ… Result: Task completed successfully in 3m 20s
βœ… Actions: U1-U4 upscale and V1-V4 variation options available

πŸ”§ Development

Project Structure

midjourney-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # πŸš€ Main server entry point
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   └── midjourney.ts     # 🎨 Midjourney tool implementations
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── midjourney.ts     # πŸ“ TypeScript definitions
β”‚   └── utils/
β”‚       └── config.ts         # βš™οΈ Configuration management
β”œβ”€β”€ build/                    # πŸ“¦ Compiled JavaScript output
β”œβ”€β”€ package.json              # πŸ“‹ Project configuration
└── tsconfig.json            # πŸ”§ TypeScript configuration

Development Scripts

npm run build      # πŸ”¨ Compile TypeScript to JavaScript
npm run watch      # πŸ‘€ Watch for changes and recompile
npm run dev        # πŸš€ Build and run the server locally
npm run inspector  # πŸ” Debug with MCP inspector tool

Contributing Guidelines

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  3. πŸ’Ύ Commit your changes (git commit -m 'Add amazing feature')
  4. πŸ“€ Push to the branch (git push origin feature/amazing-feature)
  5. πŸ”„ Open a Pull Request

πŸ“ž Support & Community

Getting Help

  • πŸ“– Documentation: Check this README for comprehensive guides
  • πŸ› Issues: Report bugs on GitHub Issues
  • πŸ’‘ Feature Requests: Suggest improvements via GitHub Issues
  • πŸ“§ Contact: Reach out to the maintainer for direct support

Useful Links


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

What this means:

  • βœ… Commercial use allowed
  • βœ… Modification allowed
  • βœ… Distribution allowed
  • βœ… Private use allowed
  • ❌ Liability not provided
  • ❌ Warranty not provided

Made with ❀️ for the AI art community

⭐ Star this repo if you find it useful! ⭐

Report Bug β€’ Request Feature β€’ Contribute

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published