Click on "Install 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., "@Enhanced Grok Search MCP ServerProvide a comprehensive news analysis and timeline for the latest AI safety regulations."
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.
Enhanced Grok Search MCP Server
A robust MCP (Model Context Protocol) server that provides comprehensive web search and analysis capabilities using xAI's Grok API.
Features
🔍 Search Capabilities
Web Search: Search general web content using Grok's AI-powered search
News Search: Search for recent news and current events with timeline analysis
Twitter/X Search: Search social media posts with sentiment analysis
Date Range Filtering: Search within specific time periods
📊 Analysis Modes
Basic Mode: Traditional search results with titles, snippets, and URLs
Comprehensive Mode: Rich analysis including:
Detailed timelines of events
Direct quotes with full attribution
Multiple perspectives and viewpoints
Historical context and implications
Fact verification status
Key findings categorization
🛡️ Reliability Features
Retry Logic: Automatic retry with exponential backoff for failed requests
Request Timeouts: Configurable timeouts to prevent hanging
Graceful Error Handling: Comprehensive error responses with detailed context
Health Monitoring: Built-in health checks and performance metrics
Caching: Intelligent caching for comprehensive analyses
Input Validation: Enhanced sanitization and validation of all inputs
🔧 Technical Features
NPX Compatible: Easy installation and usage via NPX
MCP Protocol: Full compatibility with MCP clients like Claude Desktop
Structured Logging: Comprehensive logging for debugging and monitoring
Performance Metrics: Request tracking and success rate monitoring
Installation
Simple 3-Step Process
Verify Installation
Test that the installation worked:
Success indicator: If you see Grok Search MCP Server running on stdio, your installation is ready!
Alternative: NPX Usage
Setup
1. Get Your xAI API Key
Visit the xAI Developer Portal
Create an account or sign in
Generate your API key
Copy the API key for the next step
2. Configure Environment Variable
Set your xAI API key as an environment variable:
Or create a .env file in your project:
3. Configure Claude Desktop
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Available Tools
grok_search
General-purpose search tool with configurable search types and analysis modes.
Parameters:
query(required): The search querysearch_type(optional): "web", "news", or "general" (default: "web")analysis_mode(optional): "basic" or "comprehensive" (default: "basic")max_results(optional): Maximum number of results (1-20, default: 10)from_date(optional): Start date in YYYY-MM-DD formatto_date(optional): End date in YYYY-MM-DD format
Basic Mode Example:
Comprehensive Mode Example:
grok_web_search
Search general web content with comprehensive analysis support.
Parameters:
query(required): The web search queryanalysis_mode(optional): "basic" or "comprehensive" (default: "basic")max_results(optional): Maximum number of results (1-20, default: 10)from_date(optional): Start date in YYYY-MM-DD formatto_date(optional): End date in YYYY-MM-DD format
grok_news_search
Search for recent news with comprehensive timeline and context analysis.
Parameters:
query(required): The news search queryanalysis_mode(optional): "basic" or "comprehensive" (default: "basic")max_results(optional): Maximum number of results (1-20, default: 10)from_date(optional): Start date in YYYY-MM-DD formatto_date(optional): End date in YYYY-MM-DD format
grok_twitter
Search Twitter/X posts with social media analysis.
Parameters:
query(required): The search query for tweetshandles(optional): Array of Twitter handles to filter by (without @ symbol)analysis_mode(optional): "basic" or "comprehensive" (default: "basic")max_results(optional): Maximum number of results (1-20, default: 10)from_date(optional): Start date in YYYY-MM-DD formatto_date(optional): End date in YYYY-MM-DD format
health_check
Check server health and API connectivity status.
Parameters: None
Response Formats
Basic Mode Response
Comprehensive Mode Response
Configuration
Environment Variables
XAI_API_KEY(required): Your xAI API keyGROK_TIMEOUT(optional): Request timeout in milliseconds (default: 30000)GROK_MAX_RETRIES(optional): Maximum retry attempts (default: 3)
Claude Desktop Configuration Example
Error Handling
The server includes comprehensive error handling with standardized error responses:
Invalid API Key: Graceful degradation with clear error messages
Empty Query: Enhanced validation with detailed feedback
API Rate Limits: Automatic retry with exponential backoff
Network Issues: Connection error handling with retry logic
Timeout Issues: Configurable timeouts with clear error reporting
JSON Parsing: Multiple parsing strategies with fallback handling
Error Response Format
Performance Features
Caching
Comprehensive Analysis Caching: Intelligent caching for expensive comprehensive analyses
TTL Management: Configurable cache expiration (default: 30 minutes)
Memory Management: Automatic cache size limits to prevent memory issues
Monitoring
Health Checks: Built-in health monitoring with detailed status reporting
Performance Metrics: Request tracking, success rates, and timing analysis
Structured Logging: JSON-formatted logs for easy parsing and monitoring
Reliability
Retry Logic: Exponential backoff for transient failures
Circuit Breaking: Graceful degradation when API is unavailable
Input Sanitization: Comprehensive input validation and cleaning
Error Recovery: Multiple JSON parsing strategies for robust response handling
Troubleshooting
Common Issues
"API service is not available"
Check if XAI_API_KEY is set correctly
Verify your API key is valid and active
Use the health_check tool to diagnose API connectivity
"Request timeout after Xms"
Increase GROK_TIMEOUT environment variable
Check your internet connection
Consider using basic mode for faster responses
"Search query too long"
Queries are limited to 1000 characters
Break down complex queries into smaller parts
Empty or poor results in comprehensive mode
Try different query phrasings
Use basic mode for simple searches
Check if the topic has sufficient recent coverage
Health Monitoring
Use the health_check tool to get detailed status:
Example health response:
Debugging
The server provides structured logging. Monitor stderr output for detailed logs:
Testing
Run the test suite to verify functionality:
Usage Examples
Basic News Search
Comprehensive Analysis
Twitter Analysis with Specific Handles
Date-Filtered Web Search
API Limits
Rate limits depend on your xAI API plan
Monitor usage through the xAI Developer Portal
Comprehensive mode uses more tokens than basic mode
Caching helps reduce API usage for repeated queries
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Support
For issues and feature requests, please create an issue in the repository.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Update documentation
Submit a pull request
Changelog
Version 2.0.0 (Enhanced)
✅ Added comprehensive analysis mode with rich context
✅ Implemented timeline extraction and direct quotes
✅ Added multiple perspectives analysis
✅ Enhanced error handling with retry logic
✅ Added intelligent caching for comprehensive analyses
✅ Implemented health monitoring and performance metrics
✅ Added structured logging system
✅ Enhanced input validation and sanitization
✅ Added configurable timeouts and retry settings
✅ Improved JSON parsing with multiple fallback strategies