grok-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@grok-mcpGenerate an image of a futuristic city skyline at sunset with flying cars"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
grok-mcp
把 Grok2API 上的 Grok Console 画图 / 改图 / 视频 / 对话搜索能力,同时提供:
MCP Server — 给 Claude Code / Codex / Cursor 等 Agent 调用
Web Console — 风格对齐 grok2api 管理端的创作台(Chat / Image / Video)
能力边界(Console)
默认模型全部来自 Grok Console:
模型 | 类型 | 网关接口能力 |
| 对话 | Chat Completions、Responses、Messages |
| 对话 | Chat Completions、Responses、Messages |
| 对话 | Chat Completions、Responses、Messages |
| 对话 | Chat Completions、Responses、Messages |
| 对话 | Chat Completions、Responses、Messages |
| 对话 | Chat Completions、Responses、Messages |
| 图像 + 图像编辑 | Images Generations、Images Edits |
| 图像 + 图像编辑 | Images Generations、Images Edits |
| 视频 | Videos |
能力 | Grok2API 路径 | 默认模型 |
文生图 |
|
|
图编辑 |
| 同上(无单独 edit 模型 id) |
视频 |
|
|
搜索 / 对话 |
| 搜索 |
Related MCP server: Grok Imagine Video MCP Server
架构
Claude Code / Codex / Cursor
│ MCP HTTP (/mcp)
▼
grok-mcp (本仓库)
│ OpenAI-compatible HTTPS
▼
Grok2API → Grok Console网页控制台是另一条线:浏览器 → FastAPI → Grok2API。
仓库结构
grok-mcp/
├── src/grok_mcp/ # MCP server + Grok2API client
├── backend/app/ # FastAPI:Web API + /mcp 挂载 + 静态前端
├── frontend/ # React + Vite + Tailwind 控制台
├── examples/ # Claude Code / Codex 接入样例
├── scripts/ # 本地开发脚本
└── tests/快速开始
1. 配置
cp .env.example .env至少填写:
GROK2API_BASE_URL=http://127.0.0.1:8000
GROK2API_API_KEY=g2a_xxx_xxx
MCP_TOKEN=change-me-mcp-token
PUBLIC_BASE_URL=http://127.0.0.1:8790
ADMIN_PASSWORD=change-me
SESSION_SECRET=change-me-session-secret2. 本地开发
uv sync --extra dev
# 终端 1 — API / MCP :8790
./scripts/dev-backend.sh
# 终端 2 — 前端 :5173
./scripts/dev-frontend.sh浏览器打开 http://127.0.0.1:5173。
3. Docker
cd frontend && pnpm install && pnpm build && cd ..
docker compose up -d --build服务默认:
Web:
http://127.0.0.1:8790MCP:
http://127.0.0.1:8790/mcp登录:
ADMIN_USERNAME/ADMIN_PASSWORD
MCP 接入
Claude Code / CC Switch
推荐连接已部署的 grok-mcp HTTP 端点(见 examples/mcp.claude.json):
{
"mcpServers": {
"grok": {
"type": "http",
"url": "http://127.0.0.1:8790/mcp",
"headers": {
"Authorization": "Bearer change-me-mcp-token"
}
}
}
}写入 ~/.claude.json 的 mcpServers,或项目 .mcp.json,然后重开会话。
Codex
[features]
rmcp_client = true
[mcp_servers.grok]
url = "http://127.0.0.1:8790/mcp"
bearer_token_env_var = "MCP_BEARER_TOKEN"
startup_timeout_sec = 30
tool_timeout_sec = 600export MCP_BEARER_TOKEN="change-me-mcp-token"MCP Tools
Tool | 作用 |
| 静态 Console 模型表 |
| 目录 + 网关模型 |
| 画图 / 改图(下载到本地并返回可展示内容) |
| 视频任务(完成后提供 |
| 搜索 / 对话 |
Web 页面
路由 | 说明 |
| 概览 |
| 创作台:对话 / 图片 / 视频 |
| 本地图片历史 |
| 本地视频任务历史 |
| MCP 接入向导 + 配置展示 |
设计说明
不重新实现 Grok 上游协议;只做 Grok2API 适配层。
Agent 配置里应出现本服务的
/mcp,不要把g2a_key 写进 Claude/Codex。图片会物化到
GROK_MCP_MEDIA_DIR,并通过 MCPImageContent//media提供给客户端。上游图库清理优先使用 Grok2API 自带的媒体自动清理;本仓库默认不强制删除上游。
开发
uv sync --extra dev
uv run pytest
cd frontend
pnpm install
pnpm exec tsc -p tsconfig.app.json --noEmit
pnpm buildLicense
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityAmaintenanceMCP server that bridges ChatGPT Plus/Pro to Claude Code, enabling chat, deep research, and image generation via your own account.48MIT
- AlicenseAqualityBmaintenanceMCP server for generating, editing, and batch processing videos using xAI's Grok Imagine Video API, with support for text-to-video, image-to-video, and video editing via natural language prompts.4871MIT
- Alicense-qualityDmaintenanceA single-file MCP server that enhances Claude Desktop with real-time web and X search, multi-tool agent, and image/video generation via xAI's Grok.MIT
- AlicenseAqualityAmaintenanceAn MCP server for Grok (xAI) that enables chat, reasoning, vision, and video generation using the AceDataCloud API.8MIT
Related MCP Connectors
MCP server for Grok Imagine AI video generation
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for OpenAI Sora AI video generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jun9100/grok-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server