x.ai Grok MCP Server
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., "@x.ai Grok MCP Server explain quantum computing in simple terms with temperature 0.5"
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.
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
npx -y mcp-server-xai-grokLocal Development
git clone https://github.com/darkangelpraha/xai-grok-mcp-server.git
cd xai-grok-mcp-server
npm install
npm run build
npm startConfiguration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"xai-grok": {
"command": "/usr/local/bin/npx",
"args": ["-y", "mcp-server-xai-grok"],
"env": {
"XAI_API_KEY": "op://AI/API Credentials | Grok Business/API KEY"
},
"description": "x.ai Grok API MCP server for chat completions"
}
}
}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:
{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello, how are you?"
}
],
"model": "grok-4-latest",
"temperature": 0.7
}Testing
With MCP Inspector
npx -y @modelcontextprotocol/inspector npx -y mcp-server-xai-grokLocal Testing
# Set API key
export XAI_API_KEY="your-api-key-here"
# Run server
npm run devRequirements
Node.js 20.0.0 or higher
x.ai API key with credits/licenses
License
MIT
Author
darkangelpraha
Repository
Available Tools
1 toolchat_completionC
Send a chat completion request to x.ai Grok API. Supports system messages, user messages, and various models (grok-beta, grok-2-latest, grok-4-latest).
Inputs: messages (required), model, temperature, max_tokens.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined as sending chat completion requests to the x.ai Grok API, making it distinct by default.
The single tool name 'chat_completion' follows a clear and consistent verb_noun pattern. Since there are no other tools to compare against, there is no inconsistency in naming conventions.
A single tool is too few for a server named 'x.ai Grok MCP Server', which suggests a broader scope for interacting with the Grok API. This minimal toolset feels thin and limits functionality, as it only covers chat completions without obvious support for other potential operations like model listing or configuration.
The tool surface is severely incomplete for the inferred domain of an AI chat API. While chat completions are a core function, there are significant gaps such as missing tools for managing models, handling conversations, or performing other API interactions, which could lead to agent failures in broader tasks.
Related MCP Connectors
Pay-per-call chat on GPT-6.1, Claude, Gemini and Grok over x402. No API key; a failed call is free.
Pay-per-call chat on GPT-6.1, Claude, Gemini and Grok over x402. No API key; a failed call is free.
Search, fetch and submit 100+ ready-to-use Grok Bot prompts (Chinese). OAuth, free.
Chat with any LLM, generate images, browse models and check your usage and costs.