x.ai Grok MCP Server
Model Context Protocol (MCP) server for interacting with x.ai Grok API.
Features
Chat completions via x.ai Grok API
Support for multiple Grok models (grok-beta, grok-2-latest, grok-4-latest)
System and user message support
Configurable temperature and max tokens
Secure API key management via 1Password CLI
Installation
Via npm
Local Development
Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Environment Variables
XAI_API_KEY(required): Your x.ai API key. Use 1Password CLI reference:op://AI/API Credentials | Grok Business/API KEY
Usage
Available Tools
chat_completion
Send a chat completion request to x.ai Grok API.
Parameters:
messages(required): Array of chat messages withroleandcontentmodel(optional): Model to use (grok-beta,grok-2-latest,grok-4-latest). Default:grok-4-latesttemperature(optional): Sampling temperature (0-2). Default: 1.0max_tokens(optional): Maximum tokens to generate
Example:
Testing
With MCP Inspector
Local Testing
Requirements
Node.js 20.0.0 or higher
x.ai API key with credits/licenses
License
MIT
Author
darkangelpraha
Repository
https://github.com/darkangelpraha/xai-grok-mcp-server