x.ai Grok MCP Server
Enables chat completions using x.ai's Grok API with support for multiple Grok models (grok-beta, grok-2-latest, grok-4-latest) and configurable parameters like temperature and max tokens.
README
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-grok
Local Development
git clone https://github.com/darkangelpraha/xai-grok-mcp-server.git
cd xai-grok-mcp-server
npm install
npm run build
npm start
Configuration
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-grok
Local Testing
# Set API key
export XAI_API_KEY="your-api-key-here"
# Run server
npm run dev
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.