Grok2 Image Generator▌

by fl0w1nd
Grok2 Image Generator is an AI image generator enabling seamless artificial intelligence images generation via stdio tra
Enables AI assistants to generate images through the Grok2 model using stdio transport for seamless integration into existing workflows.
best for
- / Content creators needing custom images
- / Developers building image generation workflows
- / Teams requiring AI-powered image editing
capabilities
- / Generate images from text descriptions
- / Edit existing images with natural language instructions
- / Process local image files automatically
- / Configure aspect ratios and resolutions
- / Create multiple image variations in batches
- / Handle up to 3 source images for editing
what it does
Generates and edits images using xAI's Grok image model through text prompts. Supports local files and various aspect ratios/resolutions.
about
Grok2 Image Generator is a community-built MCP server published by fl0w1nd that provides AI assistants with tools and capabilities via the Model Context Protocol. Grok2 Image Generator is an AI image generator enabling seamless artificial intelligence images generation via stdio tra It is categorized under ai ml.
how to install
You can install Grok2 Image Generator in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
Grok2 Image Generator is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
Grok Image MCP
<a id="english"></a>
An MCP (Model Context Protocol) server for image generation and editing using the Grok image model from xAI.
Note: This package was previously published as
grok2-image-mcp-server. That package is now deprecated — please usegrok-image-mcpinstead.
Features
- Image Generation — Generate images from text prompts with configurable aspect ratio, resolution, and batch count
- Image Editing — Edit existing images with natural language instructions, supporting 1–3 source images
- Local File Support — Provide local image paths for editing; the server reads and encodes them automatically
- Image Proxy — Optional proxy domain for
imgen.x.aito handle network restrictions - HTTP Proxy — Optional network proxy for API requests
Installation
Using npx (recommended)
{
"mcpServers": {
"grok_image": {
"command": "npx",
"args": ["grok-image-mcp"],
"env": {
"XAIAPI_KEY": "your-xai-api-key"
}
}
}
}
Tools
generate_image
Generate images from text prompts.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | ✅ | Text description of the image to generate |
n | number | Number of images (1–10, default 1) | |
aspect_ratio | string | Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, auto, etc.) | |
resolution | string | Resolution (1k or 2k, default 1k) |
edit_image
Edit existing images using a text prompt.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | ✅ | Text description of the desired edits |
image_urls | string[] | ✅ | 1–3 source images: URLs, base64 data URIs, or local file paths |
n | number | Number of output images (1–10, default 1) | |
aspect_ratio | string | Override output aspect ratio (default: follows first input image) | |
resolution | string | Resolution (1k or 2k, default 1k) |
Environment Variables
| Variable | Required | Description |
|---|---|---|
XAIAPI_KEY | ✅ | xAI API key |
XAIAPI_BASE_URL | API base URL (default: https://api.x.ai/v1). Use a proxy if the API is inaccessible | |
IMAGE_PROXY_DOMAIN | Proxy domain to replace imgen.x.ai in returned image URLs | |
HTTP_PROXY | HTTP/HTTPS proxy for API requests (e.g. http://127.0.0.1:7890) |
Proxy Examples
API proxy:
XAIAPI_BASE_URL=https://api-proxy.me/xai/v1
Image proxy:
IMAGE_PROXY_DOMAIN=https://image.proxy.workers.dev
Network proxy:
HTTP_PROXY=http://127.0.0.1:7890
Using Cloudflare Workers to Proxy Image URLs
If image URLs from imgen.x.ai are inaccessible, deploy a Cloudflare Worker as a reverse proxy and set IMAGE_PROXY_DOMAIN to your custom domain:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const TARGET_DOMAIN = 'imgen.x.ai'
async function handleRequest(request) {
const url = new URL(request.url)
const targetUrl = `https://${TARGET_DOMAIN}${url.pathname}${url.search}`
const init = {
method: request.method,
headers: request.headers,
body: request.method === 'GET' || request.method === 'HEAD' ? undefined : request.body,
redirect: 'follow'
}
const response = await fetch(targetUrl, init)
const newHeaders = new Headers(response.headers)
newHeaders.set('Access-Control-Allow-Origin', '*')
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders
})
}
License
MIT
<a id="中文"></a>
注意: 此包的前身是
grok2-image-mcp-server,该包已弃用,请使用grok-image-mcp。
功能
- 图像生成 — 通过文本提示生成图像,可配置宽高比、分辨率和批量数量
- 图像编辑 — 使用自然语言编辑现有图像,支持 1–3 张源图
- 本地文件支持 — 可提供本地图片路径进行编辑,服务端自动读取并编码
- 图片代理 — 可选代理域名替换
imgen.x.ai,解决网络访问问题 - 网络代理 — 支持 HTTP/HTTPS 代理
安装
使用 npx(推荐)
{
"mcpServers": {
"grok_image": {
"command": "npx",
"args": ["grok-image-mcp"],
"env": {
"XAIAPI_KEY": "你的 xAI API 密钥"
}
}
}
}
工具
generate_image
通过文本提示生成图像。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | ✅ | 描述要生成的图像内容 |
n | number | 生成数量(1–10,默认 1) | |
aspect_ratio | string | 宽高比(1:1、16:9、9:16、4:3、3:4、3:2、2:3、2:1、1:2、auto 等) | |
resolution | string | 分辨率(1k 或 2k,默认 1k) |
edit_image
使用文本提示编辑现有图像。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
prompt | string | ✅ | 描述所需的编辑内容 |
image_urls | string[] | ✅ | 1–3 张源图:URL、base64 data URI 或本地文件路径 |
n | number | 输出图像数量(1–10,默认 1) | |
aspect_ratio | string | 覆盖输出宽高比(默认跟随第一张输入图) | |
resolution | string | 分辨率(1k 或 2k,默认 1k) |
环境变量
| 变量 | 必填 | 说明 |
|---|---|---|
XAIAPI_KEY | ✅ | xAI API 密钥 |
XAIAPI_BASE_URL | API 基础地址(默认 https://api.x.ai/v1),可填写代理地址 | |
IMAGE_PROXY_DOMAIN | 图片代理域名,替换返回 URL 中的 imgen.x.ai | |
HTTP_PROXY | HTTP/HTTPS 网络代理地址(如 http://127.0.0.1:7890) |
代理示例
API 代理:
XAIAPI_BASE_URL=https://api-proxy.me/xai/v1
图片代理:
IMAGE_PROXY_DOMAIN=https://image.proxy.workers.dev
网络代理:
HTTP_PROXY=http://127.0.0.1:7890
使用 Cloudflare Workers 代理图片 URL
如果 imgen.x.ai 的图片无法访问,可部署 Cloudflare Worker 反向代理,然后将 IMAGE_PROXY_DOMAIN 设为你的自定义域名:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const TARGET_DOMAIN = 'imgen.x.ai'
async function handleRequest(request) {
const url = new URL(request.url)
const targetUrl = `https://${TARGET_DOMAIN}${url.pathname}${url.search}`
const init = {
method: request.method,
headers: request.headers,
body: request.method === 'GET' || request.method === 'HEAD' ? undefined : request.body,
redirect: 'follow'
}
const response = await fetch(targetUrl, init)
const newHeaders = new Headers(response.headers)
newHeaders.set('Access-Control-Allow-Origin', '*')
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders
})
}
许可证
MIT
FAQ
- What is the Grok2 Image Generator MCP server?
- Grok2 Image Generator is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for Grok2 Image Generator?
- This profile displays 10 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
Ratings
4.5★★★★★10 reviews- ★★★★★Shikha Mishra· Oct 10, 2024
Grok2 Image Generator is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
- ★★★★★Piyush G· Sep 9, 2024
We evaluated Grok2 Image Generator against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Chaitanya Patil· Aug 8, 2024
Useful MCP listing: Grok2 Image Generator is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Sakshi Patil· Jul 7, 2024
Grok2 Image Generator reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Ganesh Mohane· Jun 6, 2024
I recommend Grok2 Image Generator for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Oshnikdeep· May 5, 2024
Strong directory entry: Grok2 Image Generator surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Dhruvi Jain· Apr 4, 2024
Grok2 Image Generator has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Rahul Santra· Mar 3, 2024
According to our notes, Grok2 Image Generator benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Pratham Ware· Feb 2, 2024
We wired Grok2 Image Generator into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Yash Thakker· Jan 1, 2024
Grok2 Image Generator is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.