Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

MCP server for xAI's Grok API with agentic tool calling, image generation, vision, and file support.

README.md

Grok-MCP

MCP server for xAI’s Grok API with Web/X search, vision, image/video generation and file support.

<a href="https://glama.ai/mcp/servers/@merterbak/Grok-MCP"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@merterbak/Grok-MCP/badge" /> </a>

Features

  • Agentic Tool Calling: Web search, X search, and code execution with multi-step reasoning
  • Multiple Grok Models: Access to latest models such as grok-4.5, grok-4.3, grok-build-0.1 and more
  • Image and Video Generation: Create images and videos using Grok Imagine
  • Vision Capabilities: Analyze images with Grok's vision models
  • Files API: Upload, manage, and chat with documents
  • Stateful Conversations: Maintain conversation context as id across multiple requests
  • Local Chat History: Option to save persistent client side chat history as JSON files in chats/

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/merterbak/Grok-MCP.git
cd Grok-MCP
  1. Create a venv environment:
uv venv
source .venv/bin/activate # macOS/Linux or .venv\Scripts\activate on Windows
  1. Install dependencies:
uv sync

Configuration

Claude Desktop Integration

Add this to your Claude Desktop configuration file:

{
  "mcpServers": {
    "grok": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/Grok-MCP",
        "run",
        "python",
        "main.py"
      ],
      "env": {
        "XAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Claude Code Integration

Run this command from inside the project directory:

claude mcp add grok-mcp -e XAI_API_KEY=your_api_key_here -- uv run --directory /path/to/Grok-MCP python main.py

Or if you have a .env file with your key:

 claude mcp add grok-mcp -- uv run --directory /path/to/Grok-MCP python main.py

Verify it's registered:

claude mcp list

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.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/<your-username>/Desktop",
        "/Users/<your-username>/Downloads"
      ]
    }
  }
}

---

For stdio:

uv run python main.py

Docker:

docker compose up --build

Mcp Inspector:

mcp dev main.py

Available Tools

Each tool has a full docstring in src/server.py with its arguments and return format. MCP client surfaces those directly, so this list is just a quick map of what's available.

Note: For using images and files, you must provide paths to chat. See Filesystem MCP (Optional) for setup.

Chat and reasoning

  • chat — standard chat completion with optional persistent history and multi-agent support.
  • chat_with_vision — analyze local or remote images with a Grok vision model.
  • chat_with_files — chat grounded on previously uploaded documents.
  • stateful_chat — continue a server-side stored conversation via response_id.
  • retrieve_stateful_response — fetch a stored response by ID.
  • delete_stateful_response — delete a stored response by ID.

Agentic tools

  • web_search — autonomous web research with domain filters and citations.
  • x_search — autonomous search over X (Twitter) posts, with handle and date filters.
  • code_executor — solve tasks by running Python in a sandbox.
  • grok_agent — unified agent that mixes files, images, web search, X search, and code execution.

Image and video

  • generate_image — create or edit images with Grok Imagine (multi-reference editing supported).
  • generate_video — text-to-video, image-to-video, or video editing with Grok Imagine.
  • extend_video — extend an existing generated video with a follow-up prompt.

Files

  • upload_file — upload a local document.
  • list_files — list uploaded files with sorting.
  • get_file — fetch file metadata by ID.
  • get_file_content — download file content as text.
  • delete_file — delete a file by ID.

Local chat history

  • list_chat_sessions — list saved sessions in chats/.
  • get_chat_history — get a session's full transcript.
  • clear_chat_history — delete a session's local history file.

Models

  • list_models — list all Grok language and image models with live pricing.

License

This project is open source and available under the MIT License.

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Files & Docs servers.