Grok MCP Server logo

Grok MCP Server

Community
LKbaba

An MCP server that connects Claude Code to xAI's Grok, unlocking real-time web search and X (Twitter) search capabilities.

PublisherLKbaba
RepositoryGrok-mcp
LanguageTypeScript
Forks
0
Stars
151
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Grok MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    151 stars and 0 forks from the linked repository.

Grok MCP Server

Give Claude Code the power of Grok 4.20

An MCP server that connects Claude Code to xAI's Grok, unlocking real-time web search and X (Twitter) search capabilities.

Why Grok + Claude?

Grok's StrengthsUse Case
Web + X SearchReal-time information with transparent source URLs
X/Twitter SearchTrack social media trends, public opinion, breaking news
4-Agent ArchitectureHarper (research) + Benjamin (logic) + Lucas (creative) collaboration
2M Token ContextMassive context window for comprehensive analysis

Philosophy: Claude is the commander, Grok is the specialist for real-time search and social media intelligence.

Quick Start

1. Get API Key

Visit xAI Console and create an API key.

2. Configure Claude Code

Add to your MCP config file:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
json
{
  "mcpServers": {
    "grok-mcp": {
      "command": "npx",
      "args": ["-y", "@lkbaba/grok-mcp@latest"],
      "env": {
        "XAI_API_KEY": "your_xai_api_key_here"
      }
    }
  }
}

@latest ensures you always get the newest version when Claude Code restarts.

3. Restart Claude Code

Tools (2)

grok_agent_search - Smart Search

Real-time web and X (Twitter) search powered by Grok. Grok automatically analyzes queries, executes searches (potentially multiple rounds), synthesizes information, and provides cited answers.

ParameterTypeRequiredDefaultDescription
querystringYes-Search query
search_typeenumNomixedweb / x / mixed (recommended)
modelenumNogrok-4.20-multi-agent-beta-0309See model table below
output_formatenumNotexttext (Markdown) / json (native JSON Schema enforced)
web_search_configobjectNo-Domain filters (allowed/excluded are mutually exclusive)
x_search_configobjectNo-Date range, handle filters (allowed/excluded are mutually exclusive), video understanding

Output includes: Search results with inline citations, search queries Grok used, titled source links, and usage statistics.

Example:

"Search for the latest Claude Code updates on X and the web"

grok_brainstorm - Creative Brainstorming

Multi-perspective idea generation with project context support.

ParameterTypeRequiredDefaultDescription
topicstringYes-Brainstorming topic
contextstringNo-Additional context
context_filesstring[]No-Project files to read as context (max 10)
countnumberNo5Number of ideas (1-10)
styleenumNobalancedinnovative / practical / radical / balanced
modelenumNogrok-4.20-multi-agent-beta-0309Model selection
output_formatenumNotexttext (Markdown) / json (native JSON Schema with pros/cons/feasibility)

Style temperature mapping: practical=0.5, balanced=0.7, innovative=0.95, radical=1.0

Example:

"Brainstorm 3 practical ideas for improving user onboarding, read ./README.md for context"

Model Selection

ModelArchitecturePrice (input/output per M)ContextBest For
grok-4.20-multi-agent-beta-03094-Agent collaboration$2.00 / $6.002MDefault — lowest hallucination rate (~4.2%)
grok-4.20-beta-0309-reasoningChain-of-thought$2.00 / $6.002MDeep technical analysis
grok-4.20-beta-0309-non-reasoningStandard$2.00 / $6.002MFastest speed, quick creative divergence

Performance

Tested on 2026-03-12:

OperationModelTimeTokens
Web Searchmulti-agent~29s~70K
X Searchmulti-agent~28s~48K
Brainstorm (3 ideas)multi-agent~16s~3.6K
Brainstorm (5 ideas)non-reasoning~7s~2.2K

Proxy Configuration

Add proxy environment variable to your config:

json
{
  "mcpServers": {
    "grok-mcp": {
      "command": "npx",
      "args": ["-y", "@lkbaba/grok-mcp@latest"],
      "env": {
        "XAI_API_KEY": "your_xai_api_key_here",
        "HTTPS_PROXY": "http://127.0.0.1:7897"
      }
    }
  }
}

Native fetch (undici) automatically reads proxy environment variables.

Local Development

bash
git clone https://github.com/LKbaba/Grok-mcp.git
cd Grok-mcp
npm install
npm run build
export XAI_API_KEY="your_xai_api_key_here"
npm start

Project Structure

src/
├── config/
│   └── index.ts          # Configuration (zod validation)
├── types/
│   └── index.ts          # TypeScript type definitions
├── tools/
│   ├── definitions.ts    # MCP tool JSON Schema definitions
│   ├── agent-search.ts   # grok_agent_search implementation
│   └── brainstorm.ts     # grok_brainstorm implementation
├── utils/
│   ├── grok-client.ts    # xAI API client (native fetch)
│   ├── tool-builder.ts   # Search tool parameter builder
│   └── logger.ts         # Logging and performance monitoring
└── index.ts              # MCP server entry point

Comparison with Gemini MCP

FeatureGemini MCPGrok MCP
Web SearchGoogle Search (grounding)Grok Web Search
X/Twitter SearchNot availableNative support
Citation URLsGoogle redirect (opaque)Direct URLs with titles (transparent)
Search Speed~8-10s (flash)~16-29s (grok-4.20)
Agent ArchitectureSingle model4-Agent collaboration
Structured Outputtext/jsontext/json (native JSON Schema enforced)
BrainstormStructured JSONStructured JSON + style/count/context_files

Best strategy: Use both! Gemini for speed and code analysis, Grok for deep search and X/Twitter intelligence.

Security

  • Path traversal protection: context_files are sandboxed to the working directory — paths like ../../etc/passwd are blocked
  • Sensitive file blocking: .env, .pem, .key, credentials, and database files are automatically excluded
  • Input validation: Domain filters, date ranges, handle filters, and file counts are validated with strict schemas
  • Mutual exclusivity: allowed_domains/excluded_domains and allowed_x_handles/excluded_x_handles cannot be set simultaneously
  • No hardcoded secrets: API keys are loaded from environment variables only

License

MIT

Installation

TypingMind
{
  "mcpServers": {
    "lkbaba-grok-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@lkbaba/grok-mcp"
      ],
      "env": {
        "XAI_API_KEY": "<XAI_API_KEY>"
      }
    }
  }
}

Use Grok MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Grok MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Grok MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Grok MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "lkbaba-grok-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@lkbaba/grok-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Grok MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Grok MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Grok MCP Server to help me with this task?
Grok MCP Server
Sure. I read it.
Here is what I found using Grok MCP Server.

Frequently asked questions

What is the Grok MCP Server MCP server used for?

Grok MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Grok MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Grok MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Grok MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Grok MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Grok MCP Server MCP to TypingMind?

Grok MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Grok MCP Server MCP provide in TypingMind?

Grok MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Grok MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Grok MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇