npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-server-xai-grok

v1.0.0

Published

MCP server for x.ai Grok API - chat completions and AI interactions

Downloads

129

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 with role and content
  • model (optional): Model to use (grok-beta, grok-2-latest, grok-4-latest). Default: grok-4-latest
  • temperature (optional): Sampling temperature (0-2). Default: 1.0
  • max_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