一个MCP服务器,将Claude Code与xAI的Grok连接起来,解锁实时网页搜索和X(Twitter)搜索功能。
概览
一个MCP服务器,将Claude Code与xAI的Grok连接起来,解锁实时网页搜索和X(Twitter)搜索功能。 : Claude 是指挥官,Grok 是实时搜索和社交媒体情报专家。 访问 xAI 控制台并创建 API 密钥。 - : ~/Library/Application Support/Claude/claude_desktop_config.json - : %APPDATA%\Claude\claude_desktop_config.json - : ~/.config/Claude/claude_desktop_config.json @latest确保Claude Code重启时你总能拿到最新版本。 由Grok驱动的实时网页和X(Twitter)搜索。Grok自动分析查询,执行搜索(可能多轮),综合信息并提供引用答案。 :包含内嵌引用、Grok使用的搜索查询、带标题的源链接和使用统计数据的搜索结果。 多视角创意生成,并支持项目上下文。
概述(AI 翻译)
赋予Claude CodeGrok 4.20的力量
一个MCP服务器,将Claude Code与xAI的Grok连接起来,解锁实时网页搜索和X(Twitter)搜索功能。
为什么是格罗克 + 克劳德?
| Grok的优势 | 使用场景 |
|---|---|
| Web + X 搜索实时信息及透明源 URL | |
| X/Twitter 搜索 | 追踪社交媒体趋势、公众舆论、突发新闻 |
| 4-代理架构Harper(研究)+ Benjamin(逻辑)+ Lucas(创意)协作 | |
| 200万代币上下文大规模上下文窗口用于全面分析 |
哲学:克劳德是指挥官,格罗克是实时搜索和社交媒体情报专家。
快速启动
1.获取API密钥
访问 xAI 控制台并创建 API 密钥。
2.配置Claude代码
添加到你的MCP配置文件中:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
@latest确保 Claude Code 重启时你总是获得最新版本。
3.重启 Claude 代码
工具 (2)
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Grok MCP Server
Give Claude Code the power of Grok 4.20
An MCP server that connects Claude Code to xAI’s Grok, unlocking real-time web search and X (Twitter) search capabilities.
Why Grok + Claude?
| Grok’s Strengths | Use Case |
|---|---|
| Web + X Search | Real-time information with transparent source URLs |
| X/Twitter Search | Track social media trends, public opinion, breaking news |
| 4-Agent Architecture | Harper (research) + Benjamin (logic) + Lucas (creative) collaboration |
| 2M Token Context | Massive context window for comprehensive analysis |
Philosophy: Claude is the commander, Grok is the specialist for real-time search and social media intelligence.
Quick Start
1. Get API Key
Visit xAI Console and create an API key.
2. Configure Claude Code
Add to your MCP config file:
- Mac:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"grok-mcp": {
"command": "npx",
"args": ["-y", "@lkbaba/grok-mcp@latest"],
"env": {
"XAI_API_KEY": "your_xai_api_key_here"
}
}
}
}
@latestensures you always get the newest version when Claude Code restarts.
3. Restart Claude Code
Tools (2)
grok_agent_search - Smart Search
Real-time web and X (Twitter) search powered by Grok. Grok automatically analyzes queries, executes searches (potentially multiple rounds), synthesizes information, and provides cited answers.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | Yes | - | Search query |
search_type |
enum | No | mixed |
web / x / mixed (recommended) |
model |
enum | No | grok-4.20-multi-agent-beta-0309 |
See model table below |
output_format |
enum | No | text |
text (Markdown) / json (native JSON Schema enforced) |
web_search_config |
object | No | - | Domain filters (allowed/excluded are mutually exclusive) |
x_search_config |
object | No | - | Date range, handle filters (allowed/excluded are mutually exclusive), video understanding |
Output includes: Search results with inline citations, search queries Grok used, titled source links, and usage statistics.
Example:
"Search for the latest Claude Code updates on X and the web"
grok_brainstorm - Creative Brainstorming
Multi-perspective idea generation with project context support.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
topic |
string | Yes | - | Brainstorming topic |
context |
string | No | - | Additional context |
context_files |
string[] | No | - | Project files to read as context (max 10) |
count |
number | No | 5 |
Number of ideas (1-10) |
安装
npx -y @lkbaba/grok-mcp@latest配置
{
"mcpServers": {
"grok-mcp": {
"command": "npx",
"args": ["-y", "@lkbaba/grok-mcp@latest"],
"env": {
"XAI_API_KEY": "your_xai_api_key_here"
}
}
}
}