MCP server that exposes Grok Build CLI's built-in web_search as an MCP tool
Project description
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
- 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
- uv (for
uvxusage): 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
web_search
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:
- API key – set
GROK_CODE_XAI_API_KEY(orXAI_API_KEY) in the environment. - OAuth session – if no key is present, the existing
grok loginsession on the machine is used.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_grok_websearch-0.1.2.tar.gz.
File metadata
- Download URL: mcp_grok_websearch-0.1.2.tar.gz
- Upload date:
- Size: 98.7 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac2f30b70f5150a87b070a1eea6f4f0ea394606b2294bf7ef976cbe5352880b9
|
|
| MD5 |
0e0a1dcfe4212512f748f40041f15149
|
|
| BLAKE2b-256 |
761c51214e385de577ad5a75343373047cdec2b92be1e7f44d601c086f65110c
|
File details
Details for the file mcp_grok_websearch-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mcp_grok_websearch-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1578920bb9fc4df16cbc1c50d767555474888b0a0988f5c556d5dd34ccd8dcfd
|
|
| MD5 |
776635a592a696ea6bdf9f6e2e56293e
|
|
| BLAKE2b-256 |
3e8c502a123b744c5b3d39fe2aedb5a091dd2440447215ec45039151bf100d17
|