Grok
MCP server for xAI's Grok API with agentic tool calling, image and video generation, vision, and file support.
claude mcp add --transport stdio merterbak-grok-mcp uv run --directory /path/to/Grok-MCP python -m src.server \ --env XAI_API_KEY="your_api_key_here"
How to use
Grok-MCP is an MCP server that provides access to xAI's Grok API with agentic tool calling, image and video generation, vision capabilities, and a Files API for documents. The server exposes a unified interface for chatting with Grok models, performing web and X searches, running code, generating images and videos, and analyzing media. Use the grok toolset to list available models, chat with Grok, perform vision tasks on images, generate media, and manage conversations across requests. When integrated with Claude Desktop or Claude Code, you can run Grok locally via UV as shown in the installation/configuration sections and then issue requests to Grok through your MCP UI or Claude workflows.
How to install
Prerequisites:
- Python 3.11 or higher
- xAI API key (Get one here: https://console.x.ai)
- Astral UV (uv) installed and available in PATH
Steps:
- Clone the repository and enter the project:
git clone https://github.com/merterbak/Grok-MCP.git
cd Grok-MCP
- Create and activate a virtual environment:
uv venv
source .venv/bin/activate # macOS/Linux
# On Windows use: .venv\Scripts\activate
- Install dependencies (UV sync for Python project):
uv sync
-
Ensure your XAI API key is available (environment variable or .env file).
-
Run the MCP server using UV (example command; adjust path to your project):
uv run --directory /path/to/Grok-MCP python -m src.server
Prerequisites recap:
- Python 3.11+
- UV installed and in PATH
- xAI API key
- The Grok-MCP project checked out and the correct path set in the run command
Additional notes
Tips and common issues:
- Ensure XAI_API_KEY is set in the environment where the server runs. Without it Grok will not authenticate.
- If using Claude Desktop integration, follow the provided Claude Desktop and Claude Code integration snippets to register the MCP with Claude.
- The Files API option is optional and may require the Filesystem MCP server for local file access. When using Filesystem MCP, provide file paths as needed from chat.
- For video or image generation, provide proper prompts and, if needed, image_paths or image_urls for vision-related tasks.
- If you encounter port or binding issues, verify UV is properly installed and that the path to the Grok-MCP project is correct in the run command.
Related MCP Servers
web-eval-agent
An MCP server that autonomously evaluates web applications.
mcp-neo4j
Neo4j Labs Model Context Protocol servers
Gitingest
mcp server for gitingest
zotero
Model Context Protocol (MCP) server for the Zotero API, in Python
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
unitree-go2
The Unitree Go2 MCP Server is a server built on the MCP that enables users to control the Unitree Go2 robot using natural language commands interpreted by a LLM.