Prerequisites
Before installing, ensure you have:Node.js 18+
Download from nodejs.org
xAI API key
Get yours at console.x.ai
Claude Desktop
Download from claude.ai/desktop
Git
Install from git-scm.com
Step 1: Obtain xAI API key
Visit xAI Developer Portal
Navigate to console.x.ai and create an account or sign in.
Step 2: Install the server
- Global installation (recommended)
- NPX (no installation)
- Local development
Install globally for system-wide access:This makes the
grok-search-mcp command available globally.Step 3: Verify installation
Test that the installation worked:If you see this help message, your installation is successful!
Step 4: Configure Claude Desktop
- macOS
- Windows
- Linux
Replace
xai-your-actual-api-key-here with your actual xAI API key from Step 1.Step 5: Advanced configuration (optional)
Customize server behavior with additional environment variables:Configuration options
| Variable | Default | Description |
|---|---|---|
XAI_API_KEY | Required | Your xAI API key from console.x.ai |
GROK_TIMEOUT | 30000 | Request timeout in milliseconds |
GROK_MAX_RETRIES | 3 | Maximum retry attempts for failed requests |
Step 6: Restart Claude Desktop
Troubleshooting
Server not appearing in Claude Desktop
Server not appearing in Claude Desktop
Symptoms: Tools don’t show up after restartSolutions:
- Verify the configuration file path is correct for your OS
- Check JSON syntax with a validator
- Ensure Claude Desktop was fully quit and restarted
- Check that Node.js 18+ is installed:
node --version - Test NPX access:
npx grok-search-mcp --help
API key not working
API key not working
Symptoms: “API service is not healthy” errorsSolutions:
- Verify your API key starts with
xai- - Check for extra spaces or quotes around the key
- Ensure the key is active in the xAI Developer Portal
- Try regenerating your API key
Command not found errors
Command not found errors
Symptoms:
npx: command not found or similarSolutions:- Verify Node.js is installed:
node --version - Verify NPM is installed:
npm --version - Update NPM:
npm install -g npm@latest - Reinstall Node.js from nodejs.org
JSON configuration errors
JSON configuration errors
Symptoms: Claude Desktop fails to start or shows errorsSolutions:
- Validate JSON syntax with a validator
- Check for missing commas or brackets
- Ensure proper quote escaping
- Backup and recreate the configuration file
Verification
Test your installation using the health check:If
server_healthy and api_healthy are both true, you’re ready to start searching!Next steps
Quickstart guide
Try your first search and explore the available tools
API reference
Learn about all available tools and parameters