
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
grok-code-mcp-server
Advanced tools
MCP server for xAI's grok-code-fast-1 model - Expert coding assistant with 256K context
Expert coding assistant powered by xAI's grok-code-fast-1 model
npm install -g grok-code-mcp-server
npm install -g github:yourusername/grok-code-mcp-server
git clone https://github.com/yourusername/grok-code-mcp-server.git
cd grok-code-mcp-server
npm install
npm run build
npm link
Get your xAI API key from x.ai/api
Add to your Claude Desktop or compatible MCP client configuration:
claude_desktop_config.json)Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"grok-code": {
"command": "npx",
"args": ["-y", "grok-code-mcp-server"],
"env": {
"XAI_API_KEY": "your-xai-api-key-here"
}
}
}
}
.mcp.json in your project{
"mcpServers": {
"grok-code": {
"command": "npx",
"args": ["-y", "grok-code-mcp-server"],
"env": {
"XAI_API_KEY": "your-xai-api-key-here"
},
"timeout": 45000,
"autoApprove": [
"grok_generate_code",
"grok_refactor_code",
"grok_analyze_code"
]
}
}
}
| Variable | Description | Default |
|---|---|---|
XAI_API_KEY | Your xAI API key (required) | - |
XAI_API_URL | API endpoint URL | https://api.x.ai/v1/chat/completions |
XAI_TIMEOUT | Request timeout in ms | 30000 |
grok_generate_codeGenerate production-ready code with tests and documentation.
Parameters:
task (required): Description of code to generatelanguage: Programming language (typescript, python, go, etc.)framework: Framework to use (React, FastAPI, Next.js, etc.)context: Additional context or requirementsincludeTests: Generate unit tests (default: false)includeComments: Include helpful comments (default: true)style: Coding style preferencesExample:
{
"tool": "grok_generate_code",
"arguments": {
"task": "Create a React hook for managing localStorage",
"language": "typescript",
"framework": "React",
"includeTests": true
}
}
grok_refactor_codeRefactor existing code for better quality and maintainability.
Parameters:
code (required): Code to refactorgoal (required): Refactoring goallanguage: Programming languagepreserveBehavior: Ensure behavior remains unchanged (default: true)targetPatterns: Design patterns to applygrok_analyze_codeAnalyze code for bugs, performance issues, and quality.
Parameters:
code (required): Code to analyzeaspects: Areas to analyze (performance, security, maintainability, bugs, style, complexity)language: Programming languagegrok_review_prReview pull request changes with detailed feedback.
Parameters:
diff (required): Git diff to reviewcontext: PR descriptionfocusAreas: Specific areas to focus onstandards: Coding standards to checkgrok_explain_codeExplain code functionality with adjustable complexity.
Parameters:
code (required): Code to explaintargetAudience: Complexity level (beginner, intermediate, expert)focusOn: Specific aspects to focus ongrok_debug_codeDebug code and identify issues with fixes.
Parameters:
code (required): Code with bugserror: Error messageexpectedBehavior: What the code should dolanguage: Programming languagegrok_optimize_codeOptimize code for performance or readability.
Parameters:
code (required): Code to optimizetargetMetric: What to optimize (speed, memory, readability, all)constraints: Constraints to maintain// Using with Claude
"Can you use grok to generate a TypeScript function that validates email addresses with comprehensive tests?"
// Direct tool call
{
"tool": "grok_generate_code",
"arguments": {
"task": "Create a function to validate email addresses",
"language": "typescript",
"includeTests": true,
"includeComments": true
}
}
{
"tool": "grok_refactor_code",
"arguments": {
"code": "// your legacy code here",
"goal": "Convert to modern async/await pattern",
"language": "javascript",
"preserveBehavior": true
}
}
{
"tool": "grok_analyze_code",
"arguments": {
"code": "// code to analyze",
"aspects": ["performance", "security", "maintainability"],
"language": "python"
}
}
When using with Claude Desktop or Claude.ai, the tools are available directly:
Human: Can you help me create a React component for a todo list using the grok code server?
FAQs
MCP server for xAI's grok-code-fast-1 model - Expert coding assistant with 256K context
The npm package grok-code-mcp-server receives a total of 1 weekly downloads. As such, grok-code-mcp-server popularity was classified as not popular.
We found that grok-code-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.