grok-mcp
Click on "Deploy 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-mcp what are the latest trends in AI research? use web search"
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
MCP server that wraps the xAI Grok API. Lets Claude and other AI agents delegate thinking, planning, and real-time search to Grok.
Quick Start
One-liner to add to Claude Code on any device:
claude mcp add grok -e XAI_API_KEY=your-key -- npx -y @pkwadsy/grok-mcpYou need an xAI API key from console.x.ai.
Alternative: project config
Add to your project's .mcp.json:
{
"mcpServers": {
"grok": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@pkwadsy/grok-mcp"],
"env": {
"XAI_API_KEY": "your-xai-api-key"
}
}
}
}Related MCP server: grok-search-mcp
Tools
ask_grok
Ask Grok a question with optional file context, web search, and X/Twitter search.
Parameter | Type | Required | Description |
| string | yes | The question or task for Grok |
| string[] | no | Files to include in context (see file syntax below) |
| number | no | Override max file count (default 50) |
| number | no | Override max per-file size in KB (default 32) |
| string | no | Custom system prompt |
| string | no | Model to use (default: |
| boolean | no | Web search, enabled by default |
| boolean | no | Enable X/Twitter search |
check_files
Dry-run file resolution. Validates all files and shows sizes without calling Grok. If check_files passes, ask_grok will too.
Parameter | Type | Required | Description |
| string[] | yes | Files to check (same syntax as |
| number | no | Override max file count (default 50) |
| number | no | Override max per-file size in KB (default 32) |
File syntax
Files are passed as an array of strings with compact syntax:
Syntax | Description |
| Whole file |
| Lines 10 to 30 |
| Just line 10 |
| Glob pattern |
| Bypass per-file size limit |
| Combine line range with force |
Safety limits
Limit | Default | Override |
Files per call | 50 |
|
Per-file size | 32 KB |
|
Total context | 256 KB | Hard cap, not overridable |
Available models
grok-4.20-multi-agent— multi-agent mode, great for architecture and planning (default)grok-4.20-reasoning— flagship reasoninggrok-4.20-non-reasoning— fast, no reasoninggrok-4.1-fast-reasoning— cheaper reasoninggrok-4.1-fast-non-reasoning— cheapest, fast
Examples
Ask with file context:
prompt: "Review this code for bugs"
files: ["src/index.ts", "src/utils.ts:20-50"]Search the web:
prompt: "What happened in tech news today?"Search X/Twitter:
prompt: "What are people saying about the new React release?"
x_search: trueCheck files before asking:
files: ["src/**/*.ts"]License
MIT
Available Tools
2 toolsask_grokA
Ask Grok a question. Grok is great for thinking, planning, architecture, and real-time search via web and X/Twitter. Use web_search for current information from the internet. Use x_search to find and analyze posts on X/Twitter. IMPORTANT: Grok has no context about your conversation or codebase. Always include all relevant context directly in the prompt — file contents, error messages, architecture details, constraints, and goals. The more context you provide, the better Grok's response will be. Do not assume Grok knows anything about the current project. Use the files parameter to automatically include file contents with line numbers — this is preferred over pasting code into the prompt. File paths are resolved relative to the server working directory: /app. Responses include a response_id — pass it back as previous_response_id to continue a conversation without resending context.
Inputs: prompt (required), previous_response_id, files, max_files, +5 more.
check_filesA
Dry-run file resolution. Use this before ask_grok to verify files will resolve correctly and check context size. Uses the same validation as ask_grok — if check_files passes, ask_grok will too. File paths resolve relative to: /app
Inputs: files (required), max_files, max_file_size.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
ask_grok and check_files serve clearly distinct purposes: one is for querying Grok, the other is a dry-run validator for file resolution. No overlap or ambiguity.
Both tool names follow a consistent verb_noun pattern (ask_grok, check_files), using underscores and clear verbs.
Only 2 tools feels thin for a server that provides access to Grok, which could benefit from additional tools for conversation management or specialized searches.
The tool set lacks basic conversational features like retrieving history or managing context, and the promised web_search/x_search capabilities are not exposed as separate tools, limiting functionality.
Maintenance
Related MCP Connectors
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseAqualityBmaintenanceUse XAI's latest api functionalities with Grok MCP. It supports image understanding and generation, live search, latest models and more.2255MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that enables coding agents to search X/Twitter and the web through the local Grok CLI, providing better search results than default Codex or Claude search without requiring an API key.27 npm7MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for xAI Grok API with 19 tools for chat, web and X search, session management, tool chaining, image and video generation, and documentation.2MIT
- AlicenseNot gradedqualityDmaintenanceA 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