A self-hosted MCP lets chat apps search X through a Grok Bot webhook routine
Source read in fullRead first
Overview
Someone who already has Grok Bot and its X connector can run this Node server so ChatGPT, Claude or Gemini can search X without an X API key, if they can expose HTTPS on port 443.
Workflow
- What it is: A self-hosted MCP server that lets ChatGPT, Claude or Gemini search X through the owner's Grok Bot. The README presents it as a way to use the X connector the owner already pays for, with no X API account and no extra cost beyond the Grok Bot plan. It uses only Node.js 22, has no npm dependencies, and includes its own OAuth server so those chat apps can connect with no client ID.
- Grok Bot parts used: A webhook routine plus an
x_searchskill that calls the Bot's X connector; an optionalx_videoskill useswatchVideo. The chat app callsx_searchon this server; the server POSTs the search to the routine webhook; the routine runs the skill; the routine POSTs posts back to<PUBLIC_URL>/callbackwith a one-time token; the server returns them to the chat app. Optionalx_video(off by default,ENABLE_X_VIDEO=1) has the routine fetch a post, download its MP4 (up to 720p) to the Bot's computer, and hand it towatchVideo. The webhook URL and key do not change when that skill is added. Not part of Grok Bot: the Node MCP server you run on your own machine or VPS, its OAuth approval page, and the public HTTPS proxy or tunnel (Tailscale Funnel or cloudflared are cited as free options). Grok Bot has no API for X search; only the Bot model can call the connector, which is why the webhook routine is the way in. Nox.ai/bot/...template link is in the repo. - You need: A Grok Bot plan with the X connector (the README says Grok Bot comes with X Premium, Super and Ultra), a machine that stays on with Node.js 22 or later, a public HTTPS address on port 443, and a chat app plan that allows custom MCP connectors. A Grok Bot routine reaches only port 443; another port fails with a TLS error and no result arrives. You do not need a database, an X API key, or a GitHub or Google app. Optional: a VPS if you do not want to keep your own computer on.
- Install: Clone the repo, set
PUBLIC_URL, paste a generated setup prompt into a normal Grok Bot chat, store the webhook, put HTTPS in front of127.0.0.1:7815, then test and add the connector.- Step 1: Clone the repo, enter it, and set
PUBLIC_URL. The path ofPUBLIC_URLis random and is the MCP endpoint; keep it.
git clone https://github.com/marciob/grok-x-mcp.git cd grok-x-mcp export PUBLIC_URL="https://your-host.example/$(node bin/grok-x-mcp.mjs random)"
- Step 2: Run
node bin/grok-x-mcp.mjs setup-prompt, copy the printed text, and paste it into a normal chat with the Grok Bot in the app. The Bot makes the skillx_searchand the routinex_search webhook. Do not send that text through a routine or automation: a routine run cannot make another routine. Then open the routine in the Grok Bot desktop app and copy the Webhook POST to URL and the key. IfPUBLIC_URLchanges, runsetup-promptagain and give the new text to the Bot. The generated prompt is printed by the CLI and is not stored as a file in the repository, so it is not copied here. - Step 3:
mkdir -p ~/.grok-x-mcp && chmod 700 ~/.grok-x-mcp, store the key in~/.grok-x-mcp/routine.keywith mode 600, and exportGROK_ROUTINE_URLandGROK_ROUTINE_KEY_FILE. - Step 4: The server listens on
127.0.0.1:7815. Put an HTTPS proxy or tunnel in front, on port 443, including the route and paths under it (/callback,/oauth/) and the/.well-known/OAuth routes listed in the README. With Tailscale Funnel the README showstailscale funnel --bg --set-path /<route> http://127.0.0.1:7815/<route>for each path; with cloudflared or Caddy, send the whole host tohttp://127.0.0.1:7815. - Step 5:
node bin/grok-x-mcp.mjs test "from:xai"runs one real search through the routine; thennode bin/grok-x-mcp.mjs serve. In the chat app, add a custom connector withPUBLIC_URL, enter the approval secret from~/.grok-x-mcp/approval.secret, and try a search.
- After install: A search from the chat app takes 20 to 40 seconds; a slower job returns a
req_idto poll again. Each post can include media type, size, a direct URL and alt text (nonewhen there is none). Withimages: true, up to 4 photos or video posters are attached, at most 1 MB each and 3 MB in total. Optionalx_videoreturns what a video shows, on-screen text, a speech transcript and other sound; aquestionasks for one thing in the video. Nothing inx_videoruns on your machine.MAX_SEARCHES_PER_HOURdefaults to 60 (1 to 200) as a cap on routine runs. - Did the author run it: The repository has no separate run-record files. The README reports that one video reading took 103 seconds for an 18-second video, with the Bot asleep at the start (author's claim, not reproduced).
testis said to print the first posts and the time.npm testuses a fake routine and needs no Grok Bot and no network.
Key points and results
- Maturity: At fetch time on 2026-11-28 the repo was created 2026-11-26T03:27:02Z, last pushed 2026-11-27T01:08:21Z, with 6 commits, 1 star, 0 forks, 0 open issues or PRs, and an MIT license. There is no Grok Bot template link, and no Grok Bot skill or routine files were in the extracted repo files; the setup prompt is generated by the CLI.
- Permissions and boundaries: The routine sends results only to a callback that starts with your
PUBLIC_URL; each search uses a one-time token (the server stores a SHA-256 digest and forgets it after 15 minutes); requests expire (5 minutes, or 10 for a video reading); chat apps must pass an approval page that asks for an approval secret; access tokens last 1 hour. The log is one line per request with no content, tokens or secrets. The README tells owners not to share the server, resell results, or use it for bulk collection, citing the xAI Acceptable Use Policy language on scraping and circumventing rate limits. - Known limits: Each search is one routine run and spends Grok Bot plan usage; a routine runs at most 200 times an hour, and all routines together at most 300, per the docs the README cites. The X connector instructions, as relayed from the Bot, give 30 calls a minute, 1,000 a day (reset at 00:00 UTC), and at most 25 posts a call; the README says those numbers are not from a public page and can change.
min_retweetsandmin_repliesdo not work;min_favesis applied after the result.watchVideois not documented by xAI; its model, limits and cost are unknown, and its reading should be treated as a reading, not as fact. Video reading is slower and costs more plan usage than a search. - Worth borrowing: Keep the webhook callback locked to your own public URL and use one-time tokens rather than sending post text as instructions. This is stated in the README security model.
- Worth borrowing: Generate the skill and routine from a normal chat, not from a routine run, because a routine cannot create another routine. From the setup steps in the README.
- Worth borrowing: Put a running commit or request-id style check aside; here, require port 443 because a Grok Bot routine cannot reach another port. From the install notes in the README.
Source
- Platform
- GitHub
- Author
- marciob
- Published
- Categories
- Code and repos
What this evidence label means
Source read in full
We read the source (post, article or transcript). That only means the original was read. It does not mean this site reproduced the author's results.