MCP Directory

How to add Grok-MCP to Claude Desktop

MCP server for xAI's Grok API: agentic tool calling, image/video generation, vision, and file support. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.

Last updated June 14, 2026 ยท 39โ˜… ยท stdio ยท apikey

Claude Desktop config for Grok-MCP

git clone https://github.com/merterbak/Grok-MCP.git && cd Grok-MCP && uv venv && uv sync
{
  "mcpServers": {
    "grok-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/Grok-MCP",
        "run",
        "python",
        "main.py"
      ],
      "env": {
        "XAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Setup steps

  1. 1Open Claude Desktop โ†’ Settings โ†’ Developer โ†’ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
  2. 2Paste the Grok-MCP config below under the top-level "mcpServers" key.
  3. 3Fill in any placeholder secrets (API keys, paths) in the snippet.
  4. 4Save the file, then fully quit and reopen Claude Desktop.
  5. 5Open a chat and confirm Grok-MCP's tools appear under the ๐Ÿ”Œ tools menu.

Before you start

  • Python 3.11 or higher
  • xAI API key (from https://console.x.ai)
  • Astral UV package manager

What Grok-MCP can do in Claude Desktop

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.

web_search

Autonomous web research with domain filters and citations.

x_search

Autonomous search over X (Twitter) posts, with handle and date filters.

Security

Requires an xAI API key (XAI_API_KEY) passed via environment. Claude Desktop cannot send uploaded chat images to MCP tools; the README recommends pairing with the official Filesystem MCP so you can reference local image/file paths in chat. Usage incurs xAI API costs (chat, image/video generation, agentic tools).

Grok-MCP + Claude Desktop FAQ

Where is the Claude Desktop config file?

Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the Grok-MCP config there under the "mcpServers" key and restart the client.

Is Grok-MCP safe to use with Claude Desktop?

Requires an xAI API key (XAI_API_KEY) passed via environment. Claude Desktop cannot send uploaded chat images to MCP tools; the README recommends pairing with the official Filesystem MCP so you can reference local image/file paths in chat. Usage incurs xAI API costs (chat, image/video generation, agentic tools).

How do I authenticate?

Set the XAI_API_KEY environment variable in your MCP client config with a key from the xAI console (https://console.x.ai).

Why can't I send an image directly in Claude Desktop chat?

Claude Desktop can't pass uploaded chat images to an MCP tool. The README recommends installing the official Filesystem MCP so you can reference a local file path (e.g. /Users/me/Desktop/image.png) in chat for the vision tools.

How do I install it for Claude Code?

Run from 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

View repo Full Grok-MCP page