Minimal MCP server for Grok-based web search and Tavily-backed fetch/map tools.
web_search: Ask Grok to search the web and return the answer body.get_sources: Read the cached source list from a previousweb_searchcall.web_fetch: Fetch a page through Tavily and return Markdown content.web_map: Map a site through Tavily and return discovered URLs.get_config_info: Show effective configuration and test the Grok connection.switch_model: Validate and persist the default Grok model.describe_url: Ask Grok to read one page and return a title plus extracts.rank_sources: Ask Grok to reorder numbered sources by relevance.
- Python 3.12+
uv- An OpenAI-compatible Grok endpoint
Tavily is optional. Without Tavily, web_fetch and web_map will not work.
Configure Grok directly. Add Tavily if you want web_fetch and web_map:
claude mcp add-json grok-search --scope user '{
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/GuDaStudio/GrokSearch",
"grok-search"
],
"env": {
"GROK_API_URL": "https://your-api-endpoint.com/v1",
"GROK_API_KEY": "your-grok-api-key",
"TAVILY_API_URL": "https://api.tavily.com",
"TAVILY_API_KEY": "your-tavily-api-key"
}
}'uv sync --dev
uv run grok-searchThe server runs over stdio.
| Variable | Required | Default | Notes |
|---|---|---|---|
GROK_API_URL |
Yes | - | Must be OpenAI-compatible. |
GROK_API_KEY |
Yes | - | Used for Grok requests. |
GROK_MODEL |
No | grok-4.20-beta |
Default model. |
TAVILY_API_URL |
No | https://api.tavily.com |
Used by web_fetch and web_map. Tavily Hikari /mcp URLs are normalized to the same host's /api/tavily HTTP facade. |
TAVILY_API_KEY |
No | - | Required only for Tavily-backed tools. |
| Variable | Default |
|---|---|
TAVILY_ENABLED |
true |
GROK_DEBUG |
false |
GROK_LOG_LEVEL |
INFO |
GROK_LOG_DIR |
logs |
GROK_RETRY_MAX_ATTEMPTS |
3 |
GROK_RETRY_MULTIPLIER |
1 |
GROK_RETRY_MAX_WAIT |
10 |
Input:
queryplatform(optional)model(optional)extra_sources(optional)
Output:
session_idcontentsources_count
Input:
session_id
Output:
session_idsources_countsources
Input:
url
Output:
- Markdown page content
Input:
urlinstructions(optional)max_depth(optional)max_breadth(optional)limit(optional)timeout(optional)
Output:
- JSON string with discovered URLs
Output:
- JSON string with effective config and connection test results
Input:
model
Output:
- JSON string with validation and persistence result
Input:
urlmodel(optional)
Output:
urltitleextracts
Input:
querysources_texttotalmodel(optional)
Output:
queryordertotal
switch_modelstores the selected model in~/.config/grok-search/config.json.web_searchcaches sources in memory and returns them later throughget_sources.- Time-sensitive queries may include local time context automatically.