MidjourneyMCP
MidjourneyMCP
一个用于通过 AceDataCloud API 使用 Midjourney 进行 AI 图像和视频生成的 模型上下文协议 (MCP) 服务器。
直接从 Claude、VS Code 或任何兼容 MCP 的客户端生成 AI 图像、视频并管理创意项目。
功能特性
图像生成 - 根据文本提示词创建 AI 生成的图像
图像转换 - 对图像进行放大、创建变体、缩放和平移
图像混合 - 将多张图像组合成创意融合作品
基于参考的生成 - 使用现有图像作为灵感来源
图像描述 - 获取图像的 AI 描述(反向提示词)
图像编辑 - 使用文本提示词和遮罩编辑图像
视频生成 - 根据文本和参考图像创建视频
视频扩展 - 延长现有视频以使其更长
翻译 - 将中文提示词翻译为英文
任务跟踪 - 监控生成进度并获取结果
工具参考
工具 | 描述 |
| 使用 Midjourney 根据文本提示词生成 AI 图像。 |
| 使用各种操作转换现有的 Midjourney 图像。 |
| 使用 Midjourney 将多张图像混合在一起。 |
| 使用参考图像作为灵感生成图像。 |
| 使用 Midjourney 编辑现有图像。 |
| 获取图像的 AI 生成描述。 |
| 使用 Midjourney 根据文本提示词和参考图像生成视频。 |
| 延长现有的 Midjourney 视频以使其更长。 |
| 将中文文本翻译为英文,以便用作 Midjourney 提示词。 |
| 获取先前生成的 Midjourney 图像的种子值。 |
| 查询 Midjourney 生成任务的状态和结果。 |
| 一次查询多个 Midjourney 生成任务。 |
| 列出所有可用的 Midjourney API 操作及相应工具。 |
| 获取关于编写有效 Midjourney 提示词的指南。 |
| 列出所有可用的 Midjourney 图像转换操作。 |
快速入门
1. 获取您的 API Token
在 AceDataCloud 平台 注册
前往 API 文档页面
点击 "Acquire" 获取您的 API token
复制该 token 以供下方使用
2. 使用托管服务器(推荐)
AceDataCloud 托管了一个受管理的 MCP 服务器 —— 无需本地安装。
端点: https://midjourney.mcp.acedata.cloud/mcp
所有请求都需要 Bearer token。请使用第 1 步中的 API token。
Claude.ai
通过 OAuth 直接在 Claude.ai 上连接 —— 无需 API token:
前往 Claude.ai 设置 → 集成 → 添加更多
输入服务器 URL:
https://midjourney.mcp.acedata.cloud/mcp完成 OAuth 登录流程
开始在对话中使用这些工具
Claude Desktop
添加到您的配置文件(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Cursor / Windsurf
添加到您的 MCP 配置文件(.cursor/mcp.json 或 .windsurf/mcp.json):
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}VS Code (Copilot)
添加到您的 VS Code MCP 配置文件(.vscode/mcp.json):
{
"servers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}或者为 VS Code 安装 Ace Data Cloud MCP 扩展,它捆绑了所有 15 个 MCP 服务器,支持一键设置。
JetBrains IDEs
前往 设置 → 工具 → AI Assistant → 模型上下文协议 (MCP)
点击 添加 → HTTP
粘贴:
{
"mcpServers": {
"midjourney": {
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Claude Code
Claude Code 原生支持 MCP 服务器:
claude mcp add midjourney --transport http https://midjourney.mcp.acedata.cloud/mcp \
-h "Authorization: Bearer YOUR_API_TOKEN"或者添加到您项目的 .mcp.json 中:
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Cline
添加到 Cline 的 MCP 设置(.cline/mcp_settings.json):
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Amazon Q Developer
添加到您的 MCP 配置:
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Roo Code
添加到 Roo Code MCP 设置:
{
"mcpServers": {
"midjourney": {
"type": "streamable-http",
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Continue.dev
添加到 .continue/config.yaml:
mcpServers:
- name: midjourney
type: streamable-http
url: https://midjourney.mcp.acedata.cloud/mcp
headers:
Authorization: "Bearer YOUR_API_TOKEN"Zed
添加到 Zed 的设置(~/.config/zed/settings.json):
{
"language_models": {
"mcp_servers": {
"midjourney": {
"url": "https://midjourney.mcp.acedata.cloud/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}
}cURL 测试
# Health check (no auth required)
curl https://midjourney.mcp.acedata.cloud/health
# MCP initialize
curl -X POST https://midjourney.mcp.acedata.cloud/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'3. 或者本地运行(替代方案)
如果您更喜欢在自己的机器上运行服务器:
# Install from PyPI
pip install mcp-midjourney
# or
uvx mcp-midjourney
# Set your API token
export ACEDATACLOUD_API_TOKEN="your_token_here"
# Run (stdio mode for Claude Desktop / local clients)
mcp-midjourney
# Run (HTTP mode for remote access)
mcp-midjourney --transport http --port 8000Claude Desktop (本地)
{
"mcpServers": {
"midjourney": {
"command": "uvx",
"args": ["mcp-midjourney"],
"env": {
"ACEDATACLOUD_API_TOKEN": "your_token_here"
}
}
}
}Docker (自托管)
docker pull ghcr.io/acedatacloud/mcp-midjourney:latest
docker run -p 8000:8000 ghcr.io/acedatacloud/mcp-midjourney:latest客户端使用自己的 Bearer token 进行连接 —— 服务器会从每个请求的 Authorization 标头中提取 token。
可用工具
图像生成
工具 | 描述 |
| 根据文本提示词生成图像(创建 2x2 网格) |
| 转换图像(放大、变体、缩放、平移) |
| 将多张图像混合在一起 |
| 使用参考图像作为灵感进行生成 |
图像编辑
工具 | 描述 |
| 使用文本提示词编辑现有图像 |
| 获取图像的 AI 描述(反向提示词) |
视频
工具 | 描述 |
| 根据文本和参考图像生成视频 |
| 延长现有视频以使其更长 |
实用工具
工具 | 描述 |
| 将中文文本翻译为英文以用于提示词 |
| 获取已生成图像的种子值 |
任务
工具 | 描述 |
| 查询单个任务状态 |
| 一次查询多个任务 |
信息
工具 | 描述 |
| 列出可用的 API 操作 |
| 获取提示词编写指南 |
| 列出转换操作 |
使用示例
根据提示词生成图像
User: Create a cyberpunk city at night
Claude: I'll generate a cyberpunk city image for you.
[Calls midjourney_imagine with prompt="Cyberpunk city at night, neon lights, rain, futuristic, detailed --ar 16:9"]放大图像
User: Upscale the second image
Claude: I'll upscale the top-right image from the grid.
[Calls midjourney_transform with image_id and action="upscale2"]混合多张图像
User: Blend these two images: [url1] and [url2]
Claude: I'll blend these images together.
[Calls midjourney_blend with image_urls=[url1, url2]]生成视频
User: Animate this image [url] with gentle movement
Claude: I'll create a video from this image.
[Calls midjourney_generate_video with image_url and prompt="Gentle camera movement, cinematic"]生成模式
模式 | 描述 |
| 推荐用于大多数用例(默认) |
| 生成速度更快,消耗更多积分 |
| 生成速度较慢,更便宜 |
配置
环境变量
变量 | 描述 | 默认值 |
| 来自 AceDataCloud 的 API token | 必需 |
| API 基础 URL |
|
| OAuth 客户端 ID(托管模式) | — |
| 平台基础 URL |
|
| 默认生成模式 |
|
| 请求超时时间(秒) |
|
| 日志级别 |
|
命令行选项
mcp-midjourney --help
Options:
--version Show version
--transport Transport mode: stdio (default) or http
--port Port for HTTP transport (default: 8000)开发
设置开发环境
# Clone repository
git clone https://github.com/AceDataCloud/MidjourneyMCP.git
cd MidjourneyMCP
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
# Install with dev dependencies
pip install -e ".[dev,test]"运行测试
# Run unit tests
pytest
# Run with coverage
pytest --cov=core --cov=tools
# Run integration tests (requires API token)
pytest tests/test_integration.py -m integration代码质量
# Format code
ruff format .
# Lint code
ruff check .
# Type check
mypy core tools构建与发布
# Install build dependencies
pip install -e ".[release]"
# Build package
python -m build
# Upload to PyPI
twine upload dist/*项目结构
MidjourneyMCP/
├── core/ # Core modules
│ ├── __init__.py
│ ├── client.py # HTTP client for Midjourney API
│ ├── config.py # Configuration management
│ ├── exceptions.py # Custom exceptions
│ ├── server.py # MCP server initialization
│ ├── types.py # Type definitions
│ └── utils.py # Utility functions
├── tools/ # MCP tool definitions
│ ├── __init__.py
│ ├── describe_tools.py # Image description tools
│ ├── edits_tools.py # Image editing tools
│ ├── imagine_tools.py # Image generation tools
│ ├── info_tools.py # Information tools
│ ├── task_tools.py # Task query tools
│ ├── translate_tools.py # Translation tools
│ └── video_tools.py # Video generation tools
├── prompts/ # MCP prompt templates
│ └── __init__.py
├── tests/ # Test suite
├── deploy/ # Deployment configs
│ └── production/
│ ├── deployment.yaml
│ ├── ingress.yaml
│ └── service.yaml
├── .env.example # Environment template
├── .gitignore
├── CHANGELOG.md
├── Dockerfile # Docker image for HTTP mode
├── docker-compose.yaml # Docker Compose config
├── LICENSE
├── main.py # Entry point
├── pyproject.toml # Project configuration
└── README.mdAPI 参考
此服务器封装了 AceDataCloud Midjourney API:
Midjourney Imagine API - 图像生成
Midjourney Describe API - 图像描述
Midjourney Tasks API - 任务查询
Midjourney Edits API - 图像编辑
Midjourney Videos API - 视频生成
贡献
欢迎贡献!请:
Fork 本仓库
创建功能分支 (
git checkout -b feature/amazing)提交您的更改 (
git commit -m 'Add amazing feature')推送到分支 (
git push origin feature/amazing)开启 Pull Request
许可证
MIT 许可证 - 详情请参阅 LICENSE。
链接
由 AceDataCloud 用心制作
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AceDataCloud/MidjourneyMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server