grok-search-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@grok-search-mcpsearch X for recent posts about AI agents"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
grok-search-mcp
MCP server that brings Grok CLI web and X/Twitter search to Codex and Claude Code.
This project exists to give Codex and Claude Code a better search lane when
their built-in search experience is not enough. Grok's search, especially for
X/Twitter content, is often noticeably better than what these coding agents can
reach on their own. grok-search-mcp exposes that advantage through a small,
isolated MCP server, so agents can ask Grok for web or X search results without
turning Grok into a general chat dependency.
This project is intentionally narrow:
no xAI API key
no API credits
no image or video tools
no generic Grok chat tool
only web search and X/Twitter search through
grok
The server runs grok with an isolated HOME, so it does not load your normal
Cursor/Claude/Grok user-level MCP servers, hooks, or skills.
Tools
Tool | Purpose |
| Search X/Twitter through Grok CLI runtime search tools |
| Search the web through Grok CLI runtime web search |
Both tools return a JSON string with this shape:
{
"summary": "short summary",
"items": [],
"urls": [],
"rawText": "raw Grok answer",
"diagnostics": {
"mode": "x",
"parseOk": true,
"model": "default",
"isolatedHome": "/Users/me/.grok-search-mcp",
"warnings": []
}
}If Grok does not return parseable JSON, the server keeps the raw answer and sets
diagnostics.parseOk=false.
Related MCP server: grok-build-plugin
Requirements
Node.js 20+
The official Grok CLI installed
A Grok CLI account/subscription that can use search
Install Grok CLI if needed:
curl -fsSL https://x.ai/cli/install.sh | bashOne-time login
The MCP server uses a dedicated profile home, defaulting to
~/.grok-search-mcp. Log in once for that isolated profile:
GROK_BIN="$HOME/.grok/bin/grok" \
GROK_SEARCH_MCP_HOME="$HOME/.grok-search-mcp" \
npx -y github:OWNER/grok-search-mcp loginReplace OWNER with the GitHub account or organization hosting the repository.
You do not need to log in for every search. Run this again only if the isolated profile token expires or is revoked.
Check the setup:
GROK_BIN="$HOME/.grok/bin/grok" \
GROK_SEARCH_MCP_HOME="$HOME/.grok-search-mcp" \
npx -y github:OWNER/grok-search-mcp doctordoctor should report:
{
"ok": true,
"authenticated": true,
"isolation": {
"hooks": 0,
"skills": 0,
"mcpServers": 0
}
}Client setup
Codex
Add this to ~/.codex/config.toml:
[mcp_servers.grok_search]
command = "npx"
args = ["-y", "github:OWNER/grok-search-mcp"]
enabled_tools = ["grok_x_search", "grok_web_search"]
default_tools_approval_mode = "auto"
startup_timeout_sec = 120
tool_timeout_sec = 240
[mcp_servers.grok_search.env]
GROK_BIN = "/absolute/path/to/grok"
GROK_SEARCH_MCP_HOME = "/absolute/path/to/.grok-search-mcp"
NPM_CONFIG_REGISTRY = "https://registry.npmjs.org"Restart Codex after editing MCP config.
Claude Code
Add the MCP server with Claude Code's CLI:
claude mcp add --scope user --transport stdio grok-search \
--env GROK_BIN=$HOME/.grok/bin/grok \
--env GROK_SEARCH_MCP_HOME=$HOME/.grok-search-mcp \
--env NPM_CONFIG_REGISTRY=https://registry.npmjs.org \
-- npx -y github:OWNER/grok-search-mcpCheck the registration:
claude mcp listExample prompts:
Use grok_search.grok_x_search to search X for recent @grok posts about Grok CLI.Use grok_search.grok_web_search to search docs.x.ai for Grok Build headless scripting.Environment
Variable | Default | Purpose |
|
| Path to the Grok CLI binary |
|
| Isolated profile home |
| Grok CLI default | Optional Grok CLI model override |
|
| Per-call timeout |
|
| Max Grok turns per search |
The server sets these for the Grok subprocess:
HOME=$GROK_SEARCH_MCP_HOMEXDG_CONFIG_HOME=$GROK_SEARCH_MCP_HOME/.configXDG_CACHE_HOME=$GROK_SEARCH_MCP_HOME/.cacheXDG_DATA_HOME=$GROK_SEARCH_MCP_HOME/.local/share
It also runs Grok from a temporary empty working directory instead of your repo.
Local development
npm install
npm test
npm run typecheck
npm run buildIntegration tests are skipped by default because they require a logged-in isolated Grok profile:
RUN_GROK_INTEGRATION=1 npm run test:integrationNotes
grok_x_search relies on Grok CLI agent runtime behavior. It does not call the
public xAI API x_search tool, so it avoids API billing but cannot promise API
level filtering or schemas.
This server cannot be deployed
Maintenance
Related MCP Connectors
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP — built for coding agents.
Your agent needs the open web — searched by more than one engine, and read as clean markdown rather than raw HTML. **What you can ask for** • "Search this question with two providers and tell me where they disagree." • "Scrape these 40 URLs into markdown, in one batch." • "Crawl this documentation site and give me every page." • "Do deep research on this topic and cite the sources." • "Find the academic papers behind this claim." **How to use it** Point any MCP client at https://mcp.aisa.one/search/mcp and sign in with OAuth — there is no key to create or paste. 30 tools across several independent providers: Tavily and Exa search, answers, contents and agent runs; Firecrawl scrape, batch scrape, crawl, map and search; Perplexity Sonar, Sonar Pro, reasoning and deep research; Oxylabs AI search and LLM jobs; OpenAI and Anthropic web search; and scholarly search. **Why this rather than the source** Several independent indexes behind one account, because one engine's blind spot is not visible from inside it. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the page here, then ask the same agent who links to it or how much traffic it gets — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/seo-serp/mcp for the Google results page itself, https://mcp.aisa.one/seo-serp-other-engines/mcp for Bing, Baidu and Naver.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that wraps the xAI Grok API, allowing Claude and other AI agents to delegate thinking, planning, and real-time search tasks to Grok. It provides a single tool with options for different use cases including web search, Twitter/X search, and multi-agent reasoning.217 npmMIT
- AlicenseNot gradedqualityBmaintenanceLive X (Twitter) and web search for any coding agent through your existing Grok subscription. Exposes a grok_search MCP tool, so no X API key or X developer account is needed.21 npm28Apache 2.0
- AlicenseAqualityDmaintenanceMCP server that bridges OpenAI's Agents SDK with Claude Code, enabling web search, file search, and computer use capabilities directly in your development environment.29 npm1MIT
- AlicenseAqualityBmaintenanceMCP server for live X/Twitter and web search, driven by your locally logged-in Grok CLI and leveraging your X Premium or SuperGrok subscription quota.31MIT