x-search-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
x-search-mcp
An MCP server that enables Claude Desktop / Claude Code to search X (Twitter) in real time via the xAI (Grok) API.
Design Philosophy
This server exposes a single, flexible grok_search tool with no hardcoded prompts. The caller (Claude, or any MCP client) crafts the prompt freely — deciding the search strategy, output format, and language. This works well because AI models like Claude can generate optimal prompts for each use case on the fly.
Citations from Grok's search are returned alongside the response text, so the caller can follow up by fetching specific post URLs or source pages for full content.
Related MCP server: Grok MCP Server
Tool
Tool | Purpose |
| Search X and/or the web via Grok. The caller controls everything through the |
Parameters
Parameter | Required | Default | Description |
| Yes | -- | The instruction/query to send to Grok. Include search intent, desired output format, language, constraints — anything. |
| -- |
| Enable X (Twitter) search |
| -- |
| Enable web search |
| -- | -- | Search start date ( |
| -- | today | Search end date ( |
| -- | -- | Limit X search to these handles (max 10, without |
| -- | -- | Exclude these handles from X search (max 10, without |
| -- |
| Enable image understanding in X search results |
| -- |
| Enable video understanding in X search results |
| -- |
| Grok temperature |
Setup
1. Get an xAI API Key
Sign up at https://console.x.ai/ and obtain an API key. Pay-as-you-go pricing (approx. $0.05--0.15 per call). Add credits in advance.
Security: Never commit your API key. Add config files (
claude_desktop_config.json,.mcp.json) to.gitignoreor manage keys via environment variables.
2. Install
git clone https://github.com/Mitachi-H/x-search-mcp.git
cd x-search-mcp
npm install
npm run build3a. Use with Claude Desktop (recommended)
Add the following to claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"x-search": {
"command": "node",
"args": ["/path/to/x-search-mcp/dist/index.js"],
"env": {
"XAI_API_KEY": "xai-xxxxxxxxxxxx"
}
}
}
}Replace
/path/to/with the actual path.
Restart Claude Desktop. Then just say "Search X for ..." in a conversation and the tool is called automatically.
3b. Use with Claude Code
# Add to your project's .mcp.json
cat > .mcp.json << 'EOF'
{
"mcpServers": {
"x-search": {
"command": "node",
"args": ["/path/to/x-search-mcp/dist/index.js"],
"env": {
"XAI_API_KEY": "xai-xxxxxxxxxxxx"
}
}
}
}
EOFTo register as a Claude Code skill, see SKILL.md in the repository root.
Environment Variables
Variable | Required | Default | Description |
| Yes | -- | xAI API key |
| -- |
| API endpoint |
| -- |
| Model to use (grok-4 family recommended for Responses API) |
Usage Examples
Claude crafts the optimal Grok prompt automatically based on your request:
"What's trending about AI agents on X?" — Claude calls
grok_searchwith a prompt asking Grok to find trending AI agent posts with engagement metrics and URLs"Show me @hayattiq's recent posts about MCP" — Claude uses
grok_searchwithallowed_handles: ["hayattiq"]and a prompt tailored for user post search"Research X discourse on Claude Code for an article I'm writing" — Claude crafts a research-oriented prompt with
enable_web_search: truefor comprehensive sourcing"Search X for reactions to the latest OpenAI announcement, in English" — Claude includes language preference directly in the prompt
Workflow: Deep-dive with citation follow-up
Claude calls
grok_searchto find relevant posts and discussionsGrok returns results with citation URLs
Claude can then fetch specific citation URLs (via web search or web fetch) to get full post content or source pages
Claude synthesizes the full-text content into a comprehensive analysis
Model Selection Guide
Model | Speed | Cost | Use Case |
| Fast | Normal | Everyday search (default, recommended) |
| Normal | High | Complex trend analysis (with reasoning) |
| Slow | High | Highest-quality analysis |
Note: The Responses API
x_search/web_searchtools are recommended for use with the grok-4 family.
API
This server uses the xAI Responses API (/v1/responses) with server-side x_search / web_search tools.
The old Chat Completions API search_parameters was removed on Jan 12, 2026, so this is the correct approach.
Architecture
Claude (Desktop / Code)
└─ MCP (stdio)
└─ x-search-mcp (this server)
└─ xAI API (api.x.ai)
└─ Grok searches X in real timeClaude itself cannot search X effectively, but Grok -- built by xAI (the company behind X) -- excels at searching and summarizing X posts. This MCP server acts as a bridge, using Grok as Claude's search layer.
Acknowledgements
HayattiQ/x-research-skills -- Original prompt design inspiration
stat-guy/grok-search-mcp -- Reference MCP server implementation
xAI API Docs -- Official xAI API documentation
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
X/Twitter search, posts, comments, user profiles, user posts/replies and video transcripts.
Grok Bot search and free submissions, with optional paid upgrade links. Not affiliated with xAI.
Live web search and fetch plus Twitter, Reddit, GitHub, Amazon, YouTube, Telegram data. No API keys.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSearch X (formerly Twitter) in real-time from your AI assistant using xAI's Grok API, with no X API account required.1,701 npmMIT
- AlicenseAqualityDmaintenanceEnables real-time search of X.com (Twitter) posts, users, threads, and trends via xAI's Grok API, directly from Claude.54MIT
- FlicenseAqualityDmaintenanceEnables searching X (Twitter) using the xAI Grok API to get summarised answers with citations. Supports filtering by handles, date range, and image/video understanding.12-
- AlicenseAqualityDmaintenanceEnables searching X (Twitter) posts, discussions, trends, and web content via Grok API using natural language.31MIT