Grok-MCP

by merterbak

MCP server for xAI's Grok API with agentic tool calling, image and video generation, vision, and file support. Requires an xAI API key configured via environment variable XAI_API_KEY.

Developer toolsstdioCommunity

Repository-wide counts · Cached 2026-04-18

Overview

The Grok-MCP MCP server is a publicly available project. Review the upstream repository for installation instructions, supported tools, compatibility, permissions, and current maintenance status.

Configuration

Configuration, transport, authentication, and runtime requirements vary by project. Open the repository before connecting and use the smallest set of credentials and permissions required.

Open the Grok-MCP repository to read the latest documentation.

KEEP EXPLORING

Compare source, connection, and authentication details before choosing an implementation.

View the complete category

模型上下文协议服务器

modelcontextprotocol

Community

一组用于模型上下文协议(MCP)的参考实现,展示了对大型语言模型(LLM)工具和数据源的安全且受控的访问方式。

Context7 Platform - Up-to-date Code Docs For Any Prompt

upstash

Community

Context7 MCP server providing up-to-date, version-specific documentation and code examples for libraries, enabling coding agents to fetch accurate docs and code snippets. Requires an API key for higher rate limits, passed via CONTEXT7_API_KEY header.

Playwright MCP

Microsoft Corporation

Community

A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. Enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.

AIHawk

feder-cr

Community

AIHawk is an anti detect browser and web browsing agent, open source, with an MCP server for coding agents: undetected, no captchas, no blocks. It requires an OpenRouter API key for the standalone web UI mode, which can be provided via the --openrouter-key flag or the OPENROUTER_API_KEY environment variable or a .env file in the running directory.

FROM THE SOURCE

Repository README

Build-time snapshot · Retrieved 2026-10-05

View original

Grok-MCP

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

Features

  • Agentic Tool Calling: Web search, X search, code execution, and image generation with multi-step reasoning
  • Multiple Grok Models: Access to latest models such as grok-4.6, grok-4.5, 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, multi-agent support, and a per request service_tier.
  • 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, code execution, and server-side image generation. Generated images are written to images/.

Image and video

  • generate_image — create or edit images with Grok Imagine (multi-reference editing supported). Pass save=true to write the results to images/ instead of returning temporary URLs.
  • 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.