home / mcp / grok2 image mcp server
Provides image generation via Grok-2 through MCP with configurable API keys and optional proxies.
Configuration
View docs{
"mcpServers": {
"fl0w1nd-grok2-image-mcp-server": {
"command": "npx",
"args": [
"grok2-image-mcp-server"
],
"env": {
"HTTP_PROXY": "http://127.0.0.1:7890",
"XAIAPI_KEY": "YOUR_API_KEY",
"XAIAPI_BASE_URL": "https://api-proxy.me/xai/v1",
"IMAGE_PROXY_DOMAIN": "https://image.proxy.workers.dev"
}
}
}
}You can run the Grok2 Image MCP Server locally to let a chat assistant generate images using the Grok-2 model through the Model Context Protocol. This MCP server acts as a bridge between your client and the Grok-2 image generation service, enabling image requests to be fed and handled consistently within your MCP workflow.
Use this MCP server with any MCP client to generate images by sending image requests through the common MCP interface. Your client can submit prompts, handle responses, and manage image URLs via the MCP channel just like other data sources and actions in your setup.
Practical usage patterns include pairing the MCP server with your dialog manager to generate images from user prompts, applying image proxying when needed, and routing results back to the user interface. If you encounter image access issues, you can configure an image proxy domain and an API base URL so requests go through reliable proxies.
Prerequisites: you need Node.js and npm (or a compatible runtime) installed on your system.
Install and run the MCP server using the recommended npx approach. The server runs locally and exposes an MCP command that your clients can invoke.
{
"mcpServers": {
"grok2_image": {
"command": "npx",
"args": [
"grok2-image-mcp-server"
],
"env": {
"XAIAPI_KEY": "YOUR_API_KEY"
}
}
}
}
```
```bash
npx -y grok2-image-mcp-server
```
```json
{
"mcpServers": {
"grok2_image": {
"command": "npx",
"args": [
"grok2-image-mcp-server"
],
"env": {
"XAIAPI_KEY": "YOUR_API_KEY"
}
}
}
}Configure optional environment variables to tailor how the server requests and serves images. These variables control API access, image proxying, and network routing.
Optional settings you can provide when you run the server include the base API URL, an image proxy domain, and an HTTP proxy for network access. These help with access in restricted environments and can improve reliability.