Token导航 LogoToken导航TokenDH.com
Grok Imagine Image MCP Server logo
设计创作stdio官方级别未说明来源级核验

Grok Imagine Image MCP Server

MCP Server

grok-imagine-image-mcp-server

Grok Imagine Image MCP Server是一个用于xAI的Grok Imagine Image API的模型上下文协议服务器,支持从文本提示生成图像和编辑现有图像。

工具数

2

提示词数

0

GitHub Stars

1

资源数

0
图像生成批量处理TypeScriptClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ex-takashima

提供方

ex-takashima

最后核验

2026/5/17 20:20

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx grok-imagine-image-mcp-server

详细介绍

Grok Imagine图像MCP服务器

](https://www.npmjs.com/package/grok-imagine-image-mcp-server) ![License: MIT](https://opensource.org/licenses/MIT)

日语版README在这里

用于xAI的Grok Imagine Image API的MCP(模型上下文协议)服务器。支持从文本提示生成图像和编辑现有图像。

npx快速入门

# Set your API key
export XAI_API_KEY="xai-your-api-key"

# Run the server
npx grok-imagine-image-mcp-server

特性

  • 图像生成:根据文本提示生成新图像
  • 图像编辑:使用提示编辑现有图像(仅限grok想象图像)
  • 批处理:通过CLI处理多个图像
  • 各种纵横比(1:1、4:3、16:9等)
  • 分辨率:1k(标准)
  • 一次生成多个图像(最多10个)
  • MCP响应中的可选缩略图预览

支持的型号

型号价格图像编辑备注
grok-imagine-image0.02美元/张✅ (+0.002美元/输入)推荐,默认

需求

  • Node.js 18.0.0或更高版本
  • xAI API密钥(从 console.x.ai)

安装

选项1:npx(推荐)

npx grok-imagine-image-mcp-server

选项2:全局安装

npm install -g grok-imagine-image-mcp-server
grok-imagine-image-mcp-server

配置

环境变量

变量必填描述
XAI_API_KEY您的xAI API密钥
DEBUG设置为 true 用于调试日志记录
OUTPUT_DIR图像的默认输出目录
XAI_IMAGE_THUMBNAIL设置为 true 包含缩略图

Claude桌面配置

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

{
  "mcpServers": {
    "grok-imagine-image": {
      "command": "npx",
      "args": ["-y", "grok-imagine-image-mcp-server"],
      "env": {
        "XAI_API_KEY": "xai-your-api-key-here"
      }
    }
  }
}

工具

generate_image

根据文本提示生成图像。

参数类型必填说明
promptstring要生成的图像的文本描述
output_pathstring输出文件路径(默认:generated_image.jpg)
modelstring要使用的模型(默认:grok imagine image)
nnumber图像数量(1-10,默认值:1)
aspect_ratiostring纵横比(默认:1:1)
resolutionstring分辨率(默认值:1k)
return_base64boolean返回base64数据(默认值:false)
include_thumbnailboolean包含缩略图(默认值:false)

edit_image

编辑现有图像(仅限grok想象图像)。

参数类型必填说明
promptstring所需编辑的描述
image_pathstring否\*源图像文件的路径
image_base64string否\*Base64编码源图像
image_urlstring否\*源图像的URL
output_pathstring输出文件路径(默认:edited_image.jpg)
nnumber图像数量(1-10,默认值:1)
resolutionstring分辨率(默认值:1k)。从输入图像中自动检测纵横比。

\*其中之一 image_path, image_base64,或 image_url 是必需的

备注edit_image工具使用源图像作为参考,并重新生成整个图像。它保持了整体构图和风格,但不是像素级的修复。最适合进行样式转换、主题替换和场景修改。

批处理CLI

使用批处理CLI一次处理多个映像:

# Run batch with config file
npx grok-imagine-image-batch batch.json

# Estimate cost only
npx grok-imagine-image-batch batch.json --estimate-only

# Custom output directory
npx grok-imagine-image-batch batch.json --output-dir ./images --format json

CLI选项

选项描述默认值
`--output-dir
`覆盖输出目录来自配置
--format 输出格式text
--timeout 超时(毫秒)600000
--max-concurrent 最大并发作业数(1-10)2
--estimate-only在不执行的情况下估算成本-
--allow-any-path允许任何输出路径(CI/CD)-

批处理配置文件

{
  "jobs": [
    {
      "prompt": "A beautiful sunset over mountains",
      "output_path": "sunset.jpg",
      "aspect_ratio": "16:9"
    },
    {
      "prompt": "Change to nighttime scene",
      "image_path": "input.jpg",
      "output_path": "edited.jpg"
    }
  ],
  "output_dir": "./output",
  "max_concurrent": 3,
  "default_model": "grok-imagine-image",
  "retry_policy": {
    "max_retries": 2,
    "retry_delay_ms": 1000
  }
}

examples/ 目录以获取更多配置示例。

支持的纵横比

纵横比用例
1:1Square,社交媒体配置文件(默认)
3:4 / 4:3标准肖像/风景
9:16 / 16:9智能手机/宽屏

支持的决议

解决方案描述
1k标准分辨率(1024x1024,默认)

用法示例

# Image generation
Generate an image of a sunset over mountains with aspect ratio 16:9

# Image editing
Change the background of this image to space

API 参考

函数端点
图像生成https://api.x.ai/v1/images/generations
图像编辑https://api.x.ai/v1/images/edits

发展

git clone https://github.com/ex-takashima/grok-imagine-image-mcp-server.git
cd grok-imagine-image-mcp-server
npm install
npm run build
npm start

许可证

麻省理工学院

作者

高岛俊二

目录标签

目录标签

图像生成批量处理TypeScriptClaude本地部署图像编辑AI模型API服务器

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

grok-imagine-image-mcp-server

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP