grokbot-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@grokbot-mcpask grokbot to summarize the latest AI news"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
grokbot-mcp
Grok Bot(Cursor automation の webhook)の非同期 callback を、MCP ツールの同期的な結果に変換する Cloudflare Worker。
MCP client ─ask_grokbot→ Worker ─POST {message, run_id, callback_url}→ Grok Bot
MCP client ←answer_text─ Worker ←POST /callbacks/{run_id}/{token} {answer}─ Grok Bot構成(Structure)
run 1件 = Durable Object Run 1つ。待機中の waiter は DO のメモリ上、状態は DO storage。
ファイル | 役割 |
| Worker 入口。MCP ツール、callback の認証・受信、webhook 送信 |
|
|
|
|
| vars の検証(不正なら fail-closed) |
| Workers ランタイム上の統合テスト(vitest-pool-workers) |
Related MCP server: Grok Web MCP
MCP ツール(POST /mcp、Authorization: Bearer $MCP_API_KEY または X-API-Key: $MCP_API_KEY)
Tool | 用途 |
| webhook に送信し callback を待つ。webhook 失敗時は |
| pending の続きを待つ |
| run を取得 |
| pending を取り消す |
status: pending / answered / cancelled / expired。待機は MAX_WAIT_SECONDS(上限 300)で打ち切り。/mcp 全体は MCP_RATE_LIMITER(60 回/分、ロケーション単位)で 429。
Callback(Grok Bot → Worker)
callback_url は /callbacks/{run_id}/{token}、token は HMAC-SHA256(CALLBACK_SIGNING_SECRET, run_id)。Worker が body を読む前・DO を起こす前に検証するので、偽の callback は 403 で弾かれ DO 課金にならない。
callback_url に {"answer": "..."} を POST。run_id を含める場合は URL と一致しなければ 400 run_id_mismatch。
答えは answer → message → content → text → output → result の順で抽出し、どれもなければ body 全体の JSON を answer_text にする。
403 invalid_token、400 invalid_json / body_must_be_object / run_id_mismatch、404 不明な run、405 POST 以外、409 already_answered / already_cancelled、410 期限切れ、413 256KB 超、503 callback_secret_not_configured / misconfigured。
セットアップ
ボタンで: 上の Deploy to Cloudflare を押すと、リポジトリが自分の GitHub / GitLab に複製され、Durable Object 込みでデプロイされる。設定画面で 4 つの secret(下記)を入力する。
CLI で:
bun install
wrangler secret put CURSOR_WEBHOOK_URL
wrangler secret put CURSOR_WEBHOOK_API_KEY
wrangler secret put MCP_API_KEY # openssl rand -hex 32
wrangler secret put CALLBACK_SIGNING_SECRET # openssl rand -hex 32
bun run deployGrok Bot の routine(トリガー: Webhook)を作り、POST 先と Key を CURSOR_WEBHOOK_URL / CURSOR_WEBHOOK_API_KEY に入れる。Instructions の例:
Webhook で起動したら、ペイロードを読む。test: true / 空ボディ / 依頼文が無いものは無視する。
message を依頼文として扱い、回答を作る。ペイロードの run_id をそのままエコーし、新しい ID を発行しない。
1. callback_url に JSON を POST する(Content-Type: application/json、User-Agent: grokbot-bridge-callback/1。
Authorization ヘッダは付けず、着信 webhook のキーは転送しない)。
ボディ: {"ok": true, "run_id": "<着信UUID>", "answer": "<回答全文>"}
2. callback_url には疎通確認・test の POST を送らない。最初の POST が必ず回答全文であること。
3. 再送は通信エラーまたは 5xx のときだけ 1 回。4xx は再送しない。
4. このチャットには「回答: <要約>」「run_id: …」「callback: HTTP <ステータス>」だけを投稿する。User-Agent を明示する。Python-urllib 既定の UA は Cloudflare に 1010(403)で弾かれ、Worker まで届かない。
最初に届いた callback で回答が確定する(2 回目以降は 409)。probe を送ると probe の内容が回答になる。
MCP クライアントの接続
transport は Streamable HTTP(stdio ではない)。URL は https://<worker>.workers.dev/mcp、認証は Authorization: Bearer <MCP_API_KEY>(または X-API-Key)。
Claude Code:
claude mcp add --transport http grokbot https://<worker>.workers.dev/mcp \
--header "Authorization: Bearer $MCP_API_KEY"JSON 設定(Claude Code の .mcp.json は ${VAR} を環境変数で展開する。展開しないクライアントでは値を直接書く):
{
"mcpServers": {
"grokbot": {
"type": "http",
"url": "https://<worker>.workers.dev/mcp",
"headers": { "Authorization": "Bearer ${MCP_API_KEY}" }
}
}
}Cursor の mcp.json も同じ形(type は省略可)。キーをリポジトリに commit しないこと。
接続確認(4 つのツール名が返れば OK):
curl -s https://<worker>.workers.dev/mcp \
-H "Authorization: Bearer $MCP_API_KEY" -H "content-type: application/json" \
-H "accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | grep -o '"name":"[a-z_]*"'ローカル開発
ローカル開発は .dev.vars.example を .dev.vars にコピーして値を埋め、bun run dev。テストは bun run test、型チェックは bun run typecheck。
コストガードレール
ガードレール | 上限の対象 | 設定 |
|
|
|
|
| 同上 |
|
| 同上(変更後に deploy) |
|
|
|
HMAC callback token | 偽 callback による body 読み込みと DO 起動 |
|
| 1 件あたりの入力サイズ、webhook の待ち時間 |
|
| 1 回の待機時間、回答待ちの期限、終了後の保存期間(0 = 削除しない) | vars |
上限は単一 DO Budget("global") で正確にカウントする。拒否された ask は webhook も Run DO も作らない。
webhook が 4xx を返した ask は受理されていないので枠を戻す。5xx・タイムアウト(10 秒)・通信断は相手側で処理された可能性があるので戻さない。
vars が数値として不正なら /mcp と callback は 503 misconfigured を返す(上限が効かない状態で動かさない)。
残る最悪ケース(推定): 日次上限を毎日最大待機で使い切っても、DO は約 800 リクエスト・約 4,500 GB-s / 日で、Free の日次枠・Paid の月間無料枠に収まる。Grok Bot / Cursor 側の利用量は ASK_DAILY_LIMIT 件/日が上限になる。
/mcp への未認証リクエストと不正 token の callback は Worker リクエスト課金($0.30/M)のみ。
手動で設定しておくもの:
Cloudflare ダッシュボード → Billing → Billable Usage → 予算アラート(通知のみで停止はしない)
Cursor 側の利用上限(spend limit)
License
MIT。脆弱性の報告は SECURITY.md を参照。
This server cannot be deployed
Maintenance
Related MCP Connectors
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Discover and call AI agents via MCP. Supports A2A agents and platform agents with async tasks.
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with the Grok AI through an MCP server, supporting chat completions, text completions, embeddings, and model operations with streaming capabilities.555 npm7MIT
- FlicenseNot gradedqualityCmaintenanceAutomates Grok web interface to provide chat, web search, and conversation management via MCP, supporting multiple accounts and local/remote deployment.-
- AlicenseAqualityDmaintenanceEnables AI agents to manage Grok Bots through MCP: create, list, search, and delete bots, send and receive messages, read conversation transcripts, search message history, and check usage.112MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients like Codex and Claude Code to start or continue conversations with Grok Build, track progress, read completed answers, and cancel running turns using an existing Grok login.1Apache 2.0