loading…
Search for a command to run...
loading…
An MCP server that automates a headless Chromium browser to generate images using Grok Imagine via text prompts. It supports configurable aspect ratios and save
An MCP server that automates a headless Chromium browser to generate images using Grok Imagine via text prompts. It supports configurable aspect ratios and saves images directly to disk using cookie-based authentication.
An MCP (Model Context Protocol) server that generates images using Grok Imagine. It automates a headless Chromium browser to submit prompts, wait for generation, and save the resulting images to disk.
playwright-extra with stealth plugin to avoid bot detectionbun install
Add the server to your MCP client config (e.g. .cursor/mcp.json):
{
"mcpServers": {
"grok-imagine-mcp": {
"command": "bun",
"args": ["run", "/path/to/grok-imagine-mcp/src/index.ts"]
}
}
}
Set "env": { "DEV": "true" } to run the browser in visible (non-headless) mode for debugging.
authAuthenticate with Grok by providing cookies from your browser session.
auth toolThe tool extracts and saves the essential cookies (sso, sso-rw, cf_clearance, x-userid). Cookies persist in data/storage-state.json.
generate_imagesGenerate images using Grok Imagine.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt |
string | yes | Text prompt describing the image(s) to generate |
quantity |
number | no | Number of images to save (1-6, default: 1). Each batch produces ~3 images. |
saveFolderFullPath |
string | yes | Absolute path to the folder where images will be saved |
aspectRatio |
string | no | 2:3, 3:2, 1:1, 9:16, or 16:9 (default: 1:1) |
Images are saved as grok-{timestamp}-{index}.jpg (or .png).
# Run in dev mode (visible browser, file watching)
bun run dev
# Type check
bun run typecheck
# Lint & format
bun run fix
src/
index.ts MCP server entry point and tool registration
browser.ts Browser lifecycle, tab pool, and idle timeout
generate.ts Image generation logic (prompt submission, polling, saving)
chromium.ts Playwright + stealth plugin setup
cookies.ts Cookie parsing, saving, and loading
console.ts Browser console log capture
constants.ts Configuration constants
data/
profile/ Chromium persistent user data
storage-state.json Saved cookies and storage state
Add this to claude_desktop_config.json and restart Claude Desktop.
{
"mcpServers": {
"grok-imagine-mcp": {
"command": "npx",
"args": []
}
}
}