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 Serverexplain 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).
| Name | Required | Description | Default |
|---|---|---|---|
| messages | Yes | Array of chat messages. Each message should have 'role' (system/user/assistant) and 'content' (string). | |
| model | No | The Grok model to use. Options: grok-beta, grok-2-latest, grok-4-latest | grok-4-latest |
| temperature | No | Sampling temperature between 0 and 2. Higher values make output more random. | |
| max_tokens | No | Maximum number of tokens to generate |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It mentions the API target and supported features but fails to disclose critical behavioral traits: whether this is a read/write operation, authentication needs, rate limits, response format, error handling, or costs. For an API call tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose and key features. It avoids redundancy and wastes no words, though it could be slightly more structured for clarity. Every element earns its place, making it appropriately concise for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (API interaction with 4 parameters) and lack of annotations or output schema, the description is incomplete. It covers basic functionality but misses essential context: no information on return values, error cases, authentication, or operational constraints. This leaves the agent under-informed for safe and effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, providing detailed documentation for all 4 parameters. The description adds minimal value beyond the schema, only reiterating supported models and message roles without new syntax or format details. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Send a chat completion request') and target resource ('to x.ai Grok API'), with specific mention of supported message types and models. It distinguishes this as an API interaction tool, though without sibling tools, differentiation isn't applicable. The purpose is specific but could be more precise about the exact function beyond 'send a request'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or contextual constraints. It mentions supported features but lacks explicit usage scenarios, exclusions, or comparisons. Without sibling tools, this is less critical, but still a gap for effective agent decision-making.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
chat_completion
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
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Drop-in proxy keeping OpenAI Assistants API calls working past the August 26, 2026 sunset, plus a Th
Swift AI: Access a wide range of AI modelsโก, including OpenAI ๐ค,DeepSeek ๐, Claude ๐ง , Gemini ๐, and.
Proxy Gemini (Vertex AI) completions wrapped in OpenTelemetry trace spans; returns the answer plus t