Grok MCP is an MCP server that provides comprehensive access to xAI's Grok API capabilities. You can access multiple Grok models (Grok-4, Grok-4-Fast, Grok-3-Mini, and more) for chat completion with extensive customization options including temperature, max tokens, and system prompts. The server supports reasoning models that provide detailed reasoning alongside responses, image generation from text descriptions, and vision analysis of images using natural language queries (supporting both local files and URLs). It offers live web search with real-time results, source citations, date range filters, country localization, and custom RSS feed integration from news, web, X (Twitter), and RSS sources. You can maintain stateful conversations with context preserved across multiple requests, conversation history management, and the ability to retrieve and delete stored responses (kept for 30 days). Additional features include model discovery to list all available Grok models with their details and creation information.
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"
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 for xAI's Grok API with agentic tool calling, image generation, vision, and reasoning models.
Features
Agentic Tool Calling: Web search, X search, and code execution with multi-step reasoning
Multiple Grok Models: Access to Grok-4.1-Fast-Reasoning, Grok-4.1-Fast-Non-Reasoning, Grok-4-Fast, Grok-3-Mini, and more
Image Generation: Create images using Grok's image generation model
Vision Capabilities: Analyze images with Grok's vision models
Reasoning Models: Advanced reasoning with extended thinking models (Grok-4.1-Fast-Reasoning, Grok-3-Mini, Grok-4)
Stateful Conversations: Use this newly released feature to maintain conversation context as id across multiple requests
Related MCP server: Zen MCP Server
Prerequisites
Python 3.11 or higher
xAI API key (Get one here)
Installation
Clone the repository:
Create a venv environment:
Install dependencies:
Configuration
Claude Desktop Integration
Add this to your Claude Desktop configuration file:
Filesystem MCP (Optional)
Claude Desktop can't send uploaded images in the chat to an MCP tool. The easiest way to give access to files directly from your computer is official Filesystem MCP server. After setting it up you’ll be able to just write the image’s file path (such as /Users/mert/Desktop/image.png) in chat and Claude can use it with any vision chat tool.
For stdio:
Docker:
Mcp Inspector:
Available Tools
Note: For using images and files, you must provide paths to chat. See Filesystem MCP (Optional) for setup.
list_models
List all available Grok models.
chat
Standard chat completion.
Parameter | Type | Default | Description |
| str | required | Your message |
| str | grok-4 | Model to use |
| str | None | System instruction |
| bool | False | Enable conversation history |
chat_with_vision
Analyze images with text.
Parameter | Type | Default | Description |
| str | required | Question about the image |
| List[str] | None | Local image file paths |
| List[str] | None | Image URLs |
| str | auto | auto, low, or high |
| str | grok-4 | Vision model |
Returns: Content + usage with prompt_image_tokens
chat_with_reasoning
Get detailed reasoning with the response.
Parameter | Type | Default | Description |
| str | required | Your question |
| str | grok-3-mini | Reasoning model |
| str | None | low or high |
Returns: Content, reasoning_content, usage (with reasoning_tokens)
generate_image
Create images from text.
Parameter | Type | Default | Description |
| str | required | Image description |
| int | 1 | Number of images |
| str | url | url or b64_json |
| str | grok-2-image-1212 | Image model |
web_search
Agentic web search with autonomous research.
Parameter | Type | Default | Description |
| str | required | Search query |
| str | grok-4-1-fast | Model |
| List[str] | None | Restrict to domains (max 5) |
| List[str] | None | Exclude domains (max 5) |
| bool | False | Analyze images in results |
| bool | False | Embed citations in text |
| int | None | Limit reasoning turns |
Returns: Content, citations, tool_calls, usage
x_search
Agentic X (Twitter) search.
Parameter | Type | Default | Description |
| str | required | Search query |
| str | grok-4-1-fast | Model |
| List[str] | None | Only these handles (max 10) |
| List[str] | None | Exclude handles (max 10) |
| str | None | Start date (DD-MM-YYYY) |
| str | None | End date (DD-MM-YYYY) |
| bool | False | Analyze images |
| bool | False | Analyze videos |
| bool | False | Embed citations |
| int | None | Limit turns |
Returns: Content, citations, tool_calls, usage
grok_agent
Unified agent combining files, images, and all agentic tools (web search, X search, code execution).
Parameter | Type | Default | Description |
| str | required | Your query |
| List[str] | None | Uploaded file IDs to search |
| List[str] | None | Image URLs to analyze |
| List[str] | None | Local image paths |
| bool | False | Enable web search |
| bool | False | Enable X search |
| bool | False | Enable code execution |
+ all web_search and x_search params |
Returns: Content, citations, tool_calls, code_outputs, uploaded_file_ids, usage
code_executor
Execute Python code for calculations and analysis.
Parameter | Type | Default | Description |
| str | required | Task description |
| str | grok-4-1-fast | Model |
| int | None | Limit turns |
Returns: Content, tool_calls, code_outputs, usage
stateful_chat
Maintain conversation state across requests.
Parameter | Type | Default | Description |
| str | required | Your message |
| str | None | Previous response ID |
| str | grok-4 | Model |
| str | None | System instruction |
Returns: Content, response_id, usage
retrieve_stateful_response
Retrieve a stored conversation.
delete_stateful_response
Delete a stored conversation.
upload_file
Upload a document (max 48 MB).
Parameter | Type | Default | Description |
| str | required | Local file path |
Supported formats: .txt, .md, .py, .js, .csv, .json, .pdf, and more
list_files
List uploaded files with sorting.
Parameter | Type | Default | Description |
| int | 100 | Max files to return |
| str | desc | asc or desc |
| str | created_at | created_at, filename, or size |
get_file
Get file metadata by ID.
get_file_content
Download file content by ID.
Parameter | Type | Default | Description |
| str | required | File ID |
| int | 500000 | Max bytes to return |
delete_file
Delete a file by ID.
chat_with_files
Chat with uploaded documents using agentic document search.
Parameter | Type | Default | Description |
| str | required | Question about docs |
| List[str] | required | File IDs to search |
| str | grok-4-1-fast | Model |
| str | None | System instruction |
Returns: Content, citations, usage
License
This project is open source and available under the MIT License.