by fl0w1nd
Grok2 Image Generator is an AI image generator enabling seamless artificial intelligence images generation via stdio tra
Generates and edits images using xAI's Grok image model through text prompts. Supports local files and various aspect ratios/resolutions.
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.
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.
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.
Add new capabilities to Claude beyond text generation
Example
Access external data sources, execute code, interact with tools and services
Transform Claude from chatbot to action-taking agent
Provide Claude with access to relevant context and data
Example
Load project documentation, access knowledge bases, query databases
Get more accurate, context-aware responses
Automate multi-step workflows combining AI and external tools
Example
Research → Summarize → Create document → Send notification
Complete complex tasks end-to-end without manual steps
Share your MCP server with the developer community
Grok2 Image Generator reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
Grok2 Image Generator reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
Grok2 Image Generator has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
I recommend Grok2 Image Generator for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
Grok2 Image Generator reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
I recommend Grok2 Image Generator for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
We evaluated Grok2 Image Generator against two servers with overlapping tools; this profile had the clearer scope statement.
I recommend Grok2 Image Generator for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
Grok2 Image Generator is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
Useful MCP listing: Grok2 Image Generator is the kind of server we cite when onboarding engineers to host + tool permissions.
showing 1-10 of 42
<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.
imgen.x.ai to handle network restrictions{
"mcpServers": {
"grok_image": {
"command": "npx",
"args": ["grok-image-mcp"],
"env": {
"XAIAPI_KEY": "your-xai-api-key"
}
}
}
}
generate_imageGenerate 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_imageEdit 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) |
| 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) |
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
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
})
}
MIT
<a id="中文"></a>
注意: 此包的前身是
grok2-image-mcp-server,该包已弃用,请使用grok-image-mcp。
imgen.x.ai,解决网络访问问题{
"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
如果 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
Prerequisites
Time Estimate
15-60 minutes depending on server complexity
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.
Protocols
Compatibility
✓ Use when
Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.
✗ Avoid when
Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.