Grok-MCP-Claude
A 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.
README
Grok-MCP-Claude
Grok MCP server optimized for Claude Desktop — clean, single-file implementation using xAI's Grok for real-time web/X search and image generation.
Concept
Claude thinks, Grok searches.
Claude Desktop handles conversation, memory, and reasoning. Grok provides what Claude can't — real-time web search, X (Twitter) search, and image/video generation.

Features
| Tool | Description |
|---|---|
grok_search |
Real-time web and X (Twitter) search |
grok_chat |
Chat with vision, file, and code execution support |
grok_agent |
Multi-tool agent combining search, code execution, files, and images |
generate_image |
Image generation with img2img support |
generate_video |
Video generation with img2video and video2video support |
manage_files |
Upload, list, retrieve, and delete files on xAI |
Requirements
- Python 3.10+
- xAI API key
- Claude Desktop
Installation
git clone https://github.com/yourname/grok-mcp-claude.git
cd grok-mcp-claude
pip install -r requirements.txt
Configuration
Add to your Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"grok": {
"command": "python",
"args": ["/path/to/grok-mcp-claude/grok.py"],
"env": {
"XAI_API_KEY": "your-api-key-here"
}
}
}
}
Tool Reference
grok_search
Real-time search via web or X (Twitter).
| Parameter | Default | Description |
|---|---|---|
prompt |
required | Search query |
platform |
"web" |
"web" or "x" |
model |
DEFAULT_SEARCH_MODEL |
Model to use |
allowed_targets |
None |
Whitelist of domains (web) or handles (X) |
excluded_targets |
None |
Blacklist of domains (web) or handles (X) |
from_date |
None |
Start date DD-MM-YYYY (X only) |
to_date |
None |
End date DD-MM-YYYY (X only) |
include_inline_citations |
False |
Return inline citations |
grok_chat
General-purpose chat with optional vision, file, and code execution.
| Parameter | Default | Description |
|---|---|---|
prompt |
required | User message |
model |
DEFAULT_CHAT_MODEL |
Model to use |
system_prompt |
None |
System prompt |
file_ids |
None |
xAI file IDs to attach |
image_paths |
None |
Local image paths |
image_urls |
None |
Image URLs |
response_id |
None |
Previous response ID for stateful chat |
use_code_execution |
False |
Enable code execution |
grok_agent
Multi-tool agent. Combine web search, X search, code execution, files, and images freely.
| Parameter | Default | Description |
|---|---|---|
prompt |
required | User message |
model |
DEFAULT_SEARCH_MODEL |
Model to use |
use_web_search |
False |
Enable web search |
use_x_search |
False |
Enable X search |
use_code_execution |
False |
Enable code execution |
allowed_targets |
None |
Whitelist of domains or handles |
excluded_targets |
None |
Blacklist of domains or handles |
file_ids |
None |
xAI file IDs to attach |
image_paths |
None |
Local image paths |
image_urls |
None |
Image URLs |
system_prompt |
None |
System prompt |
include_inline_citations |
False |
Return inline citations |
max_turns |
None |
Max search iterations |
generate_image
Generate images. Pass image_path or image_url for img2img.
| Parameter | Default | Description |
|---|---|---|
prompt |
required | Generation prompt |
model |
DEFAULT_IMAGE_MODEL |
Model to use |
n |
1 |
Number of images |
image_path |
None |
Local image for img2img |
image_url |
None |
Image URL for img2img |
aspect_ratio |
None |
e.g. "16:9", "1:1", "9:16" |
generate_video
Generate videos from text, image, or video.
| Parameter | Default | Description |
|---|---|---|
prompt |
required | Generation prompt |
model |
DEFAULT_VIDEO_MODEL |
Model to use |
image_path / image_url |
None |
Source image for img2video |
video_path / video_url |
None |
Source video for video2video |
duration |
None |
Duration in seconds |
aspect_ratio |
None |
Aspect ratio |
resolution |
None |
Resolution |
manage_files
Manage files on xAI.
| Action | Required params | Description |
|---|---|---|
upload |
file_path |
Upload a file |
list |
— | List uploaded files |
get_info |
file_id |
Get file metadata |
get_content |
file_id |
Get file content |
delete |
file_id |
Delete a file |
Models
DEFAULT_CHAT_MODEL = "grok-4-1-fast-non-reasoning"
DEFAULT_SEARCH_MODEL = "grok-4-1-fast-reasoning"
DEFAULT_IMAGE_MODEL = "grok-imagine-image"
DEFAULT_VIDEO_MODEL = "grok-imagine-video"
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。