Skip to main content
Glama

grok-mcp

xAI Grok APIをラップするMCPサーバー。Claudeやその他のAIエージェントが、思考、計画、リアルタイム検索をGrokに委任できるようにします。

クイックスタート

あらゆるデバイスでClaude Codeに追加するためのワンライナー:

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

console.x.aiからxAI APIキーを取得する必要があります。

代替案:プロジェクト設定

プロジェクトの .mcp.json に以下を追加します:

{
  "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

ツール

ask_grok

ファイルコンテキスト、ウェブ検索、X/Twitter検索をオプションとして指定し、Grokに質問します。

パラメータ

型

必須

説明

prompt

string

はい

Grokへの質問またはタスク

files

string[]

いいえ

コンテキストに含めるファイル(以下のファイル構文を参照)

max_files

number

いいえ

最大ファイル数の上書き(デフォルト50)

max_file_size

number

いいえ

ファイルごとの最大サイズ(KB)の上書き(デフォルト32)

system_prompt

string

いいえ

カスタムシステムプロンプト

model

string

いいえ

使用するモデル(デフォルト: grok-4.20-multi-agent)

web_search

boolean

いいえ

ウェブ検索(デフォルトで有効)

x_search

boolean

いいえ

X/Twitter検索を有効にする

check_files

ファイルのドライラン解決。Grokを呼び出さずに、すべてのファイルを検証しサイズを表示します。check_files が成功すれば、ask_grok も成功します。

パラメータ

型

必須

説明

files

string[]

はい

チェックするファイル(ask_grokと同じ構文)

max_files

number

いいえ

最大ファイル数の上書き(デフォルト50)

max_file_size

number

いいえ

ファイルごとの最大サイズ(KB)の上書き(デフォルト32)

ファイル構文

ファイルはコンパクトな構文の文字列配列として渡されます:

構文

説明

"src/index.ts"

ファイル全体

"src/index.ts:10-30"

10行目から30行目

"src/index.ts:10"

10行目のみ

"src/**/*.ts"

グロブパターン

"large-file.ts:force"

ファイルごとのサイズ制限をバイパス

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

行範囲と強制指定の組み合わせ

安全制限

制限

デフォルト

上書き

呼び出しごとのファイル数

50

max_files パラメータ

ファイルごとのサイズ

32 KB

max_file_size パラメータまたは :force サフィックス

合計コンテキスト

256 KB

ハードキャップ(上書き不可)

利用可能なモデル

  • grok-4.20-multi-agent — マルチエージェントモード、アーキテクチャや計画に最適(デフォルト)

  • grok-4.20-reasoning — フラッグシップ推論モデル

  • grok-4.20-non-reasoning — 高速、推論なし

  • grok-4.1-fast-reasoning — より安価な推論モデル

  • grok-4.1-fast-non-reasoning — 最も安価で高速

例

ファイルコンテキストを指定して質問:

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

ウェブ検索:

prompt: "What happened in tech news today?"

X/Twitter検索:

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

質問前にファイルをチェック:

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

ライセンス

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