Skip to main content

mcp-grok-websearch

An MCP server that exposes Grok Build CLI's built-in web_search as a standard MCP tool. Any MCP-compatible agent (Codex, Claude Desktop, Cursor, etc.) can use it for real-time web search.

Prerequisites

  1. Grok Build CLI installed and authenticated:
    curl -fsSL https://x.ai/cli/install.sh | bash
    grok login   # OAuth, or set GROK_CODE_XAI_API_KEY below
    
  2. uv (for uvx usage): https://docs.astral.sh/uv/

Usage

Run directly with uvx (no install needed)

uvx mcp-grok-websearch

Configure in an MCP-compatible agent

Add to your agent's MCP config (e.g. ~/.codex/config.json, claude_desktop_config.json, etc.):

{
  "mcpServers": {
    "websearch": {
      "command": "uvx",
      "args": ["mcp-grok-websearch"]
    }
  }
}

If you use an API key instead of grok login:

{
  "mcpServers": {
    "websearch": {
      "command": "uvx",
      "args": ["mcp-grok-websearch"],
      "env": {
        "GROK_CODE_XAI_API_KEY": "xai-..."
      }
    }
  }
}

MCP Tool

Search the web in real time using Grok's built-in search capability.

Parameter Type Default Description
query str required Search query
max_results int 5 Number of results (1–20)

Returns: Formatted results, each with Title, URL, and Summary, separated by ---.

Example result:

Title: Model Context Protocol – Anthropic
URL: https://modelcontextprotocol.io
Summary: The official site for MCP, the open standard for connecting AI to external tools and data sources.
---
Title: MCP GitHub Repository
URL: https://github.com/modelcontextprotocol
Summary: Source code and SDKs for the Model Context Protocol.
---

Authentication

The server supports two modes, tried in this order:

  1. API key – set GROK_CODE_XAI_API_KEY (or XAI_API_KEY) in the environment.
  2. OAuth session – if no key is present, the existing grok login session on the machine is used.

License

MIT

Metadata

Release files for mcp-grok-websearch 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-grok-websearch 0.1.2
File Size Uploaded
mcp_grok_websearch-0.1.2.tar.gz 98.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-grok-websearch 0.1.2
File Interpreter ABI Platform
mcp_grok_websearch-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 107.7 kB

Release files / mcp_grok_websearch-0.1.2.tar.gz

Download URL mcp_grok_websearch-0.1.2.tar.gz
Size 98.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac2f30b70f5150a87b070a1eea6f4f0ea394606b2294bf7ef976cbe5352880b9
BLAKE2b-256 checksum
How to use checksums
761c51214e385de577ad5a75343373047cdec2b92be1e7f44d601c086f65110c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mcp_grok_websearch-0.1.2-py3-none-any.whl

Download URL mcp_grok_websearch-0.1.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1578920bb9fc4df16cbc1c50d767555474888b0a0988f5c556d5dd34ccd8dcfd
BLAKE2b-256 checksum
How to use checksums
3e8c502a123b744c5b3d39fe2aedb5a091dd2440447215ec45039151bf100d17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page