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-mcpSearch for latest AI news on web and X"
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 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.
Related MCP server: grok-quorum-mcp
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.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.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 |
| string | Yes | - | Search query |
| enum | No |
|
|
| enum | No |
| See model table below |
| enum | No |
|
|
| object | No | - | Domain filters (allowed/excluded are mutually exclusive) |
| 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 |
| string | Yes | - | Brainstorming topic |
| string | No | - | Additional context |
| string[] | No | - | Project files to read as context (max 10) |
| number | No |
| Number of ideas (1-10) |
| enum | No |
|
|
| enum | No |
| Model selection |
| enum | No |
|
|
Style temperature mapping: practical=0.5, balanced=0.7, innovative=0.95, radical=1.0
Example:
"Brainstorm 3 practical ideas for improving user onboarding, read ./README.md for context"Model Selection
Model | Architecture | Price (input/output per M) | Context | Best For |
| 4-Agent collaboration | $2.00 / $6.00 | 2M | Default — lowest hallucination rate (~4.2%) |
| Chain-of-thought | $2.00 / $6.00 | 2M | Deep technical analysis |
| Standard | $2.00 / $6.00 | 2M | Fastest speed, quick creative divergence |
Performance
Tested on 2026-03-12:
Operation | Model | Time | Tokens |
Web Search | multi-agent | ~29s | ~70K |
X Search | multi-agent | ~28s | ~48K |
Brainstorm (3 ideas) | multi-agent | ~16s | ~3.6K |
Brainstorm (5 ideas) | non-reasoning | ~7s | ~2.2K |
Proxy Configuration
Add proxy environment variable to your config:
{
"mcpServers": {
"grok-mcp": {
"command": "npx",
"args": ["-y", "@lkbaba/grok-mcp@latest"],
"env": {
"XAI_API_KEY": "your_xai_api_key_here",
"HTTPS_PROXY": "http://127.0.0.1:7897"
}
}
}
}Native fetch (undici) automatically reads proxy environment variables.
Local Development
git clone https://github.com/LKbaba/Grok-mcp.git
cd Grok-mcp
npm install
npm run build
export XAI_API_KEY="your_xai_api_key_here"
npm startProject Structure
src/
├── config/
│ └── index.ts # Configuration (zod validation)
├── types/
│ └── index.ts # TypeScript type definitions
├── tools/
│ ├── definitions.ts # MCP tool JSON Schema definitions
│ ├── agent-search.ts # grok_agent_search implementation
│ └── brainstorm.ts # grok_brainstorm implementation
├── utils/
│ ├── grok-client.ts # xAI API client (native fetch)
│ ├── tool-builder.ts # Search tool parameter builder
│ └── logger.ts # Logging and performance monitoring
└── index.ts # MCP server entry pointComparison with Gemini MCP
Feature | Gemini MCP | Grok MCP |
Web Search | Google Search (grounding) | Grok Web Search |
X/Twitter Search | Not available | Native support |
Citation URLs | Google redirect (opaque) | Direct URLs with titles (transparent) |
Search Speed | ~8-10s (flash) | ~16-29s (grok-4.20) |
Agent Architecture | Single model | 4-Agent collaboration |
Structured Output | text/json | text/json (native JSON Schema enforced) |
Brainstorm | Structured JSON | Structured JSON + style/count/context_files |
Best strategy: Use both! Gemini for speed and code analysis, Grok for deep search and X/Twitter intelligence.
Security
Path traversal protection:
context_filesare sandboxed to the working directory — paths like../../etc/passwdare blockedSensitive file blocking:
.env,.pem,.key, credentials, and database files are automatically excludedInput validation: Domain filters, date ranges, handle filters, and file counts are validated with strict schemas
Mutual exclusivity:
allowed_domains/excluded_domainsandallowed_x_handles/excluded_x_handlescannot be set simultaneouslyNo hardcoded secrets: API keys are loaded from environment variables only
License
MIT
Available Tools
2 toolsgrok_agent_searchA
Intelligent search powered by Grok AI. Supports Web search, X (Twitter) search, or mixed search. Grok automatically analyzes queries, executes searches, synthesizes information, and provides cited answers. Ideal for getting latest information, researching topics, and tracking social media trends.
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Grok model to use: - grok-4.20-multi-agent-beta-0309: 4-Agent collaboration, lowest hallucination rate (default) - grok-4.20-beta-0309-reasoning: Deep chain-of-thought reasoning - grok-4.20-beta-0309-non-reasoning: Fastest speed, creative divergence | grok-4.20-multi-agent-beta-0309 |
| query | Yes | Search query content | |
| search_type | No | Search type: - web: Web search only - x: X (Twitter) search only - mixed: Both Web and X search (recommended) | mixed |
| output_format | No | Output format: - text: Markdown format (default) - json: Structured JSON (enforced via native JSON Schema) | text |
| x_search_config | No | X search config (when search_type is x or mixed). Image understanding is enabled by default. | |
| web_search_config | No | Web search config (when search_type is web or mixed). Image understanding is enabled by default. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses the workflow: 'automatically analyzes queries, executes searches, synthesizes information, and provides cited answers.' This is meaningful behavioral context, though it omits any caveats or limitations that might be expected for a search tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences that front-load the purpose, then describe capabilities and ideal use cases. Every sentence adds value with no redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description provides a solid overview for a complex tool with nested configs and no output schema. It explains the output as 'cited answers' and covers main capabilities. However, it does not address the detailed configuration options (e.g., date ranges, domain restrictions), relying on the schema for those.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The description only echoes the search_type options (Web, X, mixed) and does not add new parameter semantics beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Intelligent search powered by Grok AI' with specific capabilities (Web, X, mixed search). It distinguishes itself from the sibling tool grok_brainstorm by focusing on search and information synthesis, not ideation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides context on when to use: 'Ideal for getting latest information, researching topics, and tracking social media trends.' This gives clear usage scenarios, though it does not explicitly mention when not to use or comparison to alternatives beyond the sibling's name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
grok_brainstormA
Creative brainstorming powered by Grok AI. Generates innovative ideas, multi-perspective analysis, and creative suggestions based on a given topic. Ideal for product design, content creation, problem solving, and strategic planning. Supports reading project files as context to generate project-relevant ideas.
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of ideas to generate, 1-10 (default 5) | |
| model | No | Grok model to use: - grok-4.20-multi-agent-beta-0309: 4-Agent collaboration, lowest hallucination rate (default) - grok-4.20-beta-0309-reasoning: Deep chain-of-thought reasoning - grok-4.20-beta-0309-non-reasoning: Fastest speed, creative divergence | grok-4.20-multi-agent-beta-0309 |
| style | No | Brainstorm style: - innovative: Pursue novel and unique ideas - practical: Focus on feasibility - radical: Break conventional thinking - balanced: Balance of all (default) | balanced |
| topic | Yes | Brainstorm topic — can be a question, idea, product concept, etc. e.g.: "How to improve user retention", "New product feature ideas", "Marketing campaign planning" | |
| context | No | Additional context information (optional) to help Grok better understand the background e.g.: target audience, industry background, existing constraints, budget range, etc. | |
| context_files | No | Project file paths (optional, max 10), reads file content as context e.g.: ["./README.md", "./docs/architecture.md"] | |
| output_format | No | Output format: - text: Markdown format (default) - json: Structured JSON enforced via native JSON Schema (ideas array with title/description/pros/cons/feasibility/implementation) | text |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of disclosing behavior. It adds useful behavioral context beyond the name: 'Supports reading project files as context to generate project-relevant ideas.' This is the only non-obvious behavior. The description does not discuss side effects, output shape (covered by output_format param), or limitations, but for a creative generation tool, the behavior is essentially non-destructive and straightforward.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, front-loaded with the core purpose. Every sentence earns its place: purpose, use cases, and the unique context_files capability. There is no redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 7-parameter tool with no output schema, the description is remarkably complete. It covers the overall function, suggests use cases, and highlights the context_files feature. The output_format parameter in the schema describes return formats, so the description does not need to repeat that. The rich parameter schemas and enums reduce the need for extensive prose.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description does not add meaning beyond what the schema already provides for each parameter. It reiterates that a topic is needed and that context_files provide project context, but the schema already documents these in detail. No additional semantic value is offered.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Generates innovative ideas, multi-perspective analysis, and creative suggestions based on a given topic.' It uses a specific verb ('generates') and resource ('ideas'), and the name 'grok_brainstorm' combined with the sibling tool 'search' makes the distinction clear, even without explicitly naming grok_agent_search.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool: 'Ideal for product design, content creation, problem solving, and strategic planning.' It does not explicitly exclude alternative tools or mention grok_agent_search, but the use cases are specific enough to guide the agent. Minor deduction for lacking an explicit 'when-not-to-use' statement.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
2 tool updates
v2.0.4- First observed
grok_agent_search - First observed
grok_brainstorm
TDQS
The two tools have clearly distinct purposes: one is for searching and synthesizing external information (grok_agent_search), the other for generating creative ideas (grok_brainstorm). No overlap in functionality or target use case.
Both tool names follow a consistent 'grok_' prefix with descriptive snake_case actions (agent_search, brainstorm). The naming pattern is uniform and predictable.
With only 2 tools, the server feels thin for a general-purpose Grok AI offering. The tools serve distinct functions, but the number is at the low end of what would be considered reasonable.
The server covers search and brainstorming but misses common AI capabilities like text generation, summarization, or question answering. For a server named 'grok-mcp', these are significant gaps that would require workarounds.
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 Connectors
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Build and supervise fleets of agents from Claude Code, Codex or Cursor. Connects over OAuth.
Share context and questions between Claude instances — VS Code, claude.ai web, and mobile.
Related MCP Servers
- AlicenseAqualityDmaintenanceIntegrates xAI's Grok APIs into Claude Code to enable image and video generation, real-time web searches, and multi-modal image analysis. It provides a suite of tools for interacting with Grok models directly through natural language prompts during a Claude session.5401MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables Claude to query Grok as a peer for collaborative reasoning, code reviews, and architecture debates. It provides access to real-time web research and multiple specialized reasoning modes through the xAI API.-
- FlicenseBqualityNot gradedmaintenanceIntegrates Grok AI into Claude Code to enable real-time X/Twitter search and deep analysis of social media links. It supports a dual-mode architecture featuring a browser-based free mode for SuperGrok subscribers and a cost-controlled API mode.2481-
- AlicenseAqualityBmaintenanceBrings xAI's Grok API into Claude Code as native tools, enabling chat, image generation, model listing, and multi-round consensus/validation analysis.5333MIT
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/LKbaba/Grok-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server