Skip to main content
Glama

grok-mcp

MCP-Server, der die xAI Grok-API umschließt. Ermöglicht es Claude und anderen KI-Agenten, Denk-, Planungs- und Echtzeit-Suchaufgaben an Grok zu delegieren.

Schnellstart

Einzeiler zum Hinzufügen zu Claude Code auf jedem Gerät:

claude mcp add grok -e XAI_API_KEY=your-key -- npx -y @pkwadsy/grok-mcp

Sie benötigen einen xAI-API-Schlüssel von console.x.ai.

Alternative: Projektkonfiguration

Hinzufügen zur .mcp.json Ihres Projekts:

{
  "mcpServers": {
    "grok": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@pkwadsy/grok-mcp"],
      "env": {
        "XAI_API_KEY": "your-xai-api-key"
      }
    }
  }
}

Related MCP server: grok-search-mcp

Tools

ask_grok

Stellen Sie Grok eine Frage mit optionalem Dateikontext, Websuche und X/Twitter-Suche.

Parameter

Typ

Erforderlich

Beschreibung

prompt

string

ja

Die Frage oder Aufgabe für Grok

files

string[]

nein

Dateien, die in den Kontext einbezogen werden sollen (siehe Dateisyntax unten)

max_files

number

nein

Maximale Anzahl an Dateien überschreiben (Standard 50)

max_file_size

number

nein

Maximale Größe pro Datei in KB überschreiben (Standard 32)

system_prompt

string

nein

Benutzerdefinierter System-Prompt

model

string

nein

Zu verwendendes Modell (Standard: grok-4.20-multi-agent)

web_search

boolean

nein

Websuche, standardmäßig aktiviert

x_search

boolean

nein

X/Twitter-Suche aktivieren

check_files

Testlauf der Datei-Auflösung. Überprüft alle Dateien und zeigt die Größen an, ohne Grok aufzurufen. Wenn check_files erfolgreich ist, wird ask_grok ebenfalls erfolgreich sein.

Parameter

Typ

Erforderlich

Beschreibung

files

string[]

ja

Zu prüfende Dateien (gleiche Syntax wie ask_grok)

max_files

number

nein

Maximale Anzahl an Dateien überschreiben (Standard 50)

max_file_size

number

nein

Maximale Größe pro Datei in KB überschreiben (Standard 32)

Dateisyntax

Dateien werden als Array von Strings mit kompakter Syntax übergeben:

Syntax

Beschreibung

"src/index.ts"

Ganze Datei

"src/index.ts:10-30"

Zeilen 10 bis 30

"src/index.ts:10"

Nur Zeile 10

"src/**/*.ts"

Glob-Muster

"large-file.ts:force"

Größenbeschränkung pro Datei umgehen

"large-file.ts:1-100:force"

Zeilenbereich mit Force kombinieren

Sicherheitslimits

Limit

Standard

Überschreiben

Dateien pro Aufruf

50

max_files Parameter

Größe pro Datei

32 KB

max_file_size Parameter oder :force Suffix

Gesamter Kontext

256 KB

Hartes Limit, nicht überschreibbar

Verfügbare Modelle

  • grok-4.20-multi-agent — Multi-Agenten-Modus, hervorragend für Architektur und Planung (Standard)

  • grok-4.20-reasoning — Flaggschiff-Reasoning

  • grok-4.20-non-reasoning — schnell, kein Reasoning

  • grok-4.1-fast-reasoning — günstigeres Reasoning

  • grok-4.1-fast-non-reasoning — am günstigsten, schnell

Beispiele

Frage mit Dateikontext:

prompt: "Review this code for bugs"
files: ["src/index.ts", "src/utils.ts:20-50"]

Websuche:

prompt: "What happened in tech news today?"

X/Twitter-Suche:

prompt: "What are people saying about the new React release?"
x_search: true

Dateien vor dem Fragen prüfen:

files: ["src/**/*.ts"]

Lizenz

MIT

Available Tools

2 tools
ask_grokA

Ask Grok a question. Grok is great for thinking, planning, architecture, and real-time search via web and X/Twitter. Use web_search for current information from the internet. Use x_search to find and analyze posts on X/Twitter. IMPORTANT: Grok has no context about your conversation or codebase. Always include all relevant context directly in the prompt — file contents, error messages, architecture details, constraints, and goals. The more context you provide, the better Grok's response will be. Do not assume Grok knows anything about the current project. Use the files parameter to automatically include file contents with line numbers — this is preferred over pasting code into the prompt. File paths are resolved relative to the server working directory: /app. Responses include a response_id — pass it back as previous_response_id to continue a conversation without resending context.

Inputs: prompt (required), previous_response_id, files, max_files, +5 more.

check_filesA

Dry-run file resolution. Use this before ask_grok to verify files will resolve correctly and check context size. Uses the same validation as ask_grok — if check_files passes, ask_grok will too. File paths resolve relative to: /app

Inputs: files (required), max_files, max_file_size.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 2 tools

    Disambiguation5/5

    ask_grok and check_files serve clearly distinct purposes: one is for querying Grok, the other is a dry-run validator for file resolution. No overlap or ambiguity.

    Naming Consistency5/5

    Both tool names follow a consistent verb_noun pattern (ask_grok, check_files), using underscores and clear verbs.

    Tool Count3/5

    Only 2 tools feels thin for a server that provides access to Grok, which could benefit from additional tools for conversation management or specialized searches.

    Completeness2/5

    The tool set lacks basic conversational features like retrieving history or managing context, and the promised web_search/x_search capabilities are not exposed as separate tools, limiting functionality.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers